Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp

Issue 2618893002: Fix memory leak with ScriptedIdleTaskController (Closed)
Patch Set: Use WeakPersistent Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/idle-callback/untriggered-do-not-leak.html ('k') | 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/ScriptedIdleTaskController.h" 5 #include "core/dom/ScriptedIdleTaskController.h"
6 6
7 #include "core/dom/ExecutionContext.h" 7 #include "core/dom/ExecutionContext.h"
8 #include "core/dom/IdleRequestCallback.h" 8 #include "core/dom/IdleRequestCallback.h"
9 #include "core/dom/IdleRequestOptions.h" 9 #include "core/dom/IdleRequestOptions.h"
10 #include "core/frame/PerformanceMonitor.h" 10 #include "core/frame/PerformanceMonitor.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 ScriptedIdleTaskController::CallbackId id() const { return m_id; } 56 ScriptedIdleTaskController::CallbackId id() const { return m_id; }
57 ScriptedIdleTaskController* controller() const { return m_controller; } 57 ScriptedIdleTaskController* controller() const { return m_controller; }
58 58
59 private: 59 private:
60 IdleRequestCallbackWrapper(ScriptedIdleTaskController::CallbackId id, 60 IdleRequestCallbackWrapper(ScriptedIdleTaskController::CallbackId id,
61 ScriptedIdleTaskController* controller) 61 ScriptedIdleTaskController* controller)
62 : m_id(id), m_controller(controller) {} 62 : m_id(id), m_controller(controller) {}
63 63
64 ScriptedIdleTaskController::CallbackId m_id; 64 ScriptedIdleTaskController::CallbackId m_id;
65 Persistent<ScriptedIdleTaskController> m_controller; 65 WeakPersistent<ScriptedIdleTaskController> m_controller;
66 }; 66 };
67 67
68 } // namespace internal 68 } // namespace internal
69 69
70 ScriptedIdleTaskController::ScriptedIdleTaskController( 70 ScriptedIdleTaskController::ScriptedIdleTaskController(
71 ExecutionContext* context) 71 ExecutionContext* context)
72 : SuspendableObject(context), 72 : SuspendableObject(context),
73 m_scheduler(Platform::current()->currentThread()->scheduler()), 73 m_scheduler(Platform::current()->currentThread()->scheduler()),
74 m_nextCallbackId(0), 74 m_nextCallbackId(0),
75 m_suspended(false) { 75 m_suspended(false) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 RefPtr<internal::IdleRequestCallbackWrapper> callbackWrapper = 212 RefPtr<internal::IdleRequestCallbackWrapper> callbackWrapper =
213 internal::IdleRequestCallbackWrapper::create(callback.key, this); 213 internal::IdleRequestCallbackWrapper::create(callback.key, this);
214 m_scheduler->postIdleTask( 214 m_scheduler->postIdleTask(
215 BLINK_FROM_HERE, 215 BLINK_FROM_HERE,
216 WTF::bind(&internal::IdleRequestCallbackWrapper::idleTaskFired, 216 WTF::bind(&internal::IdleRequestCallbackWrapper::idleTaskFired,
217 callbackWrapper)); 217 callbackWrapper));
218 } 218 }
219 } 219 }
220 220
221 } // namespace blink 221 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/idle-callback/untriggered-do-not-leak.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698