| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 : m_running(false) | 110 : m_running(false) |
| 111 , m_messageLoop(messageLoop) { } | 111 , m_messageLoop(messageLoop) { } |
| 112 | 112 |
| 113 | 113 |
| 114 virtual void run(Page* page) | 114 virtual void run(Page* page) |
| 115 { | 115 { |
| 116 if (m_running) | 116 if (m_running) |
| 117 return; | 117 return; |
| 118 m_running = true; | 118 m_running = true; |
| 119 | 119 |
| 120 // 0. Flush pending frontend messages. | |
| 121 WebViewImpl* viewImpl = WebViewImpl::fromPage(page); | |
| 122 WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(viewImp
l->devToolsAgent()); | |
| 123 agent->flushPendingFrontendMessages(); | |
| 124 | |
| 125 Vector<WebViewImpl*> views; | 120 Vector<WebViewImpl*> views; |
| 126 | 121 |
| 127 // 1. Disable input events. | 122 // 1. Disable input events. |
| 128 const HashSet<Page*>& pages = Page::ordinaryPages(); | 123 const HashSet<Page*>& pages = Page::ordinaryPages(); |
| 129 HashSet<Page*>::const_iterator end = pages.end(); | 124 HashSet<Page*>::const_iterator end = pages.end(); |
| 130 for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it
) { | 125 for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it
) { |
| 131 WebViewImpl* view = WebViewImpl::fromPage(*it); | 126 WebViewImpl* view = WebViewImpl::fromPage(*it); |
| 132 if (!view) | 127 if (!view) |
| 133 continue; | 128 continue; |
| 134 m_frozenViews.add(view); | 129 m_frozenViews.add(view); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 m_webViewImpl->removePageOverlay(this); | 560 m_webViewImpl->removePageOverlay(this); |
| 566 } | 561 } |
| 567 | 562 |
| 568 void WebDevToolsAgentImpl::sendMessageToFrontend(PassRefPtr<WebCore::JSONObject>
message) | 563 void WebDevToolsAgentImpl::sendMessageToFrontend(PassRefPtr<WebCore::JSONObject>
message) |
| 569 { | 564 { |
| 570 m_frontendMessageQueue.append(message); | 565 m_frontendMessageQueue.append(message); |
| 571 } | 566 } |
| 572 | 567 |
| 573 void WebDevToolsAgentImpl::flush() | 568 void WebDevToolsAgentImpl::flush() |
| 574 { | 569 { |
| 575 flushPendingFrontendMessages(); | 570 for (size_t i = 0; i < m_frontendMessageQueue.size(); ++i) |
| 571 m_client->sendMessageToInspectorFrontend(m_frontendMessageQueue[i]->toJS
ONString()); |
| 572 m_frontendMessageQueue.clear(); |
| 576 } | 573 } |
| 577 | 574 |
| 578 void WebDevToolsAgentImpl::updateInspectorStateCookie(const String& state) | 575 void WebDevToolsAgentImpl::updateInspectorStateCookie(const String& state) |
| 579 { | 576 { |
| 580 m_client->saveAgentRuntimeState(state); | 577 m_client->saveAgentRuntimeState(state); |
| 581 } | 578 } |
| 582 | 579 |
| 583 void WebDevToolsAgentImpl::clearBrowserCache() | 580 void WebDevToolsAgentImpl::clearBrowserCache() |
| 584 { | 581 { |
| 585 m_client->clearBrowserCache(); | 582 m_client->clearBrowserCache(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 599 { | 596 { |
| 600 inspectorController()->setLayerTreeId(layerTreeId); | 597 inspectorController()->setLayerTreeId(layerTreeId); |
| 601 } | 598 } |
| 602 | 599 |
| 603 void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString&
script) | 600 void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString&
script) |
| 604 { | 601 { |
| 605 InspectorController* ic = inspectorController(); | 602 InspectorController* ic = inspectorController(); |
| 606 ic->evaluateForTestInFrontend(callId, script); | 603 ic->evaluateForTestInFrontend(callId, script); |
| 607 } | 604 } |
| 608 | 605 |
| 609 void WebDevToolsAgentImpl::flushPendingFrontendMessages() | |
| 610 { | |
| 611 InspectorController* ic = inspectorController(); | |
| 612 ic->flushPendingFrontendMessages(); | |
| 613 | |
| 614 for (size_t i = 0; i < m_frontendMessageQueue.size(); ++i) | |
| 615 m_client->sendMessageToInspectorFrontend(m_frontendMessageQueue[i]->toJS
ONString()); | |
| 616 m_frontendMessageQueue.clear(); | |
| 617 } | |
| 618 | |
| 619 void WebDevToolsAgentImpl::willProcessTask() | 606 void WebDevToolsAgentImpl::willProcessTask() |
| 620 { | 607 { |
| 621 if (!m_attached) | |
| 622 return; | |
| 623 if (InspectorController* ic = inspectorController()) | 608 if (InspectorController* ic = inspectorController()) |
| 624 ic->willProcessTask(); | 609 ic->willProcessTask(); |
| 625 } | 610 } |
| 626 | 611 |
| 627 void WebDevToolsAgentImpl::didProcessTask() | 612 void WebDevToolsAgentImpl::didProcessTask() |
| 628 { | 613 { |
| 629 if (!m_attached) | |
| 630 return; | |
| 631 if (InspectorController* ic = inspectorController()) | 614 if (InspectorController* ic = inspectorController()) |
| 632 ic->didProcessTask(); | 615 ic->didProcessTask(); |
| 633 flushPendingFrontendMessages(); | 616 if (m_attached) |
| 617 flush(); |
| 634 } | 618 } |
| 635 | 619 |
| 636 WebString WebDevToolsAgent::inspectorProtocolVersion() | 620 WebString WebDevToolsAgent::inspectorProtocolVersion() |
| 637 { | 621 { |
| 638 return WebCore::inspectorProtocolVersion(); | 622 return WebCore::inspectorProtocolVersion(); |
| 639 } | 623 } |
| 640 | 624 |
| 641 bool WebDevToolsAgent::supportsInspectorProtocolVersion(const WebString& version
) | 625 bool WebDevToolsAgent::supportsInspectorProtocolVersion(const WebString& version
) |
| 642 { | 626 { |
| 643 return WebCore::supportsInspectorProtocolVersion(version); | 627 return WebCore::supportsInspectorProtocolVersion(version); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 664 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kProfiler_startCmd) | 648 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kProfiler_startCmd) |
| 665 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kProfiler_stopCmd); | 649 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kProfiler_stopCmd); |
| 666 } | 650 } |
| 667 | 651 |
| 668 void WebDevToolsAgent::processPendingMessages() | 652 void WebDevToolsAgent::processPendingMessages() |
| 669 { | 653 { |
| 670 PageScriptDebugServer::shared().runPendingTasks(); | 654 PageScriptDebugServer::shared().runPendingTasks(); |
| 671 } | 655 } |
| 672 | 656 |
| 673 } // namespace blink | 657 } // namespace blink |
| OLD | NEW |