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

Side by Side Diff: src/GlobalJsObject.cpp

Issue 29361582: Issue 4613 - fix leak of Thread (Closed)
Patch Set: Created Nov. 3, 2016, 10:58 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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(JsValueList& arguments) 39 TimeoutThread(JsValueList& arguments)
40 : Thread(true)
40 { 41 {
41 if (arguments.size() < 2) 42 if (arguments.size() < 2)
42 throw std::runtime_error("setTimeout requires at least 2 parameters"); 43 throw std::runtime_error("setTimeout requires at least 2 parameters");
43 44
44 if (!arguments[0]->IsFunction()) 45 if (!arguments[0]->IsFunction())
45 throw std::runtime_error( 46 throw std::runtime_error(
46 "First argument to setTimeout must be a function"); 47 "First argument to setTimeout must be a function");
47 48
48 function = arguments[0]; 49 function = arguments[0];
49 delay = arguments[1]->AsInt(); 50 delay = arguments[1]->AsInt();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 obj->SetProperty("_fileSystem", 113 obj->SetProperty("_fileSystem",
113 FileSystemJsObject::Setup(jsEngine, jsEngine->NewObject())); 114 FileSystemJsObject::Setup(jsEngine, jsEngine->NewObject()));
114 obj->SetProperty("_webRequest", 115 obj->SetProperty("_webRequest",
115 WebRequestJsObject::Setup(jsEngine, jsEngine->NewObject())); 116 WebRequestJsObject::Setup(jsEngine, jsEngine->NewObject()));
116 obj->SetProperty("console", 117 obj->SetProperty("console",
117 ConsoleJsObject::Setup(jsEngine, jsEngine->NewObject())); 118 ConsoleJsObject::Setup(jsEngine, jsEngine->NewObject()));
118 obj->SetProperty("_appInfo", 119 obj->SetProperty("_appInfo",
119 AppInfoJsObject::Setup(jsEngine, appInfo, jsEngine->NewObject())); 120 AppInfoJsObject::Setup(jsEngine, appInfo, jsEngine->NewObject()));
120 return obj; 121 return obj;
121 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld