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

Delta Between Two Patch Sets: src/GlobalJsObject.cpp

Issue 29393573: Issue 4692 - Dont' keep a strong reference from timer thread (Closed)
Left Patch Set: Created March 23, 2017, 5:24 p.m.
Right Patch Set: address comments Created March 24, 2017, 12:28 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « include/AdblockPlus/JsEngine.h ('k') | src/JsEngine.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 19 matching lines...) Expand all
30 #include "Utils.h" 30 #include "Utils.h"
31 31
32 using namespace AdblockPlus; 32 using namespace AdblockPlus;
33 33
34 namespace 34 namespace
35 { 35 {
36 class TimeoutThread : public Thread 36 class TimeoutThread : public Thread
37 { 37 {
38 public: 38 public:
39 TimeoutThread(const JsEngine::TimerTask& timerTask) 39 TimeoutThread(const JsEngine::TimerTask& timerTask)
40 : Thread(true) 40 : Thread(true), timerTask(timerTask)
41 , timerTask(timerTask)
Oleksandr 2017/03/24 12:15:25 Nit: I think our coding style would put a comma on
sergei 2017/03/24 12:34:39 Done.
42 { 41 {
43 } 42 }
44 43
45 void Run() 44 void Run()
46 { 45 {
47 Sleep(timerTask.ii_taskInfo->delay); 46 Sleep(timerTask.taskInfoIterator->delay);
48 if (auto jsEngine = timerTask.weakJsEngine.lock()) 47 if (auto jsEngine = timerTask.weakJsEngine.lock())
49 jsEngine->CallTimerTask(timerTask.ii_taskInfo); 48 jsEngine->CallTimerTask(timerTask.taskInfoIterator);
50 } 49 }
51 50
52 private: 51 private:
53 JsEngine::TimerTask timerTask; 52 JsEngine::TimerTask timerTask;
54 }; 53 };
55 54
56 v8::Handle<v8::Value> SetTimeoutCallback(const v8::Arguments& arguments) 55 v8::Handle<v8::Value> SetTimeoutCallback(const v8::Arguments& arguments)
57 { 56 {
58 TimeoutThread* timeoutThread; 57 TimeoutThread* timeoutThread;
59 try 58 try
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 obj->SetProperty("_fileSystem", 98 obj->SetProperty("_fileSystem",
100 FileSystemJsObject::Setup(jsEngine, jsEngine->NewObject())); 99 FileSystemJsObject::Setup(jsEngine, jsEngine->NewObject()));
101 obj->SetProperty("_webRequest", 100 obj->SetProperty("_webRequest",
102 WebRequestJsObject::Setup(jsEngine, jsEngine->NewObject())); 101 WebRequestJsObject::Setup(jsEngine, jsEngine->NewObject()));
103 obj->SetProperty("console", 102 obj->SetProperty("console",
104 ConsoleJsObject::Setup(jsEngine, jsEngine->NewObject())); 103 ConsoleJsObject::Setup(jsEngine, jsEngine->NewObject()));
105 obj->SetProperty("_appInfo", 104 obj->SetProperty("_appInfo",
106 AppInfoJsObject::Setup(jsEngine, appInfo, jsEngine->NewObject())); 105 AppInfoJsObject::Setup(jsEngine, appInfo, jsEngine->NewObject()));
107 return obj; 106 return obj;
108 } 107 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld