diff options
author | weili <weili@chromium.org> | 2016-09-21 11:50:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-21 11:50:43 -0700 |
commit | 0b2a9874bddf44b4226fcbafa9ce159a9b3735a8 (patch) | |
tree | ddd52af69935f9c5480386dfbfbc923c03b6e71e /fxjs/include | |
parent | 54be7be992f1cde40b9d5c0e55a119c6cc4e4e02 (diff) | |
download | pdfium-0b2a9874bddf44b4226fcbafa9ce159a9b3735a8.tar.xz |
Set up isolate in CFXJS_Engine's constructor
CFXJS_Engine class should always be constructed with an isolate, except
for its subclasses which may need to create an isolate by themselves.
Move SetIsolate() function to be protected so that only subclasses can
access it.
Review-Url: https://codereview.chromium.org/2354353002
Diffstat (limited to 'fxjs/include')
-rw-r--r-- | fxjs/include/fxjs_v8.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fxjs/include/fxjs_v8.h b/fxjs/include/fxjs_v8.h index c08cc8b7ad..8b5fc8399a 100644 --- a/fxjs/include/fxjs_v8.h +++ b/fxjs/include/fxjs_v8.h @@ -138,7 +138,7 @@ size_t FXJS_GlobalIsolateRefCount(); class CFXJS_Engine { public: - CFXJS_Engine(); + explicit CFXJS_Engine(v8::Isolate* pIsolate); ~CFXJS_Engine(); using Constructor = void (*)(CFXJS_Engine* pEngine, @@ -155,8 +155,6 @@ class CFXJS_Engine { CFXJS_Engine* pEngine); #endif // PDF_ENABLE_XFA - // TODO(tsepez): to constructor. - void SetIsolate(v8::Isolate* pIsolate) { m_isolate = pIsolate; } v8::Isolate* GetIsolate() const { return m_isolate; } // Always returns a valid, newly-created objDefnID. @@ -258,6 +256,11 @@ class CFXJS_Engine { v8::Local<v8::String> WSToJSString(const CFX_WideString& wsPropertyName); void Error(const CFX_WideString& message); + protected: + CFXJS_Engine(); + + void SetIsolate(v8::Isolate* pIsolate) { m_isolate = pIsolate; } + private: v8::Isolate* m_isolate; v8::Global<v8::Context> m_V8PersistentContext; |