| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 6 | 6 |
| 7 #include <tuple> | 7 #include <tuple> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 RenderFrameHost* current) { | 323 RenderFrameHost* current) { |
| 324 if (IsBrowserSideNavigationEnabled()) | 324 if (IsBrowserSideNavigationEnabled()) |
| 325 return; | 325 return; |
| 326 | 326 |
| 327 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(pending); | 327 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(pending); |
| 328 if (!agent_host) | 328 if (!agent_host) |
| 329 return; | 329 return; |
| 330 if (agent_host->pending_ && agent_host->pending_->host() == pending) { | 330 if (agent_host->pending_ && agent_host->pending_->host() == pending) { |
| 331 DCHECK(agent_host->current_ && agent_host->current_->host() == current); | 331 DCHECK(agent_host->current_ && agent_host->current_->host() == current); |
| 332 agent_host->DiscardPending(); | 332 agent_host->DiscardPending(); |
| 333 DCHECK(agent_host->CheckConsistency()); |
| 333 } | 334 } |
| 334 } | 335 } |
| 335 | 336 |
| 336 // static | 337 // static |
| 337 void RenderFrameDevToolsAgentHost::OnBeforeNavigation( | 338 void RenderFrameDevToolsAgentHost::OnBeforeNavigation( |
| 338 RenderFrameHost* current, RenderFrameHost* pending) { | 339 RenderFrameHost* current, RenderFrameHost* pending) { |
| 339 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(current); | 340 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(current); |
| 340 if (agent_host) | 341 if (agent_host) |
| 341 agent_host->AboutToNavigateRenderFrame(current, pending); | 342 agent_host->AboutToNavigateRenderFrame(current, pending); |
| 342 } | 343 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 new devtools::service_worker::ServiceWorkerHandler()), | 388 new devtools::service_worker::ServiceWorkerHandler()), |
| 388 storage_handler_(new devtools::storage::StorageHandler()), | 389 storage_handler_(new devtools::storage::StorageHandler()), |
| 389 target_handler_(new devtools::target::TargetHandler()), | 390 target_handler_(new devtools::target::TargetHandler()), |
| 390 tracing_handler_(new devtools::tracing::TracingHandler( | 391 tracing_handler_(new devtools::tracing::TracingHandler( |
| 391 devtools::tracing::TracingHandler::Renderer, | 392 devtools::tracing::TracingHandler::Renderer, |
| 392 host->GetFrameTreeNodeId(), | 393 host->GetFrameTreeNodeId(), |
| 393 GetIOContext())), | 394 GetIOContext())), |
| 394 emulation_handler_(nullptr), | 395 emulation_handler_(nullptr), |
| 395 frame_trace_recorder_(nullptr), | 396 frame_trace_recorder_(nullptr), |
| 396 protocol_handler_(new DevToolsProtocolHandler(this)), | 397 protocol_handler_(new DevToolsProtocolHandler(this)), |
| 398 handlers_frame_host_(nullptr), |
| 397 current_frame_crashed_(false), | 399 current_frame_crashed_(false), |
| 398 pending_handle_(nullptr), | 400 pending_handle_(nullptr), |
| 399 frame_tree_node_(host->frame_tree_node()) { | 401 frame_tree_node_(host->frame_tree_node()) { |
| 400 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); | 402 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); |
| 401 dispatcher->SetBrowserHandler(browser_handler_.get()); | 403 dispatcher->SetBrowserHandler(browser_handler_.get()); |
| 402 dispatcher->SetDOMHandler(dom_handler_.get()); | 404 dispatcher->SetDOMHandler(dom_handler_.get()); |
| 403 dispatcher->SetInputHandler(input_handler_.get()); | 405 dispatcher->SetInputHandler(input_handler_.get()); |
| 404 dispatcher->SetInspectorHandler(inspector_handler_.get()); | 406 dispatcher->SetInspectorHandler(inspector_handler_.get()); |
| 405 dispatcher->SetIOHandler(io_handler_.get()); | 407 dispatcher->SetIOHandler(io_handler_.get()); |
| 406 dispatcher->SetNetworkHandler(network_handler_.get()); | 408 dispatcher->SetNetworkHandler(network_handler_.get()); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 // If the navigation is not tracked, return; | 578 // If the navigation is not tracked, return; |
| 577 if (navigating_handles_.count(navigation_handle) == 0) | 579 if (navigating_handles_.count(navigation_handle) == 0) |
| 578 return; | 580 return; |
| 579 | 581 |
| 580 RenderFrameHostImpl* render_frame_host_impl = | 582 RenderFrameHostImpl* render_frame_host_impl = |
| 581 static_cast<RenderFrameHostImpl*>( | 583 static_cast<RenderFrameHostImpl*>( |
| 582 navigation_handle->GetRenderFrameHost()); | 584 navigation_handle->GetRenderFrameHost()); |
| 583 if (current_->host() != render_frame_host_impl || current_frame_crashed_) { | 585 if (current_->host() != render_frame_host_impl || current_frame_crashed_) { |
| 584 SetPending(render_frame_host_impl); | 586 SetPending(render_frame_host_impl); |
| 585 pending_handle_ = navigation_handle; | 587 pending_handle_ = navigation_handle; |
| 588 // Commit when navigating the same frame after crash, avoiding the same |
| 589 // host in current_ and pending_. |
| 590 if (current_->host() == render_frame_host_impl) { |
| 591 pending_handle_ = nullptr; |
| 592 CommitPending(); |
| 593 } |
| 586 } | 594 } |
| 595 DCHECK(CheckConsistency()); |
| 587 } | 596 } |
| 588 | 597 |
| 589 void RenderFrameDevToolsAgentHost::DidFinishNavigation( | 598 void RenderFrameDevToolsAgentHost::DidFinishNavigation( |
| 590 NavigationHandle* navigation_handle) { | 599 NavigationHandle* navigation_handle) { |
| 591 if (!IsBrowserSideNavigationEnabled()) | 600 if (!IsBrowserSideNavigationEnabled()) |
| 592 return; | 601 return; |
| 593 | 602 |
| 594 // If the navigation is not tracked, return; | 603 // If the navigation is not tracked, return; |
| 595 if (navigating_handles_.count(navigation_handle) == 0) | 604 if (navigating_handles_.count(navigation_handle) == 0) |
| 596 return; | 605 return; |
| 597 | 606 |
| 598 // Now that the navigation is finished, remove the handle from the list of | 607 // Now that the navigation is finished, remove the handle from the list of |
| 599 // navigating handles. | 608 // navigating handles. |
| 600 navigating_handles_.erase(navigation_handle); | 609 navigating_handles_.erase(navigation_handle); |
| 601 | 610 |
| 602 if (pending_handle_ == navigation_handle) { | 611 if (pending_handle_ == navigation_handle) { |
| 603 // This navigation handle did set the pending FrameHostHolder. | 612 // This navigation handle did set the pending FrameHostHolder. |
| 604 DCHECK(pending_); | 613 DCHECK(pending_); |
| 605 if (navigation_handle->HasCommitted()) { | 614 if (navigation_handle->HasCommitted()) { |
| 606 DCHECK(pending_->host() == navigation_handle->GetRenderFrameHost()); | 615 DCHECK(pending_->host() == navigation_handle->GetRenderFrameHost()); |
| 607 CommitPending(); | 616 CommitPending(); |
| 608 } else { | 617 } else { |
| 609 DiscardPending(); | 618 DiscardPending(); |
| 610 } | 619 } |
| 611 pending_handle_ = nullptr; | 620 pending_handle_ = nullptr; |
| 612 } | 621 } |
| 613 DispatchBufferedProtocolMessagesIfNecessary(); | 622 DispatchBufferedProtocolMessagesIfNecessary(); |
| 614 | 623 |
| 624 DCHECK(CheckConsistency()); |
| 615 if (navigation_handle->HasCommitted()) | 625 if (navigation_handle->HasCommitted()) |
| 616 target_handler_->UpdateServiceWorkers(); | 626 target_handler_->UpdateServiceWorkers(); |
| 617 } | 627 } |
| 618 | 628 |
| 619 void RenderFrameDevToolsAgentHost::AboutToNavigateRenderFrame( | 629 void RenderFrameDevToolsAgentHost::AboutToNavigateRenderFrame( |
| 620 RenderFrameHost* old_host, | 630 RenderFrameHost* old_host, |
| 621 RenderFrameHost* new_host) { | 631 RenderFrameHost* new_host) { |
| 622 if (IsBrowserSideNavigationEnabled()) | 632 if (IsBrowserSideNavigationEnabled()) |
| 623 return; | 633 return; |
| 624 | 634 |
| 625 DCHECK(!pending_ || pending_->host() != old_host); | 635 DCHECK(!pending_ || pending_->host() != old_host); |
| 626 if (!current_ || current_->host() != old_host) | 636 if (!current_ || current_->host() != old_host) { |
| 637 DCHECK(CheckConsistency()); |
| 627 return; | 638 return; |
| 628 if (old_host == new_host && !current_frame_crashed_) | 639 } |
| 640 if (old_host == new_host && !current_frame_crashed_) { |
| 641 DCHECK(CheckConsistency()); |
| 629 return; | 642 return; |
| 643 } |
| 630 DCHECK(!pending_); | 644 DCHECK(!pending_); |
| 631 SetPending(static_cast<RenderFrameHostImpl*>(new_host)); | 645 SetPending(static_cast<RenderFrameHostImpl*>(new_host)); |
| 646 // Commit when navigating the same frame after crash, avoiding the same |
| 647 // host in current_ and pending_. |
| 648 if (old_host == new_host) |
| 649 CommitPending(); |
| 650 DCHECK(CheckConsistency()); |
| 632 } | 651 } |
| 633 | 652 |
| 634 void RenderFrameDevToolsAgentHost::AboutToNavigate( | 653 void RenderFrameDevToolsAgentHost::AboutToNavigate( |
| 635 NavigationHandle* navigation_handle) { | 654 NavigationHandle* navigation_handle) { |
| 636 if (!IsBrowserSideNavigationEnabled()) | 655 if (!IsBrowserSideNavigationEnabled()) |
| 637 return; | 656 return; |
| 638 DCHECK(current_); | 657 DCHECK(current_); |
| 639 navigating_handles_.insert(navigation_handle); | 658 navigating_handles_.insert(navigation_handle); |
| 659 DCHECK(CheckConsistency()); |
| 640 } | 660 } |
| 641 | 661 |
| 642 void RenderFrameDevToolsAgentHost::RenderFrameHostChanged( | 662 void RenderFrameDevToolsAgentHost::RenderFrameHostChanged( |
| 643 RenderFrameHost* old_host, | 663 RenderFrameHost* old_host, |
| 644 RenderFrameHost* new_host) { | 664 RenderFrameHost* new_host) { |
| 645 if (IsBrowserSideNavigationEnabled()) | 665 if (IsBrowserSideNavigationEnabled()) |
| 646 return; | 666 return; |
| 647 | 667 |
| 648 DCHECK(!pending_ || pending_->host() != old_host); | 668 DCHECK(!pending_ || pending_->host() != old_host); |
| 649 if (!current_ || current_->host() != old_host) | 669 if (!current_ || current_->host() != old_host) { |
| 670 DCHECK(CheckConsistency()); |
| 650 return; | 671 return; |
| 672 } |
| 651 | 673 |
| 652 // AboutToNavigateRenderFrame was not called for renderer-initiated | 674 // AboutToNavigateRenderFrame was not called for renderer-initiated |
| 653 // navigation. | 675 // navigation. |
| 654 if (!pending_) | 676 if (!pending_) |
| 655 SetPending(static_cast<RenderFrameHostImpl*>(new_host)); | 677 SetPending(static_cast<RenderFrameHostImpl*>(new_host)); |
| 656 | |
| 657 CommitPending(); | 678 CommitPending(); |
| 679 DCHECK(CheckConsistency()); |
| 658 } | 680 } |
| 659 | 681 |
| 660 void RenderFrameDevToolsAgentHost::FrameDeleted(RenderFrameHost* rfh) { | 682 void RenderFrameDevToolsAgentHost::FrameDeleted(RenderFrameHost* rfh) { |
| 661 if (pending_ && pending_->host() == rfh) { | 683 if (pending_ && pending_->host() == rfh) { |
| 662 if (!IsBrowserSideNavigationEnabled()) | 684 if (!IsBrowserSideNavigationEnabled()) |
| 663 DiscardPending(); | 685 DiscardPending(); |
| 686 DCHECK(CheckConsistency()); |
| 664 return; | 687 return; |
| 665 } | 688 } |
| 666 | 689 |
| 667 if (current_ && current_->host() == rfh) | 690 if (current_ && current_->host() == rfh) |
| 668 DestroyOnRenderFrameGone(); // |this| may be deleted at this point. | 691 DestroyOnRenderFrameGone(); // |this| may be deleted at this point. |
| 669 } | 692 } |
| 670 | 693 |
| 671 void RenderFrameDevToolsAgentHost::RenderFrameDeleted(RenderFrameHost* rfh) { | 694 void RenderFrameDevToolsAgentHost::RenderFrameDeleted(RenderFrameHost* rfh) { |
| 672 if (!current_frame_crashed_) | 695 if (!current_frame_crashed_) |
| 673 FrameDeleted(rfh); | 696 FrameDeleted(rfh); |
| 697 else |
| 698 DCHECK(CheckConsistency()); |
| 674 } | 699 } |
| 675 | 700 |
| 676 void RenderFrameDevToolsAgentHost::DestroyOnRenderFrameGone() { | 701 void RenderFrameDevToolsAgentHost::DestroyOnRenderFrameGone() { |
| 677 DCHECK(current_); | 702 DCHECK(current_); |
| 678 scoped_refptr<RenderFrameDevToolsAgentHost> protect(this); | 703 scoped_refptr<RenderFrameDevToolsAgentHost> protect(this); |
| 679 UpdateProtocolHandlers(nullptr); | 704 UpdateProtocolHandlers(nullptr); |
| 680 if (IsAttached()) | 705 if (IsAttached()) |
| 681 OnClientDetached(); | 706 OnClientDetached(); |
| 682 HostClosed(); | 707 HostClosed(); |
| 683 pending_.reset(); | 708 pending_.reset(); |
| 684 current_.reset(); | 709 current_.reset(); |
| 685 frame_tree_node_ = nullptr; | 710 frame_tree_node_ = nullptr; |
| 686 pending_handle_ = nullptr; | 711 pending_handle_ = nullptr; |
| 687 WebContentsObserver::Observe(nullptr); | 712 WebContentsObserver::Observe(nullptr); |
| 688 Release(); | 713 Release(); |
| 689 } | 714 } |
| 690 | 715 |
| 716 bool RenderFrameDevToolsAgentHost::CheckConsistency() { |
| 717 if (current_ && pending_ && current_->host() == pending_->host()) |
| 718 return false; |
| 719 if (IsBrowserSideNavigationEnabled()) |
| 720 return true; |
| 721 if (!frame_tree_node_) |
| 722 return !handlers_frame_host_; |
| 723 RenderFrameHostManager* manager = frame_tree_node_->render_manager(); |
| 724 return handlers_frame_host_ == manager->current_frame_host() || |
| 725 handlers_frame_host_ == manager->pending_frame_host(); |
| 726 } |
| 727 |
| 691 void RenderFrameDevToolsAgentHost::CreatePowerSaveBlocker() { | 728 void RenderFrameDevToolsAgentHost::CreatePowerSaveBlocker() { |
| 692 #if defined(OS_ANDROID) | 729 #if defined(OS_ANDROID) |
| 693 power_save_blocker_.reset(new device::PowerSaveBlocker( | 730 power_save_blocker_.reset(new device::PowerSaveBlocker( |
| 694 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 731 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
| 695 device::PowerSaveBlocker::kReasonOther, "DevTools", | 732 device::PowerSaveBlocker::kReasonOther, "DevTools", |
| 696 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), | 733 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
| 697 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); | 734 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); |
| 698 if (web_contents()->GetNativeView()) { | 735 if (web_contents()->GetNativeView()) { |
| 699 power_save_blocker_->InitDisplaySleepBlocker( | 736 power_save_blocker_->InitDisplaySleepBlocker( |
| 700 web_contents()->GetNativeView()); | 737 web_contents()->GetNativeView()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 715 case base::TERMINATION_STATUS_OOM_PROTECTED: | 752 case base::TERMINATION_STATUS_OOM_PROTECTED: |
| 716 #endif | 753 #endif |
| 717 case base::TERMINATION_STATUS_LAUNCH_FAILED: | 754 case base::TERMINATION_STATUS_LAUNCH_FAILED: |
| 718 inspector_handler_->TargetCrashed(); | 755 inspector_handler_->TargetCrashed(); |
| 719 current_frame_crashed_ = true; | 756 current_frame_crashed_ = true; |
| 720 break; | 757 break; |
| 721 default: | 758 default: |
| 722 inspector_handler_->TargetDetached("Render process gone."); | 759 inspector_handler_->TargetDetached("Render process gone."); |
| 723 break; | 760 break; |
| 724 } | 761 } |
| 762 DCHECK(CheckConsistency()); |
| 725 } | 763 } |
| 726 | 764 |
| 727 bool RenderFrameDevToolsAgentHost::OnMessageReceived( | 765 bool RenderFrameDevToolsAgentHost::OnMessageReceived( |
| 728 const IPC::Message& message) { | 766 const IPC::Message& message) { |
| 729 if (!current_) | 767 if (!current_) |
| 730 return false; | 768 return false; |
| 731 if (message.type() == ViewHostMsg_SwapCompositorFrame::ID) | 769 if (message.type() == ViewHostMsg_SwapCompositorFrame::ID) |
| 732 OnSwapCompositorFrame(message); | 770 OnSwapCompositorFrame(message); |
| 733 return false; | 771 return false; |
| 734 } | 772 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 752 IPC_MESSAGE_UNHANDLED(handled = false) | 790 IPC_MESSAGE_UNHANDLED(handled = false) |
| 753 IPC_END_MESSAGE_MAP() | 791 IPC_END_MESSAGE_MAP() |
| 754 return handled; | 792 return handled; |
| 755 } | 793 } |
| 756 | 794 |
| 757 void RenderFrameDevToolsAgentHost::DidAttachInterstitialPage() { | 795 void RenderFrameDevToolsAgentHost::DidAttachInterstitialPage() { |
| 758 if (page_handler_) | 796 if (page_handler_) |
| 759 page_handler_->DidAttachInterstitialPage(); | 797 page_handler_->DidAttachInterstitialPage(); |
| 760 | 798 |
| 761 // TODO(dgozman): this may break for cross-process subframes. | 799 // TODO(dgozman): this may break for cross-process subframes. |
| 762 if (!pending_) | 800 if (!pending_) { |
| 801 DCHECK(CheckConsistency()); |
| 763 return; | 802 return; |
| 803 } |
| 764 // Pending set in AboutToNavigateRenderFrame turned out to be interstitial. | 804 // Pending set in AboutToNavigateRenderFrame turned out to be interstitial. |
| 765 // Connect back to the real one. | 805 // Connect back to the real one. |
| 766 DiscardPending(); | 806 DiscardPending(); |
| 767 pending_handle_ = nullptr; | 807 pending_handle_ = nullptr; |
| 808 DCHECK(CheckConsistency()); |
| 768 } | 809 } |
| 769 | 810 |
| 770 void RenderFrameDevToolsAgentHost::DidDetachInterstitialPage() { | 811 void RenderFrameDevToolsAgentHost::DidDetachInterstitialPage() { |
| 771 if (page_handler_) | 812 if (page_handler_) |
| 772 page_handler_->DidDetachInterstitialPage(); | 813 page_handler_->DidDetachInterstitialPage(); |
| 773 } | 814 } |
| 774 | 815 |
| 775 void RenderFrameDevToolsAgentHost::DidCommitProvisionalLoadForFrame( | 816 void RenderFrameDevToolsAgentHost::DidCommitProvisionalLoadForFrame( |
| 776 RenderFrameHost* render_frame_host, | 817 RenderFrameHost* render_frame_host, |
| 777 const GURL& url, | 818 const GURL& url, |
| 778 ui::PageTransition transition_type) { | 819 ui::PageTransition transition_type) { |
| 779 if (IsBrowserSideNavigationEnabled()) | 820 if (IsBrowserSideNavigationEnabled()) |
| 780 return; | 821 return; |
| 781 if (pending_ && pending_->host() == render_frame_host) | 822 if (pending_ && pending_->host() == render_frame_host) |
| 782 CommitPending(); | 823 CommitPending(); |
| 824 DCHECK(CheckConsistency()); |
| 783 target_handler_->UpdateServiceWorkers(); | 825 target_handler_->UpdateServiceWorkers(); |
| 784 } | 826 } |
| 785 | 827 |
| 786 void RenderFrameDevToolsAgentHost::DidFailProvisionalLoad( | 828 void RenderFrameDevToolsAgentHost::DidFailProvisionalLoad( |
| 787 RenderFrameHost* render_frame_host, | 829 RenderFrameHost* render_frame_host, |
| 788 const GURL& validated_url, | 830 const GURL& validated_url, |
| 789 int error_code, | 831 int error_code, |
| 790 const base::string16& error_description, | 832 const base::string16& error_description, |
| 791 bool was_ignored_by_handler) { | 833 bool was_ignored_by_handler) { |
| 792 if (IsBrowserSideNavigationEnabled()) | 834 if (IsBrowserSideNavigationEnabled()) |
| 793 return; | 835 return; |
| 794 if (pending_ && pending_->host() == render_frame_host) | 836 if (pending_ && pending_->host() == render_frame_host) |
| 795 DiscardPending(); | 837 DiscardPending(); |
| 838 DCHECK(CheckConsistency()); |
| 796 } | 839 } |
| 797 | 840 |
| 798 void RenderFrameDevToolsAgentHost::WasShown() { | 841 void RenderFrameDevToolsAgentHost::WasShown() { |
| 799 CreatePowerSaveBlocker(); | 842 CreatePowerSaveBlocker(); |
| 800 } | 843 } |
| 801 | 844 |
| 802 void RenderFrameDevToolsAgentHost::WasHidden() { | 845 void RenderFrameDevToolsAgentHost::WasHidden() { |
| 803 #if defined(OS_ANDROID) | 846 #if defined(OS_ANDROID) |
| 804 power_save_blocker_.reset(); | 847 power_save_blocker_.reset(); |
| 805 #endif | 848 #endif |
| 806 } | 849 } |
| 807 | 850 |
| 808 void RenderFrameDevToolsAgentHost:: | 851 void RenderFrameDevToolsAgentHost:: |
| 809 DispatchBufferedProtocolMessagesIfNecessary() { | 852 DispatchBufferedProtocolMessagesIfNecessary() { |
| 810 if (navigating_handles_.empty() && | 853 if (navigating_handles_.empty() && |
| 811 in_navigation_protocol_message_buffer_.size()) { | 854 in_navigation_protocol_message_buffer_.size()) { |
| 812 DCHECK(current_); | 855 DCHECK(current_); |
| 813 for (const auto& pair : in_navigation_protocol_message_buffer_) { | 856 for (const auto& pair : in_navigation_protocol_message_buffer_) { |
| 814 current_->DispatchProtocolMessage( | 857 current_->DispatchProtocolMessage( |
| 815 pair.second.session_id, pair.first, pair.second.method, | 858 pair.second.session_id, pair.first, pair.second.method, |
| 816 pair.second.message); | 859 pair.second.message); |
| 817 } | 860 } |
| 818 in_navigation_protocol_message_buffer_.clear(); | 861 in_navigation_protocol_message_buffer_.clear(); |
| 819 } | 862 } |
| 820 } | 863 } |
| 821 | 864 |
| 822 void RenderFrameDevToolsAgentHost::UpdateProtocolHandlers( | 865 void RenderFrameDevToolsAgentHost::UpdateProtocolHandlers( |
| 823 RenderFrameHostImpl* host) { | 866 RenderFrameHostImpl* host) { |
| 867 handlers_frame_host_ = host; |
| 824 dom_handler_->SetRenderFrameHost(host); | 868 dom_handler_->SetRenderFrameHost(host); |
| 825 if (emulation_handler_) | 869 if (emulation_handler_) |
| 826 emulation_handler_->SetRenderFrameHost(host); | 870 emulation_handler_->SetRenderFrameHost(host); |
| 827 input_handler_->SetRenderWidgetHost( | 871 input_handler_->SetRenderWidgetHost( |
| 828 host ? host->GetRenderWidgetHost() : nullptr); | 872 host ? host->GetRenderWidgetHost() : nullptr); |
| 829 inspector_handler_->SetRenderFrameHost(host); | 873 inspector_handler_->SetRenderFrameHost(host); |
| 830 network_handler_->SetRenderFrameHost(host); | 874 network_handler_->SetRenderFrameHost(host); |
| 831 if (page_handler_) | 875 if (page_handler_) |
| 832 page_handler_->SetRenderFrameHost(host); | 876 page_handler_->SetRenderFrameHost(host); |
| 833 service_worker_handler_->SetRenderFrameHost(host); | 877 service_worker_handler_->SetRenderFrameHost(host); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 RenderFrameHost* host) { | 1071 RenderFrameHost* host) { |
| 1028 return (current_ && current_->host() == host) || | 1072 return (current_ && current_->host() == host) || |
| 1029 (pending_ && pending_->host() == host); | 1073 (pending_ && pending_->host() == host); |
| 1030 } | 1074 } |
| 1031 | 1075 |
| 1032 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 1076 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
| 1033 return current_ && current_->host()->GetParent(); | 1077 return current_ && current_->host()->GetParent(); |
| 1034 } | 1078 } |
| 1035 | 1079 |
| 1036 } // namespace content | 1080 } // namespace content |
| OLD | NEW |