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

Side by Side Diff: src/JsEngine.cpp

Issue 29691607: Issue 6365 - dispose v8::Isolate with a long enough delay (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created Feb. 7, 2018, 2:26 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 AdblockPlus::ScopedV8Isolate::ScopedV8Isolate() 80 AdblockPlus::ScopedV8Isolate::ScopedV8Isolate()
81 { 81 {
82 V8Initializer::Init(); 82 V8Initializer::Init();
83 isolate = v8::Isolate::New(); 83 isolate = v8::Isolate::New();
84 } 84 }
85 85
86 AdblockPlus::ScopedV8Isolate::~ScopedV8Isolate() 86 AdblockPlus::ScopedV8Isolate::~ScopedV8Isolate()
87 { 87 {
88 isolate->Dispose(); 88 auto capturedIsolatePtr = isolate;
89 std::thread([capturedIsolatePtr]{
anton 2018/02/07 14:43:12 shouldn't `{`it be on the next line?
sergei 2018/02/07 14:54:20 Done.
90 std::chrono::seconds timeout(60 * 10);
91 std::this_thread::sleep_for(timeout);
92 capturedIsolatePtr->Dispose();
93 }).detach();
89 isolate = nullptr; 94 isolate = nullptr;
90 } 95 }
91 96
92 JsEngine::JsWeakValuesList::~JsWeakValuesList() 97 JsEngine::JsWeakValuesList::~JsWeakValuesList()
93 { 98 {
94 for (auto& value : values) 99 for (auto& value : values)
95 value->Dispose(); 100 value->Dispose();
96 } 101 }
97 102
98 void JsEngine::NotifyLowMemory() 103 void JsEngine::NotifyLowMemory()
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 logSystem = val; 344 logSystem = val;
340 } 345 }
341 346
342 347
343 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, 348 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name,
344 const AdblockPlus::JsValue& value) 349 const AdblockPlus::JsValue& value)
345 { 350 {
346 auto global = GetGlobalObject(); 351 auto global = GetGlobalObject();
347 global.SetProperty(name, value); 352 global.SetProperty(name, value);
348 } 353 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld