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: fix coding style Created Feb. 7, 2018, 2:54 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]
90 {
91 std::chrono::seconds timeout(60 * 10);
92 std::this_thread::sleep_for(timeout);
93 capturedIsolatePtr->Dispose();
94 }).detach();
89 isolate = nullptr; 95 isolate = nullptr;
90 } 96 }
91 97
92 JsEngine::JsWeakValuesList::~JsWeakValuesList() 98 JsEngine::JsWeakValuesList::~JsWeakValuesList()
93 { 99 {
94 for (auto& value : values) 100 for (auto& value : values)
95 value->Dispose(); 101 value->Dispose();
96 } 102 }
97 103
98 void JsEngine::NotifyLowMemory() 104 void JsEngine::NotifyLowMemory()
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 logSystem = val; 345 logSystem = val;
340 } 346 }
341 347
342 348
343 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, 349 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name,
344 const AdblockPlus::JsValue& value) 350 const AdblockPlus::JsValue& value)
345 { 351 {
346 auto global = GetGlobalObject(); 352 auto global = GetGlobalObject();
347 global.SetProperty(name, value); 353 global.SetProperty(name, value);
348 } 354 }
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