| OLD | NEW |
| 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 Loading... |
| 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 WebFrameWidgetsSet& widgetImpls = WebFrameWidgetImpl::allInstances
(); |
| 176 HashSet<WebFrameWidgetImpl*>::const_iterator widgetImplsEnd = widgetImpl
s.end(); | 176 WebFrameWidgetsSet::const_iterator widgetImplsEnd = widgetImpls.end(); |
| 177 for (HashSet<WebFrameWidgetImpl*>::const_iterator it = widgetImpls.begi
n(); it != widgetImplsEnd; ++it) { | 177 for (WebFrameWidgetsSet::const_iterator 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 WebFrameWidgetsSet m_frozenWidgets; |
| 230 FrozenWidgetsSet m_frozenWidgets; | |
| 231 static ClientMessageLoopAdapter* s_instance; | 230 static ClientMessageLoopAdapter* s_instance; |
| 232 }; | 231 }; |
| 233 | 232 |
| 234 ClientMessageLoopAdapter* ClientMessageLoopAdapter::s_instance = nullptr; | 233 ClientMessageLoopAdapter* ClientMessageLoopAdapter::s_instance = nullptr; |
| 235 | 234 |
| 236 class PageInjectedScriptHostClient: public InjectedScriptHostClient { | 235 class PageInjectedScriptHostClient: public InjectedScriptHostClient { |
| 237 public: | 236 public: |
| 238 PageInjectedScriptHostClient() { } | 237 PageInjectedScriptHostClient() { } |
| 239 | 238 |
| 240 ~PageInjectedScriptHostClient() override { } | 239 ~PageInjectedScriptHostClient() override { } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 if (!InspectorBackendDispatcher::getCommandName(message, &commandName)) | 717 if (!InspectorBackendDispatcher::getCommandName(message, &commandName)) |
| 719 return false; | 718 return false; |
| 720 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_pauseCmd) | 719 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_pauseCmd) |
| 721 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointCmd) | 720 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointCmd) |
| 722 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointByUrlCmd) | 721 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointByUrlCmd) |
| 723 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_removeBreakpointCmd) | 722 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_removeBreakpointCmd) |
| 724 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointsActiveCmd); | 723 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointsActiveCmd); |
| 725 } | 724 } |
| 726 | 725 |
| 727 } // namespace blink | 726 } // namespace blink |
| OLD | NEW |