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

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

Issue 1352393003: Use std::set<> to track active event handlers. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | fpdfsdk/src/javascript/JS_Context.cpp » ('j') | fpdfsdk/src/javascript/JS_Runtime.cpp » ('J')
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 a5d695487514a6920f77ce4d300bf9a849827391..c3da69a0cd6ce8cd4d4657b2194ce9f7de16987e 100644
--- a/fpdfsdk/include/javascript/JS_Runtime.h
+++ b/fpdfsdk/include/javascript/JS_Runtime.h
@@ -7,6 +7,9 @@
#ifndef FPDFSDK_INCLUDE_JAVASCRIPT_JS_RUNTIME_H_
#define FPDFSDK_INCLUDE_JAVASCRIPT_JS_RUNTIME_H_
+#include <set>
+#include <utility>
+
#include "../../../third_party/base/nonstd_unique_ptr.h"
#include "../../../core/include/fxcrt/fx_basic.h"
#include "../jsapi/fxjs_v8.h"
@@ -15,15 +18,10 @@
class CJS_Context;
-class CJS_FieldEvent {
- public:
- CFX_WideString sTargetName;
- JS_EVENT_T eEventType;
- CJS_FieldEvent* pNext;
-};
-
class CJS_Runtime : public IFXJS_Runtime {
public:
+ using FieldEvent = std::pair<CFX_WideString, JS_EVENT_T>;
+
explicit CJS_Runtime(CPDFDoc_Environment* pApp);
~CJS_Runtime() override;
@@ -36,11 +34,8 @@ class CJS_Runtime : public IFXJS_Runtime {
CPDFDoc_Environment* GetReaderApp() const { return m_pApp; }
- FX_BOOL AddEventToLoop(const CFX_WideString& sTargetName,
- JS_EVENT_T eEventType);
- void RemoveEventInLoop(const CFX_WideString& sTargetName,
- JS_EVENT_T eEventType);
- void RemoveEventsInLoop(CJS_FieldEvent* pStart);
+ FX_BOOL AddEventToSet(const FieldEvent& event);
Lei Zhang 2015/09/22 22:20:50 Can we use bool in new code?
Tom Sepez 2015/09/22 22:32:46 Done.
+ void RemoveEventFromSet(const FieldEvent& event);
void BeginBlock() { m_bBlocking = TRUE; }
void EndBlock() { m_bBlocking = FALSE; }
@@ -56,7 +51,7 @@ class CJS_Runtime : public IFXJS_Runtime {
CPDFDoc_Environment* m_pApp;
CPDFSDK_Document* m_pDocument;
FX_BOOL m_bBlocking;
- CJS_FieldEvent* m_pFieldEventPath;
+ std::set<FieldEvent> m_FieldEventSet;
v8::Isolate* m_isolate;
bool m_isolateManaged;
nonstd::unique_ptr<FXJS_ArrayBufferAllocator> m_pArrayBufferAllocator;
« no previous file with comments | « no previous file | fpdfsdk/src/javascript/JS_Context.cpp » ('j') | fpdfsdk/src/javascript/JS_Runtime.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698