Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Unified Diff: fpdfsdk/include/javascript/JS_Runtime.h

Issue 1386053002: Merge to XFA: CJS_Timer should observe CJS_Runtime destruction. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/include/javascript/JS_Object.h ('k') | fpdfsdk/src/javascript/JS_Object.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/include/javascript/JS_Runtime.h
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h
index 042bba9dcb1e780e08c18ca9d9326c97f6421c89..578da2e0926f3eaa4fcc3b22f8dd721e4b481f84 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_
« no previous file with comments | « fpdfsdk/include/javascript/JS_Object.h ('k') | fpdfsdk/src/javascript/JS_Object.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698