diff options
author | Lei Zhang <thestig@chromium.org> | 2015-10-05 17:00:03 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-10-05 17:00:03 -0700 |
commit | 2d5a0e173f3bb8335cf302f1194305c2f9e65bed (patch) | |
tree | 9e82cf609b817dfc153a1506ed2b2188663275d5 /fpdfsdk/include/javascript/JS_Runtime.h | |
parent | ca70a69f4b5ac05eb7e054cfa014d219b915f632 (diff) | |
download | pdfium-2d5a0e173f3bb8335cf302f1194305c2f9e65bed.tar.xz |
Merge to XFA: CJS_Timer should observe CJS_Runtime destruction.
Also remove dead CJS_EmbedObj::{Begin,End}Timer code.
BUG=539107
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1384883002 .
(cherry picked from commit 794c9b67d3d519342aa7e15052766f7d4a99f551)
Review URL: https://codereview.chromium.org/1386053002 .
Diffstat (limited to 'fpdfsdk/include/javascript/JS_Runtime.h')
-rw-r--r-- | fpdfsdk/include/javascript/JS_Runtime.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h index 042bba9dcb..578da2e092 100644 --- a/fpdfsdk/include/javascript/JS_Runtime.h +++ b/fpdfsdk/include/javascript/JS_Runtime.h @@ -20,6 +20,14 @@ class CJS_Context; class CJS_Runtime : public IFXJS_Runtime { public: + class Observer { + public: + virtual void OnDestroyed() = 0; + + protected: + virtual ~Observer() {} + }; + using FieldEvent = std::pair<CFX_WideString, JS_EVENT_T>; explicit CJS_Runtime(CPDFDoc_Environment* pApp); @@ -50,6 +58,9 @@ class CJS_Runtime : public IFXJS_Runtime { virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue); + void AddObserver(Observer* observer); + void RemoveObserver(Observer* observer); + private: void DefineJSObjects(); @@ -62,6 +73,7 @@ class CJS_Runtime : public IFXJS_Runtime { bool m_isolateManaged; nonstd::unique_ptr<FXJS_ArrayBufferAllocator> m_pArrayBufferAllocator; v8::Global<v8::Context> m_context; + std::set<Observer*> m_observers; }; #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_RUNTIME_H_ |