OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ |
8 #define FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ | 8 #define FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 class CJS_Object { | 32 class CJS_Object { |
33 public: | 33 public: |
34 explicit CJS_Object(v8::Local<v8::Object> pObject); | 34 explicit CJS_Object(v8::Local<v8::Object> pObject); |
35 virtual ~CJS_Object(); | 35 virtual ~CJS_Object(); |
36 | 36 |
37 void MakeWeak(); | 37 void MakeWeak(); |
38 void Dispose(); | 38 void Dispose(); |
39 | 39 |
40 virtual void InitInstance(IJS_Runtime* pIRuntime); | 40 virtual void InitInstance(IJS_Runtime* pIRuntime); |
41 virtual void ExitInstance(); | |
42 | 41 |
43 v8::Local<v8::Object> ToV8Object() { return m_pV8Object.Get(m_pIsolate); } | 42 v8::Local<v8::Object> ToV8Object() { return m_pV8Object.Get(m_pIsolate); } |
44 | 43 |
45 // Takes ownership of |pObj|. | 44 // Takes ownership of |pObj|. |
46 void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj.reset(pObj); } | 45 void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj.reset(pObj); } |
47 CJS_EmbedObj* GetEmbedObject() const { return m_pEmbedObj.get(); } | 46 CJS_EmbedObj* GetEmbedObject() const { return m_pEmbedObj.get(); } |
48 | 47 |
49 v8::Isolate* GetIsolate() const { return m_pIsolate; } | 48 v8::Isolate* GetIsolate() const { return m_pIsolate; } |
50 | 49 |
51 protected: | 50 protected: |
52 std::unique_ptr<CJS_EmbedObj> m_pEmbedObj; | 51 std::unique_ptr<CJS_EmbedObj> m_pEmbedObj; |
53 v8::Global<v8::Object> m_pV8Object; | 52 v8::Global<v8::Object> m_pV8Object; |
54 v8::Isolate* m_pIsolate; | 53 v8::Isolate* m_pIsolate; |
55 }; | 54 }; |
56 | 55 |
57 | 56 |
58 #endif // FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ | 57 #endif // FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ |
OLD | NEW |