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

Side by Side Diff: Source/core/inspector/InjectedScriptManager.cpp

Issue 1040703002: Oilpan: avoid InjectedScriptManager::CallbackData-induced leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add explicit dispose() Created 5 years, 9 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 | « Source/core/inspector/InjectedScriptManager.h ('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 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2012 Google Inc. All rights reserved. 4 * Copyright (C) 2012 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 { 61 {
62 } 62 }
63 63
64 InjectedScriptManager::~InjectedScriptManager() 64 InjectedScriptManager::~InjectedScriptManager()
65 { 65 {
66 } 66 }
67 67
68 DEFINE_TRACE(InjectedScriptManager) 68 DEFINE_TRACE(InjectedScriptManager)
69 { 69 {
70 visitor->trace(m_injectedScriptHost); 70 visitor->trace(m_injectedScriptHost);
71 #if ENABLE(OILPAN)
72 visitor->trace(m_callbackDataSet);
73 #endif
71 } 74 }
72 75
73 void InjectedScriptManager::disconnect() 76 void InjectedScriptManager::disconnect()
74 { 77 {
75 m_injectedScriptHost->disconnect(); 78 m_injectedScriptHost->disconnect();
76 m_injectedScriptHost.clear(); 79 m_injectedScriptHost.clear();
77 } 80 }
78 81
79 InjectedScriptHost* InjectedScriptManager::injectedScriptHost() 82 InjectedScriptHost* InjectedScriptManager::injectedScriptHost()
80 { 83 {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 int id = injectedScriptIdFor(inspectedScriptState); 181 int id = injectedScriptIdFor(inspectedScriptState);
179 RefPtr<InjectedScriptNative> injectedScriptNative = adoptRef(new InjectedScr iptNative(inspectedScriptState->isolate())); 182 RefPtr<InjectedScriptNative> injectedScriptNative = adoptRef(new InjectedScr iptNative(inspectedScriptState->isolate()));
180 ScriptValue injectedScriptValue = createInjectedScript(injectedScriptSource( ), inspectedScriptState, id, injectedScriptNative.get()); 183 ScriptValue injectedScriptValue = createInjectedScript(injectedScriptSource( ), inspectedScriptState, id, injectedScriptNative.get());
181 InjectedScript result(injectedScriptValue, m_inspectedStateAccessCheck, inje ctedScriptNative.release()); 184 InjectedScript result(injectedScriptValue, m_inspectedStateAccessCheck, inje ctedScriptNative.release());
182 if (m_customObjectFormatterEnabled) 185 if (m_customObjectFormatterEnabled)
183 result.setCustomObjectFormatterEnabled(m_customObjectFormatterEnabled); 186 result.setCustomObjectFormatterEnabled(m_customObjectFormatterEnabled);
184 m_idToInjectedScript.set(id, result); 187 m_idToInjectedScript.set(id, result);
185 return result; 188 return result;
186 } 189 }
187 190
191 PassOwnPtrWillBeRawPtr<InjectedScriptManager::CallbackData> InjectedScriptManage r::CallbackData::create(InjectedScriptManager* manager)
192 {
193 return adoptPtrWillBeNoop(new CallbackData(manager));
194 }
195
196 InjectedScriptManager::CallbackData::CallbackData(InjectedScriptManager* manager )
197 : injectedScriptManager(manager)
198 {
199 }
200
201 void InjectedScriptManager::CallbackData::dispose()
202 {
203 // Promptly release the ScopedPersistent<>.
204 handle.clear();
205 }
206
207 DEFINE_TRACE(InjectedScriptManager::CallbackData)
208 {
209 visitor->trace(host);
210 visitor->trace(injectedScriptManager);
211 }
212
188 } // namespace blink 213 } // namespace blink
189
OLDNEW
« no previous file with comments | « Source/core/inspector/InjectedScriptManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698