[dali_1.4.26] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / plugins / dali-script-v8 / src / module-loader / module.h
1 #ifndef DALI_V8PLUGIN_MODULE_H
2 #define DALI_V8PLUGIN_MODULE_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <v8.h>
23 #include <string>
24
25 namespace Dali
26 {
27
28 namespace V8Plugin
29 {
30
31 /**
32  *
33  * Module class,
34  * contains
35  *
36  */
37 class Module
38 {
39 public:
40
41     Module(const std::string& path,
42           const std::string& fileName,
43           const std::string& moduleName,
44
45         v8::Isolate* isolate,
46         v8::Local<v8::Object>& exportsObject);
47
48     ~Module();
49
50     std::string mFileName;
51     std::string mPath;
52     std::string mModuleName;
53
54
55     /**
56      *  holds the exports object
57      *  e.g.  exports.hello = function() {" hello world"}
58      */
59     v8::Persistent<v8::Object> mExportsObject;
60
61     /*
62      * Currently we allow the modules context to be released after it has been
63      * compiled and run ( so we don't need to store it).
64      * Data is shared between contexts which suggests
65      * the module exports object can be kept alive if the context it was created in is deleted.
66      * If this is not the case, then start to store the context.
67      */
68     // v8::Persistent<v8::Context> mContext.
69
70 private:
71
72     Module();
73
74     Module( const Module& );            ///< undefined copy constructor
75     Module& operator=( const Module& ); ///< undefined assignment operator
76
77 };
78
79 } // namespace V8Plugin
80
81 } // namespace Dali
82
83 #endif // DALI_V8PLUGIN_MODULE_H