diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-09-15 14:03:52 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-09-15 14:03:52 -0700 |
commit | 09ed30750282bf56a92d0e646ab22c64bea81a36 (patch) | |
tree | 919cf39ff0c0688589a9db2521bce07abf16ed8f /fpdfsdk/include/javascript | |
parent | 72d51871ae152163eeb9b005fd0a74d5c1651cd2 (diff) | |
download | pdfium-09ed30750282bf56a92d0e646ab22c64bea81a36.tar.xz |
Refactor fxjs_v8 and add embeddertests for it.
This forces the layer defined by fxjs_v8.h to be (more)
self-contained, so that it can be tested apart from the
CJS_* objects (in fpdfsdk/{src,include}/javascript. This
implies the array buffer allocator must be part of fxjs_v8.
One wrinkle is that we'd like to be able to test an isolate
upon which no native objects have been added, so some
initialization that would have occurred as part of object
definition must be made explicit.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1338073002 .
Diffstat (limited to 'fpdfsdk/include/javascript')
-rw-r--r-- | fpdfsdk/include/javascript/IJavaScript.h | 4 | ||||
-rw-r--r-- | fpdfsdk/include/javascript/JS_Runtime.h | 10 |
2 files changed, 4 insertions, 10 deletions
diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h index 3524a5b8ff..47e4c17faf 100644 --- a/fpdfsdk/include/javascript/IJavaScript.h +++ b/fpdfsdk/include/javascript/IJavaScript.h @@ -146,7 +146,7 @@ class IFXJS_Runtime { class CJS_RuntimeFactory { public: - CJS_RuntimeFactory() : m_bInit(FALSE), m_nRef(0) {} + CJS_RuntimeFactory() : m_bInit(false), m_nRef(0) {} ~CJS_RuntimeFactory(); IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp); @@ -155,7 +155,7 @@ class CJS_RuntimeFactory { void Release(); private: - FX_BOOL m_bInit; + bool m_bInit; int m_nRef; }; diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h index 5ae6f1bc79..9d1927f192 100644 --- a/fpdfsdk/include/javascript/JS_Runtime.h +++ b/fpdfsdk/include/javascript/JS_Runtime.h @@ -15,12 +15,6 @@ class CJS_Context; -class CJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { - void* Allocate(size_t length) override; - void* AllocateUninitialized(size_t length) override; - void Free(void* data, size_t length) override; -}; - class CJS_FieldEvent { public: CFX_WideString sTargetName; @@ -30,7 +24,7 @@ class CJS_FieldEvent { class CJS_Runtime : public IFXJS_Runtime { public: - CJS_Runtime(CPDFDoc_Environment* pApp); + explicit CJS_Runtime(CPDFDoc_Environment* pApp); ~CJS_Runtime() override; // IFXJS_Runtime @@ -65,7 +59,7 @@ class CJS_Runtime : public IFXJS_Runtime { CJS_FieldEvent* m_pFieldEventPath; v8::Isolate* m_isolate; bool m_isolateManaged; - nonstd::unique_ptr<CJS_ArrayBufferAllocator> m_pArrayBufferAllocator; + nonstd::unique_ptr<JS_ArrayBufferAllocator> m_pArrayBufferAllocator; v8::Global<v8::Context> m_context; }; |