Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include/AdblockPlus/JsEngine.h

Issue 29393573: Issue 4692 - Dont' keep a strong reference from timer thread (Closed)
Patch Set: address comments Created March 24, 2017, 12:28 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/GlobalJsObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/AdblockPlus/JsEngine.h
diff --git a/include/AdblockPlus/JsEngine.h b/include/AdblockPlus/JsEngine.h
index dc210bc90c7e3c5277d313ced5db75952f1b65b7..48099ec26ce80be8d7628d0f8e3288221a2b9127 100644
--- a/include/AdblockPlus/JsEngine.h
+++ b/include/AdblockPlus/JsEngine.h
@@ -20,6 +20,7 @@
#include <functional>
#include <map>
+#include <list>
#include <stdexcept>
#include <stdint.h>
#include <string>
@@ -270,6 +271,21 @@ namespace AdblockPlus
return isolate->Get();
}
+ // Private functionality required to implement timers.
+ struct TimerTaskInfo
+ {
+ ~TimerTaskInfo();
+ int delay;
+ std::vector<std::unique_ptr<v8::Persistent<v8::Value>>> arguments;
+ };
+ typedef std::list<TimerTaskInfo> TimerTaskInfos;
+ struct TimerTask
+ {
+ std::weak_ptr<JsEngine> weakJsEngine;
+ TimerTaskInfos::const_iterator taskInfoIterator;
+ };
+ TimerTask CreateTimerTask(const v8::Arguments& arguments);
+ void CallTimerTask(TimerTaskInfos::const_iterator taskInfoIterator);
private:
explicit JsEngine(const ScopedV8IsolatePtr& isolate);
@@ -287,6 +303,7 @@ namespace AdblockPlus
std::mutex eventCallbacksMutex;
std::mutex isConnectionAllowedMutex;
IsConnectionAllowedCallback isConnectionAllowed;
+ TimerTaskInfos timerTaskInfos;
};
}
« no previous file with comments | « no previous file | src/GlobalJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld