void FrameLoaderClientImpl::dispatchDidCommitLoad(HistoryItem* item, HistoryCommitType commitType) { m_webFrame->viewImpl()->didCommitLoad(commitType == StandardCommit, false); if (m_webFrame->client()) m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, WebHistoryItem(item), static_cast<WebHistoryCommitType>(commitType)); WebDevToolsAgentImpl* devToolsAgent = WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot())->devToolsAgentImpl(); if (devToolsAgent) devToolsAgent->didCommitLoadForLocalFrame(m_webFrame->frame()); }
virtual void run() { WebDevToolsAgent* webagent = m_descriptor->agent(); if (!webagent) return; WebDevToolsAgentImpl* agentImpl = static_cast<WebDevToolsAgentImpl*>(webagent); if (agentImpl->m_attached) agentImpl->dispatchMessageFromFrontend(m_descriptor->message()); }
virtual void run(Page* page) { if (m_running) return; m_running = true; // 0. Flush pending frontend messages. WebViewImpl* viewImpl = WebViewImpl::fromPage(page); WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(viewImpl->devToolsAgent()); agent->flushPendingFrontendMessages(); Vector<WebViewImpl*> views; // 1. Disable input events. const HashSet<Page*>& pages = Page::ordinaryPages(); HashSet<Page*>::const_iterator end = pages.end(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { WebViewImpl* view = WebViewImpl::fromPage(*it); if (!view) continue; m_frozenViews.add(view); views.append(view); view->setIgnoreInputEvents(true); } // Notify embedder about pausing. agent->client()->willEnterDebugLoop(); // 2. Disable active objects WebView::willEnterModalLoop(); // 3. Process messages until quitNow is called. m_messageLoop->run(); // 4. Resume active objects WebView::didExitModalLoop(); // 5. Resume input events. for (Vector<WebViewImpl*>::iterator it = views.begin(); it != views.end(); ++it) { if (m_frozenViews.contains(*it)) { // The view was not closed during the dispatch. (*it)->setIgnoreInputEvents(false); } } agent->client()->didExitDebugLoop(); // 6. All views have been resumed, clear the set. m_frozenViews.clear(); m_running = false; }
void FrameLoaderClientImpl::dispatchDidCommitLoad(HistoryItem* item, HistoryCommitType commitType) { m_webFrame->viewImpl()->didCommitLoad(commitType == StandardCommit, false); // Save some histogram data so we can compute the average memory used per // page load of the glyphs. // TODO(esprehn): Is this ancient uma actually useful? Platform::current()->histogramCustomCounts("Memory.GlyphPagesPerLoad", GlyphPageTreeNode::treeGlyphPageCount(), 1, 10000, 50); if (m_webFrame->client()) m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, WebHistoryItem(item), static_cast<WebHistoryCommitType>(commitType)); WebDevToolsAgentImpl* devToolsAgent = WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot())->devToolsAgentImpl(); if (devToolsAgent) devToolsAgent->didCommitLoadForLocalFrame(m_webFrame->frame()); }
// static PassOwnPtrWillBeRawPtr<WebDevToolsAgentImpl> WebDevToolsAgentImpl::create(WebLocalFrameImpl* frame, WebDevToolsAgentClient* client) { WebViewImpl* view = frame->viewImpl(); bool isMainFrame = view && view->mainFrameImpl() == frame; if (!isMainFrame) { WebDevToolsAgentImpl* agent = new WebDevToolsAgentImpl(frame, client, frame->inspectorOverlay()); if (frame->frameWidget()) agent->layerTreeViewChanged(frame->frameWidget()->layerTreeView()); return adoptPtrWillBeNoop(agent); } WebDevToolsAgentImpl* agent = new WebDevToolsAgentImpl(frame, client, view->inspectorOverlay()); agent->registerAgent(InspectorRenderingAgent::create(view)); agent->registerAgent(InspectorEmulationAgent::create(view)); // TODO(dgozman): migrate each of the following agents to frame once module is ready. agent->registerAgent(InspectorDatabaseAgent::create(view->page())); agent->registerAgent(DeviceOrientationInspectorAgent::create(view->page())); agent->registerAgent(InspectorFileSystemAgent::create(view->page())); agent->registerAgent(InspectorIndexedDBAgent::create(view->page())); agent->registerAgent(InspectorAccessibilityAgent::create(view->page())); agent->registerAgent(InspectorDOMStorageAgent::create(view->page())); agent->registerAgent(InspectorCacheStorageAgent::create()); agent->layerTreeViewChanged(view->layerTreeView()); return adoptPtrWillBeNoop(agent); }
void run(LocalFrame* frame) override { if (m_running) return; m_running = true; // 0. Flush pending frontend messages. WebLocalFrameImpl* frameImpl = WebLocalFrameImpl::fromFrame(frame); WebDevToolsAgentImpl* agent = frameImpl->devToolsAgentImpl(); agent->flushPendingProtocolNotifications(); Vector<WebViewImpl*> views; Vector<WebFrameWidgetImpl*> widgets; // 1. Disable input events. const HashSet<WebViewImpl*>& viewImpls = WebViewImpl::allInstances(); HashSet<WebViewImpl*>::const_iterator viewImplsEnd = viewImpls.end(); for (HashSet<WebViewImpl*>::const_iterator it = viewImpls.begin(); it != viewImplsEnd; ++it) { WebViewImpl* view = *it; m_frozenViews.add(view); views.append(view); view->setIgnoreInputEvents(true); } const HashSet<WebFrameWidgetImpl*>& widgetImpls = WebFrameWidgetImpl::allInstances(); HashSet<WebFrameWidgetImpl*>::const_iterator widgetImplsEnd = widgetImpls.end(); for (HashSet<WebFrameWidgetImpl*>::const_iterator it = widgetImpls.begin(); it != widgetImplsEnd; ++it) { WebFrameWidgetImpl* widget = *it; m_frozenWidgets.add(widget); widgets.append(widget); widget->setIgnoreInputEvents(true); } // 2. Notify embedder about pausing. agent->client()->willEnterDebugLoop(); // 3. Disable active objects WebView::willEnterModalLoop(); // 4. Process messages until quitNow is called. m_messageLoop->run(); // 5. Resume active objects WebView::didExitModalLoop(); // 6. Resume input events. for (Vector<WebViewImpl*>::iterator it = views.begin(); it != views.end(); ++it) { if (m_frozenViews.contains(*it)) { // The view was not closed during the dispatch. (*it)->setIgnoreInputEvents(false); } } for (Vector<WebFrameWidgetImpl*>::iterator it = widgets.begin(); it != widgets.end(); ++it) { if (m_frozenWidgets.contains(*it)) { // The widget was not closed during the dispatch. (*it)->setIgnoreInputEvents(false); } } // 7. Notify embedder about resuming. agent->client()->didExitDebugLoop(); // 8. All views have been resumed, clear the set. m_frozenViews.clear(); m_frozenWidgets.clear(); m_running = false; }
// static PassOwnPtrWillBeRawPtr<WebDevToolsAgentImpl> WebDevToolsAgentImpl::create(WebLocalFrameImpl* frame, WebDevToolsAgentClient* client) { WebViewImpl* view = frame->viewImpl(); // TODO(dgozman): sometimes view->mainFrameImpl() does return null, even though |frame| is meant to be main frame. // See http://crbug.com/526162. bool isMainFrame = view && !frame->parent(); if (!isMainFrame) { WebDevToolsAgentImpl* agent = new WebDevToolsAgentImpl(frame, client, nullptr); if (frame->frameWidget()) agent->layerTreeViewChanged(toWebFrameWidgetImpl(frame->frameWidget())->layerTreeView()); return adoptPtrWillBeNoop(agent); } WebDevToolsAgentImpl* agent = new WebDevToolsAgentImpl(frame, client, InspectorOverlay::create(view)); // TODO(dgozman): we should actually pass the view instead of frame, but during // remote->local transition we cannot access mainFrameImpl() yet, so we have to store the // frame which will become the main frame later. agent->registerAgent(InspectorRenderingAgent::create(frame)); agent->registerAgent(InspectorEmulationAgent::create(frame, agent)); // TODO(dgozman): migrate each of the following agents to frame once module is ready. agent->registerAgent(InspectorDatabaseAgent::create(view->page())); agent->registerAgent(DeviceOrientationInspectorAgent::create(view->page())); agent->registerAgent(InspectorAccessibilityAgent::create(view->page())); agent->registerAgent(InspectorDOMStorageAgent::create(view->page())); agent->registerAgent(InspectorCacheStorageAgent::create()); agent->layerTreeViewChanged(view->layerTreeView()); return adoptPtrWillBeNoop(agent); }