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

Side by Side Diff: third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp

Issue 1391073002: [Oilpan] Fix wrong usage off heap collections in WebDevToolsAgentImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | third_party/WebKit/Source/web/WebFrameWidgetImpl.h » ('j') | 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) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2010-2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (m_running) 153 if (m_running)
154 return; 154 return;
155 m_running = true; 155 m_running = true;
156 156
157 // 0. Flush pending frontend messages. 157 // 0. Flush pending frontend messages.
158 WebLocalFrameImpl* frameImpl = WebLocalFrameImpl::fromFrame(frame); 158 WebLocalFrameImpl* frameImpl = WebLocalFrameImpl::fromFrame(frame);
159 WebDevToolsAgentImpl* agent = frameImpl->devToolsAgentImpl(); 159 WebDevToolsAgentImpl* agent = frameImpl->devToolsAgentImpl();
160 agent->flushPendingProtocolNotifications(); 160 agent->flushPendingProtocolNotifications();
161 161
162 Vector<WebViewImpl*> views; 162 Vector<WebViewImpl*> views;
163 Vector<WebFrameWidgetImpl*> widgets; 163 WillBeHeapVector<RawPtrWillBeMember<WebFrameWidgetImpl>> widgets;
164 164
165 // 1. Disable input events. 165 // 1. Disable input events.
166 const HashSet<WebViewImpl*>& viewImpls = WebViewImpl::allInstances(); 166 const HashSet<WebViewImpl*>& viewImpls = WebViewImpl::allInstances();
167 HashSet<WebViewImpl*>::const_iterator viewImplsEnd = viewImpls.end(); 167 HashSet<WebViewImpl*>::const_iterator viewImplsEnd = viewImpls.end();
168 for (HashSet<WebViewImpl*>::const_iterator it = viewImpls.begin(); it ! = viewImplsEnd; ++it) { 168 for (HashSet<WebViewImpl*>::const_iterator it = viewImpls.begin(); it ! = viewImplsEnd; ++it) {
169 WebViewImpl* view = *it; 169 WebViewImpl* view = *it;
170 m_frozenViews.add(view); 170 m_frozenViews.add(view);
171 views.append(view); 171 views.append(view);
172 view->setIgnoreInputEvents(true); 172 view->setIgnoreInputEvents(true);
173 } 173 }
174 174
175 const HashSet<WebFrameWidgetImpl*>& widgetImpls = WebFrameWidgetImpl::al lInstances(); 175 const WillBePersistentHeapHashSet<RawPtrWillBeWeakMember<WebFrameWidgetI mpl>>& widgetImpls = WebFrameWidgetImpl::allInstances();
176 HashSet<WebFrameWidgetImpl*>::const_iterator widgetImplsEnd = widgetImpl s.end(); 176 WillBePersistentHeapHashSet<RawPtrWillBeWeakMember<WebFrameWidgetImpl>>: :const_iterator widgetImplsEnd = widgetImpls.end();
177 for (HashSet<WebFrameWidgetImpl*>::const_iterator it = widgetImpls.begi n(); it != widgetImplsEnd; ++it) { 177 for (auto it = widgetImpls.begin(); it != widgetImplsEnd; ++it) {
178 WebFrameWidgetImpl* widget = *it; 178 WebFrameWidgetImpl* widget = *it;
179 m_frozenWidgets.add(widget); 179 m_frozenWidgets.add(widget);
180 widgets.append(widget); 180 widgets.append(widget);
181 widget->setIgnoreInputEvents(true); 181 widget->setIgnoreInputEvents(true);
182 } 182 }
183 183
184 // 2. Notify embedder about pausing. 184 // 2. Notify embedder about pausing.
185 agent->client()->willEnterDebugLoop(); 185 agent->client()->willEnterDebugLoop();
186 186
187 // 3. Disable active objects 187 // 3. Disable active objects
188 WebView::willEnterModalLoop(); 188 WebView::willEnterModalLoop();
189 189
190 // 4. Process messages until quitNow is called. 190 // 4. Process messages until quitNow is called.
191 m_messageLoop->run(); 191 m_messageLoop->run();
192 192
193 // 5. Resume active objects 193 // 5. Resume active objects
194 WebView::didExitModalLoop(); 194 WebView::didExitModalLoop();
195 195
196 // 6. Resume input events. 196 // 6. Resume input events.
197 for (Vector<WebViewImpl*>::iterator it = views.begin(); it != views.end( ); ++it) { 197 for (Vector<WebViewImpl*>::iterator it = views.begin(); it != views.end( ); ++it) {
198 if (m_frozenViews.contains(*it)) { 198 if (m_frozenViews.contains(*it)) {
199 // The view was not closed during the dispatch. 199 // The view was not closed during the dispatch.
200 (*it)->setIgnoreInputEvents(false); 200 (*it)->setIgnoreInputEvents(false);
201 } 201 }
202 } 202 }
203 for (Vector<WebFrameWidgetImpl*>::iterator it = widgets.begin(); it != w idgets.end(); ++it) { 203 for (WillBeHeapVector<RawPtrWillBeMember<WebFrameWidgetImpl>>::iterator it = widgets.begin(); it != widgets.end(); ++it) {
204 if (m_frozenWidgets.contains(*it)) { 204 if (m_frozenWidgets.contains(*it)) {
205 // The widget was not closed during the dispatch. 205 // The widget was not closed during the dispatch.
206 (*it)->setIgnoreInputEvents(false); 206 (*it)->setIgnoreInputEvents(false);
207 } 207 }
208 } 208 }
209 209
210 // 7. Notify embedder about resuming. 210 // 7. Notify embedder about resuming.
211 agent->client()->didExitDebugLoop(); 211 agent->client()->didExitDebugLoop();
212 212
213 // 8. All views have been resumed, clear the set. 213 // 8. All views have been resumed, clear the set.
214 m_frozenViews.clear(); 214 m_frozenViews.clear();
215 m_frozenWidgets.clear(); 215 m_frozenWidgets.clear();
216 216
217 m_running = false; 217 m_running = false;
218 } 218 }
219 219
220 void quitNow() override 220 void quitNow() override
221 { 221 {
222 m_messageLoop->quitNow(); 222 m_messageLoop->quitNow();
223 } 223 }
224 224
225 bool m_running; 225 bool m_running;
226 OwnPtr<WebDevToolsAgentClient::WebKitClientMessageLoop> m_messageLoop; 226 OwnPtr<WebDevToolsAgentClient::WebKitClientMessageLoop> m_messageLoop;
227 typedef HashSet<WebViewImpl*> FrozenViewsSet; 227 typedef HashSet<WebViewImpl*> FrozenViewsSet;
228 FrozenViewsSet m_frozenViews; 228 FrozenViewsSet m_frozenViews;
229 typedef HashSet<WebFrameWidgetImpl*> FrozenWidgetsSet; 229 typedef WillBePersistentHeapHashSet<RawPtrWillBeWeakMember<WebFrameWidgetImp l>> FrozenWidgetsSet;
haraken 2015/10/14 08:12:13 Can we move the typedef to the header file and use
peria 2015/10/15 02:26:06 Done.
230 FrozenWidgetsSet m_frozenWidgets; 230 FrozenWidgetsSet m_frozenWidgets;
231 static ClientMessageLoopAdapter* s_instance; 231 static ClientMessageLoopAdapter* s_instance;
232 }; 232 };
233 233
234 ClientMessageLoopAdapter* ClientMessageLoopAdapter::s_instance = nullptr; 234 ClientMessageLoopAdapter* ClientMessageLoopAdapter::s_instance = nullptr;
235 235
236 class PageInjectedScriptHostClient: public InjectedScriptHostClient { 236 class PageInjectedScriptHostClient: public InjectedScriptHostClient {
237 public: 237 public:
238 PageInjectedScriptHostClient() { } 238 PageInjectedScriptHostClient() { }
239 239
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 if (!InspectorBackendDispatcher::getCommandName(message, &commandName)) 718 if (!InspectorBackendDispatcher::getCommandName(message, &commandName))
719 return false; 719 return false;
720 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_pauseCmd) 720 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_pauseCmd)
721 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointCmd) 721 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointCmd)
722 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointByUrlCmd) 722 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointByUrlCmd)
723 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd) 723 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd)
724 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd); 724 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd);
725 } 725 }
726 726
727 } // namespace blink 727 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/WebFrameWidgetImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698