Fix the broken build for JavaScript plugin
[platform/core/uifw/dali-toolkit.git] / plugins / dali-script-v8 / src / rendering / sampler-wrapper.h
1 #ifndef DALI_V8PLUGIN_SAMPLER_WRAPPER_H
2 #define DALI_V8PLUGIN_SAMPLER_WRAPPER_H
3
4 /*
5  * Copyright (c) 2016 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 <dali/public-api/rendering/sampler.h>
24
25 // INTERNAL INCLUDES
26 #include <shared/base-wrapped-object.h>
27
28 namespace Dali
29 {
30
31 namespace V8Plugin
32 {
33
34 /**
35  * A Sampler wrapper.
36  * Provides access to Sampler specific functionality and V8 memory handling.
37  */
38 class SamplerWrapper : public BaseWrappedObject
39 {
40
41 public:
42
43   /**
44    * @brief Constructor
45    * @param[in] sampler DALi sampler
46    * @param[in] gc garbage collection interface
47    */
48   SamplerWrapper( const Sampler& sampler,
49                 GarbageCollectorInterface& gc );
50
51   /**
52    * @brief Destructor
53    */
54   virtual ~SamplerWrapper()
55   {
56   };
57
58   /**
59    * @brief Creates a new Sampler wrapped inside a Javascript Object.
60    * @param[in] args v8 function call arguments interpreted
61    */
62   static void NewSampler( const v8::FunctionCallbackInfo< v8::Value >& args);
63
64   /**
65    * Wraps a sampler
66    */
67   static v8::Handle<v8::Object> WrapSampler(v8::Isolate* isolate, const Sampler& );
68
69   // The SamplerAttribute ObjectTemplate, we cache templates so we don't have
70   // keep generating them everytime we want to create a Sampler
71   static v8::Persistent<v8::ObjectTemplate> mSamplerTemplate;
72
73   /**
74    * @brief Gets the handle of sampler
75    * @return the handle of sampler
76    */
77   Sampler GetSampler();
78
79 private:
80
81   // Sampler
82   Sampler mSampler;
83
84   /**
85    * @brief Creates the object template that used to create sampler at runtime
86    * @param[in] isolate v8 isolated instance
87    * @return the object template
88    */
89   static v8::Handle<v8::ObjectTemplate> MakeSamplerTemplate( v8::Isolate* isolate );
90
91   /**
92    * @brief Gets the object template that used to create sampler at runtime
93    * @param[in] isolate v8 isolated instance
94    * @return the object template
95    */
96   static v8::Local<v8::ObjectTemplate> GetSamplerTemplate( v8::Isolate* isolate );
97 };
98
99 } // namespace V8Plugin
100
101 } // namespace Dali
102
103 #endif // DALI_V8PLUGIN_SAMPLER_WRAPPER_H