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: Created March 23, 2017, 5:24 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') | src/GlobalJsObject.cpp » ('J')
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..085a2647675b9693ae62f4f6c8f8b9c957b70146 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>
@@ -81,7 +82,6 @@ namespace AdblockPlus
{
friend class JsValue;
friend class JsContext;
-
Oleksandr 2017/03/24 12:15:25 Nit: I'm sure you can guess :). Unrelated?
sergei 2017/03/24 12:34:39 Done.
public:
/**
* Event callback function.
@@ -270,6 +270,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;
sergei 2017/03/23 17:27:13 We need std::unique_ptr here because v8::Persisten
+ };
+ typedef std::list<TimerTaskInfo> TimerTaskInfos;
+ struct TimerTask
+ {
+ std::weak_ptr<JsEngine> weakJsEngine;
+ TimerTaskInfos::const_iterator ii_taskInfo;
Oleksandr 2017/03/24 12:15:25 Nit: It is not immediately clear to me what ii_ st
sergei 2017/03/24 12:34:39 Done.
+ };
+ TimerTask CreateTimerTask(const v8::Arguments& arguments);
+ void CallTimerTask(TimerTaskInfos::const_iterator ii_taskInfo);
private:
explicit JsEngine(const ScopedV8IsolatePtr& isolate);
@@ -287,6 +302,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') | src/GlobalJsObject.cpp » ('J')

Powered by Google App Engine
This is Rietveld