| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 NavigationHandle* navigation_handle) { | 398 NavigationHandle* navigation_handle) { |
| 399 FrameTreeNode* frame_tree_node = | 399 FrameTreeNode* frame_tree_node = |
| 400 static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node(); | 400 static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node(); |
| 401 while (frame_tree_node && frame_tree_node->parent()) { | 401 while (frame_tree_node && frame_tree_node->parent()) { |
| 402 frame_tree_node = frame_tree_node->parent(); | 402 frame_tree_node = frame_tree_node->parent(); |
| 403 } | 403 } |
| 404 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node); | 404 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node); |
| 405 // Note Page.setControlNavigations is intended to control navigations in the | 405 // Note Page.setControlNavigations is intended to control navigations in the |
| 406 // main frame and all child frames and |page_handler_| only exists for the | 406 // main frame and all child frames and |page_handler_| only exists for the |
| 407 // main frame. | 407 // main frame. |
| 408 if (!agent_host || !agent_host->session()) | 408 if (!agent_host) |
| 409 return nullptr; | 409 return nullptr; |
| 410 protocol::PageHandler* page_handler = | 410 for (auto* page_handler : protocol::PageHandler::ForAgentHost(agent_host)) { |
| 411 protocol::PageHandler::FromSession(agent_host->session()); | 411 std::unique_ptr<NavigationThrottle> throttle = |
| 412 if (!page_handler) | 412 page_handler->CreateThrottleForNavigation(navigation_handle); |
| 413 return nullptr; | 413 if (throttle) |
| 414 return page_handler->CreateThrottleForNavigation(navigation_handle); | 414 return throttle; |
| 415 } |
| 416 return nullptr; |
| 415 } | 417 } |
| 416 | 418 |
| 417 // static | 419 // static |
| 418 bool RenderFrameDevToolsAgentHost::IsNetworkHandlerEnabled( | 420 bool RenderFrameDevToolsAgentHost::IsNetworkHandlerEnabled( |
| 419 FrameTreeNode* frame_tree_node) { | 421 FrameTreeNode* frame_tree_node) { |
| 420 RenderFrameDevToolsAgentHost* agent_host = GetAgentHostFor(frame_tree_node); | 422 RenderFrameDevToolsAgentHost* agent_host = GetAgentHostFor(frame_tree_node); |
| 421 if (!agent_host || !agent_host->session()) | 423 if (!agent_host) |
| 422 return false; | 424 return false; |
| 423 return protocol::NetworkHandler::FromSession(agent_host->session()) | 425 for (auto* network : protocol::NetworkHandler::ForAgentHost(agent_host)) { |
| 424 ->enabled(); | 426 if (network->enabled()) |
| 427 return true; |
| 428 } |
| 429 return false; |
| 425 } | 430 } |
| 426 | 431 |
| 427 // static | 432 // static |
| 428 std::string RenderFrameDevToolsAgentHost::UserAgentOverride( | 433 std::string RenderFrameDevToolsAgentHost::UserAgentOverride( |
| 429 FrameTreeNode* frame_tree_node) { | 434 FrameTreeNode* frame_tree_node) { |
| 430 RenderFrameDevToolsAgentHost* agent_host = GetAgentHostFor(frame_tree_node); | 435 RenderFrameDevToolsAgentHost* agent_host = GetAgentHostFor(frame_tree_node); |
| 431 if (!agent_host || !agent_host->session()) | 436 if (!agent_host) |
| 432 return std::string(); | 437 return std::string(); |
| 433 return protocol::NetworkHandler::FromSession(agent_host->session()) | 438 for (auto* network : protocol::NetworkHandler::ForAgentHost(agent_host)) { |
| 434 ->UserAgentOverride(); | 439 std::string override = network->UserAgentOverride(); |
| 440 if (!override.empty()) |
| 441 return override; |
| 442 } |
| 443 return std::string(); |
| 435 } | 444 } |
| 436 | 445 |
| 437 // static | 446 // static |
| 438 void RenderFrameDevToolsAgentHost::WebContentsCreated( | 447 void RenderFrameDevToolsAgentHost::WebContentsCreated( |
| 439 WebContents* web_contents) { | 448 WebContents* web_contents) { |
| 440 if (ShouldForceCreation()) { | 449 if (ShouldForceCreation()) { |
| 441 // Force agent host. | 450 // Force agent host. |
| 442 DevToolsAgentHost::GetOrCreateFor(web_contents); | 451 DevToolsAgentHost::GetOrCreateFor(web_contents); |
| 443 } | 452 } |
| 444 } | 453 } |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 // CommitPending may destruct |this|. | 664 // CommitPending may destruct |this|. |
| 656 scoped_refptr<RenderFrameDevToolsAgentHost> protect(this); | 665 scoped_refptr<RenderFrameDevToolsAgentHost> protect(this); |
| 657 | 666 |
| 658 if (!IsBrowserSideNavigationEnabled()) { | 667 if (!IsBrowserSideNavigationEnabled()) { |
| 659 if (navigation_handle->HasCommitted() && | 668 if (navigation_handle->HasCommitted() && |
| 660 !navigation_handle->IsErrorPage()) { | 669 !navigation_handle->IsErrorPage()) { |
| 661 if (pending_ && | 670 if (pending_ && |
| 662 pending_->host() == navigation_handle->GetRenderFrameHost()) { | 671 pending_->host() == navigation_handle->GetRenderFrameHost()) { |
| 663 CommitPending(); | 672 CommitPending(); |
| 664 } | 673 } |
| 665 if (session()) | 674 for (auto* target : protocol::TargetHandler::ForAgentHost(this)) |
| 666 protocol::TargetHandler::FromSession(session())->UpdateServiceWorkers(); | 675 target->UpdateServiceWorkers(); |
| 667 } else if (pending_ && pending_->host()->GetFrameTreeNodeId() == | 676 } else if (pending_ && pending_->host()->GetFrameTreeNodeId() == |
| 668 navigation_handle->GetFrameTreeNodeId()) { | 677 navigation_handle->GetFrameTreeNodeId()) { |
| 669 DiscardPending(); | 678 DiscardPending(); |
| 670 } | 679 } |
| 671 DCHECK(CheckConsistency()); | 680 DCHECK(CheckConsistency()); |
| 672 return; | 681 return; |
| 673 } | 682 } |
| 674 | 683 |
| 675 // If the navigation is not tracked, return; | 684 // If the navigation is not tracked, return; |
| 676 if (navigating_handles_.count(navigation_handle) == 0) | 685 if (navigating_handles_.count(navigation_handle) == 0) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 689 } else { | 698 } else { |
| 690 DiscardPending(); | 699 DiscardPending(); |
| 691 } | 700 } |
| 692 pending_handle_ = nullptr; | 701 pending_handle_ = nullptr; |
| 693 } else if (navigating_handles_.empty()) { | 702 } else if (navigating_handles_.empty()) { |
| 694 current_->Resume(); | 703 current_->Resume(); |
| 695 } | 704 } |
| 696 DispatchBufferedProtocolMessagesIfNecessary(); | 705 DispatchBufferedProtocolMessagesIfNecessary(); |
| 697 | 706 |
| 698 DCHECK(CheckConsistency()); | 707 DCHECK(CheckConsistency()); |
| 699 if (session() && navigation_handle->HasCommitted()) | 708 if (navigation_handle->HasCommitted()) { |
| 700 protocol::TargetHandler::FromSession(session())->UpdateServiceWorkers(); | 709 for (auto* target : protocol::TargetHandler::ForAgentHost(this)) |
| 710 target->UpdateServiceWorkers(); |
| 711 } |
| 701 } | 712 } |
| 702 | 713 |
| 703 void RenderFrameDevToolsAgentHost::AboutToNavigateRenderFrame( | 714 void RenderFrameDevToolsAgentHost::AboutToNavigateRenderFrame( |
| 704 RenderFrameHost* old_host, | 715 RenderFrameHost* old_host, |
| 705 RenderFrameHost* new_host) { | 716 RenderFrameHost* new_host) { |
| 706 // CommitPending may destruct |this|. | 717 // CommitPending may destruct |this|. |
| 707 scoped_refptr<RenderFrameDevToolsAgentHost> protect(this); | 718 scoped_refptr<RenderFrameDevToolsAgentHost> protect(this); |
| 708 | 719 |
| 709 if (IsBrowserSideNavigationEnabled()) | 720 if (IsBrowserSideNavigationEnabled()) |
| 710 return; | 721 return; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 735 navigating_handles_.insert(navigation_handle); | 746 navigating_handles_.insert(navigation_handle); |
| 736 current_->Suspend(); | 747 current_->Suspend(); |
| 737 DCHECK(CheckConsistency()); | 748 DCHECK(CheckConsistency()); |
| 738 } | 749 } |
| 739 | 750 |
| 740 void RenderFrameDevToolsAgentHost::OnFailedNavigation( | 751 void RenderFrameDevToolsAgentHost::OnFailedNavigation( |
| 741 const CommonNavigationParams& common_params, | 752 const CommonNavigationParams& common_params, |
| 742 const BeginNavigationParams& begin_params, | 753 const BeginNavigationParams& begin_params, |
| 743 net::Error error_code) { | 754 net::Error error_code) { |
| 744 DCHECK(IsBrowserSideNavigationEnabled()); | 755 DCHECK(IsBrowserSideNavigationEnabled()); |
| 745 if (!session()) | 756 for (auto* network : protocol::NetworkHandler::ForAgentHost(this)) |
| 746 return; | 757 network->NavigationFailed(common_params, begin_params, error_code); |
| 747 | |
| 748 protocol::NetworkHandler* handler = | |
| 749 protocol::NetworkHandler::FromSession(session()); | |
| 750 if (!handler) | |
| 751 return; | |
| 752 | |
| 753 handler->NavigationFailed(common_params, begin_params, error_code); | |
| 754 } | 758 } |
| 755 | 759 |
| 756 void RenderFrameDevToolsAgentHost::RenderFrameHostChanged( | 760 void RenderFrameDevToolsAgentHost::RenderFrameHostChanged( |
| 757 RenderFrameHost* old_host, | 761 RenderFrameHost* old_host, |
| 758 RenderFrameHost* new_host) { | 762 RenderFrameHost* new_host) { |
| 759 // CommitPending may destruct |this|. | 763 // CommitPending may destruct |this|. |
| 760 scoped_refptr<RenderFrameDevToolsAgentHost> protect(this); | 764 scoped_refptr<RenderFrameDevToolsAgentHost> protect(this); |
| 761 | 765 |
| 762 if (session()) | 766 for (auto* target : protocol::TargetHandler::ForAgentHost(this)) |
| 763 protocol::TargetHandler::FromSession(session())->UpdateFrames(); | 767 target->UpdateFrames(); |
| 764 | 768 |
| 765 if (IsBrowserSideNavigationEnabled() && !current_frame_crashed_) | 769 if (IsBrowserSideNavigationEnabled() && !current_frame_crashed_) |
| 766 return; | 770 return; |
| 767 | 771 |
| 768 DCHECK(!pending_ || pending_->host() != old_host); | 772 DCHECK(!pending_ || pending_->host() != old_host); |
| 769 if (!current_ || current_->host() != old_host) { | 773 if (!current_ || current_->host() != old_host) { |
| 770 DCHECK(CheckConsistency()); | 774 DCHECK(CheckConsistency()); |
| 771 return; | 775 return; |
| 772 } | 776 } |
| 773 | 777 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: | 849 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: |
| 846 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: | 850 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: |
| 847 #if defined(OS_CHROMEOS) | 851 #if defined(OS_CHROMEOS) |
| 848 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: | 852 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: |
| 849 #endif | 853 #endif |
| 850 case base::TERMINATION_STATUS_PROCESS_CRASHED: | 854 case base::TERMINATION_STATUS_PROCESS_CRASHED: |
| 851 #if defined(OS_ANDROID) | 855 #if defined(OS_ANDROID) |
| 852 case base::TERMINATION_STATUS_OOM_PROTECTED: | 856 case base::TERMINATION_STATUS_OOM_PROTECTED: |
| 853 #endif | 857 #endif |
| 854 case base::TERMINATION_STATUS_LAUNCH_FAILED: | 858 case base::TERMINATION_STATUS_LAUNCH_FAILED: |
| 855 if (session()) | 859 for (auto* inspector : protocol::InspectorHandler::ForAgentHost(this)) |
| 856 protocol::InspectorHandler::FromSession(session())->TargetCrashed(); | 860 inspector->TargetCrashed(); |
| 857 current_frame_crashed_ = true; | 861 current_frame_crashed_ = true; |
| 858 break; | 862 break; |
| 859 default: | 863 default: |
| 860 if (session()) { | 864 for (auto* inspector : protocol::InspectorHandler::ForAgentHost(this)) |
| 861 protocol::InspectorHandler::FromSession(session()) | 865 inspector->TargetDetached("Render process gone."); |
| 862 ->TargetDetached("Render process gone."); | |
| 863 } | |
| 864 break; | 866 break; |
| 865 } | 867 } |
| 866 DCHECK(CheckConsistency()); | 868 DCHECK(CheckConsistency()); |
| 867 } | 869 } |
| 868 | 870 |
| 869 bool RenderFrameDevToolsAgentHost::OnMessageReceived( | 871 bool RenderFrameDevToolsAgentHost::OnMessageReceived( |
| 870 const IPC::Message& message, | 872 const IPC::Message& message, |
| 871 RenderFrameHost* render_frame_host) { | 873 RenderFrameHost* render_frame_host) { |
| 872 bool is_current = current_ && current_->host() == render_frame_host; | 874 bool is_current = current_ && current_->host() == render_frame_host; |
| 873 bool is_pending = pending_ && pending_->host() == render_frame_host; | 875 bool is_pending = pending_ && pending_->host() == render_frame_host; |
| 874 if (!is_current && !is_pending) | 876 if (!is_current && !is_pending) |
| 875 return false; | 877 return false; |
| 876 if (!IsAttached()) | 878 if (!IsAttached()) |
| 877 return false; | 879 return false; |
| 878 bool handled = true; | 880 bool handled = true; |
| 879 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(RenderFrameDevToolsAgentHost, message, | 881 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(RenderFrameDevToolsAgentHost, message, |
| 880 render_frame_host) | 882 render_frame_host) |
| 881 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, | 883 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, |
| 882 OnDispatchOnInspectorFrontend) | 884 OnDispatchOnInspectorFrontend) |
| 883 IPC_MESSAGE_HANDLER(DevToolsAgentHostMsg_RequestNewWindow, | 885 IPC_MESSAGE_HANDLER(DevToolsAgentHostMsg_RequestNewWindow, |
| 884 OnRequestNewWindow) | 886 OnRequestNewWindow) |
| 885 IPC_MESSAGE_UNHANDLED(handled = false) | 887 IPC_MESSAGE_UNHANDLED(handled = false) |
| 886 IPC_END_MESSAGE_MAP() | 888 IPC_END_MESSAGE_MAP() |
| 887 return handled; | 889 return handled; |
| 888 } | 890 } |
| 889 | 891 |
| 890 void RenderFrameDevToolsAgentHost::DidAttachInterstitialPage() { | 892 void RenderFrameDevToolsAgentHost::DidAttachInterstitialPage() { |
| 891 protocol::PageHandler* page_handler = | 893 for (auto* page : protocol::PageHandler::ForAgentHost(this)) |
| 892 session() ? protocol::PageHandler::FromSession(session()) : nullptr; | 894 page->DidAttachInterstitialPage(); |
| 893 if (page_handler) | |
| 894 page_handler->DidAttachInterstitialPage(); | |
| 895 | 895 |
| 896 // TODO(dgozman): this may break for cross-process subframes. | 896 // TODO(dgozman): this may break for cross-process subframes. |
| 897 if (!pending_) { | 897 if (!pending_) { |
| 898 DCHECK(CheckConsistency()); | 898 DCHECK(CheckConsistency()); |
| 899 return; | 899 return; |
| 900 } | 900 } |
| 901 // Pending set in AboutToNavigateRenderFrame turned out to be interstitial. | 901 // Pending set in AboutToNavigateRenderFrame turned out to be interstitial. |
| 902 // Connect back to the real one. | 902 // Connect back to the real one. |
| 903 DiscardPending(); | 903 DiscardPending(); |
| 904 pending_handle_ = nullptr; | 904 pending_handle_ = nullptr; |
| 905 DCHECK(CheckConsistency()); | 905 DCHECK(CheckConsistency()); |
| 906 } | 906 } |
| 907 | 907 |
| 908 void RenderFrameDevToolsAgentHost::DidDetachInterstitialPage() { | 908 void RenderFrameDevToolsAgentHost::DidDetachInterstitialPage() { |
| 909 protocol::PageHandler* page_handler = | 909 for (auto* page : protocol::PageHandler::ForAgentHost(this)) |
| 910 session() ? protocol::PageHandler::FromSession(session()) : nullptr; | 910 page->DidDetachInterstitialPage(); |
| 911 if (page_handler) | |
| 912 page_handler->DidDetachInterstitialPage(); | |
| 913 } | 911 } |
| 914 | 912 |
| 915 void RenderFrameDevToolsAgentHost::WasShown() { | 913 void RenderFrameDevToolsAgentHost::WasShown() { |
| 916 CreatePowerSaveBlocker(); | 914 CreatePowerSaveBlocker(); |
| 917 } | 915 } |
| 918 | 916 |
| 919 void RenderFrameDevToolsAgentHost::WasHidden() { | 917 void RenderFrameDevToolsAgentHost::WasHidden() { |
| 920 #if defined(OS_ANDROID) | 918 #if defined(OS_ANDROID) |
| 921 power_save_blocker_.reset(); | 919 power_save_blocker_.reset(); |
| 922 #endif | 920 #endif |
| 923 } | 921 } |
| 924 | 922 |
| 925 void RenderFrameDevToolsAgentHost::DidReceiveCompositorFrame() { | 923 void RenderFrameDevToolsAgentHost::DidReceiveCompositorFrame() { |
| 926 if (!session()) | |
| 927 return; | |
| 928 const cc::CompositorFrameMetadata& metadata = | 924 const cc::CompositorFrameMetadata& metadata = |
| 929 RenderWidgetHostImpl::From( | 925 RenderWidgetHostImpl::From( |
| 930 web_contents()->GetRenderViewHost()->GetWidget()) | 926 web_contents()->GetRenderViewHost()->GetWidget()) |
| 931 ->last_frame_metadata(); | 927 ->last_frame_metadata(); |
| 932 protocol::PageHandler* page_handler = | 928 for (auto* page : protocol::PageHandler::ForAgentHost(this)) |
| 933 protocol::PageHandler::FromSession(session()); | 929 page->OnSwapCompositorFrame(metadata.Clone()); |
| 934 if (page_handler) | 930 for (auto* input : protocol::InputHandler::ForAgentHost(this)) |
| 935 page_handler->OnSwapCompositorFrame(metadata.Clone()); | 931 input->OnSwapCompositorFrame(metadata); |
| 936 protocol::InputHandler::FromSession(session())->OnSwapCompositorFrame( | 932 |
| 937 metadata); | 933 if (!frame_trace_recorder_) |
| 938 protocol::TracingHandler* tracing_handler = | 934 return; |
| 939 protocol::TracingHandler::FromSession(session()); | 935 bool did_initiate_recording = false; |
| 940 if (frame_trace_recorder_ && tracing_handler->did_initiate_recording()) { | 936 for (auto* tracing : protocol::TracingHandler::ForAgentHost(this)) |
| 937 did_initiate_recording |= tracing->did_initiate_recording(); |
| 938 if (did_initiate_recording) { |
| 941 frame_trace_recorder_->OnSwapCompositorFrame( | 939 frame_trace_recorder_->OnSwapCompositorFrame( |
| 942 current_ ? current_->host() : nullptr, metadata); | 940 current_ ? current_->host() : nullptr, metadata); |
| 943 } | 941 } |
| 944 } | 942 } |
| 945 | 943 |
| 946 void RenderFrameDevToolsAgentHost:: | 944 void RenderFrameDevToolsAgentHost:: |
| 947 DispatchBufferedProtocolMessagesIfNecessary() { | 945 DispatchBufferedProtocolMessagesIfNecessary() { |
| 948 if (navigating_handles_.empty() && | 946 if (navigating_handles_.empty() && |
| 949 in_navigation_protocol_message_buffer_.size()) { | 947 in_navigation_protocol_message_buffer_.size()) { |
| 950 DCHECK(current_); | 948 DCHECK(current_); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 BrowserThread::UI, FROM_HERE, | 1106 BrowserThread::UI, FROM_HERE, |
| 1109 base::Bind( | 1107 base::Bind( |
| 1110 &RenderFrameDevToolsAgentHost::SynchronousSwapCompositorFrame, | 1108 &RenderFrameDevToolsAgentHost::SynchronousSwapCompositorFrame, |
| 1111 dtah.get(), | 1109 dtah.get(), |
| 1112 base::Passed(std::move(frame_metadata)))); | 1110 base::Passed(std::move(frame_metadata)))); |
| 1113 } | 1111 } |
| 1114 } | 1112 } |
| 1115 | 1113 |
| 1116 void RenderFrameDevToolsAgentHost::SynchronousSwapCompositorFrame( | 1114 void RenderFrameDevToolsAgentHost::SynchronousSwapCompositorFrame( |
| 1117 cc::CompositorFrameMetadata frame_metadata) { | 1115 cc::CompositorFrameMetadata frame_metadata) { |
| 1118 if (!session()) | 1116 for (auto* page : protocol::PageHandler::ForAgentHost(this)) |
| 1117 page->OnSynchronousSwapCompositorFrame(frame_metadata.Clone()); |
| 1118 for (auto* input : protocol::InputHandler::ForAgentHost(this)) |
| 1119 input->OnSwapCompositorFrame(frame_metadata); |
| 1120 |
| 1121 if (!frame_trace_recorder_) |
| 1119 return; | 1122 return; |
| 1120 protocol::PageHandler* page_handler = | 1123 bool did_initiate_recording = false; |
| 1121 protocol::PageHandler::FromSession(session()); | 1124 for (auto* tracing : protocol::TracingHandler::ForAgentHost(this)) |
| 1122 if (page_handler) | 1125 did_initiate_recording |= tracing->did_initiate_recording(); |
| 1123 page_handler->OnSynchronousSwapCompositorFrame(std::move(frame_metadata)); | 1126 if (did_initiate_recording) { |
| 1124 protocol::InputHandler::FromSession(session()) | |
| 1125 ->OnSwapCompositorFrame(frame_metadata); | |
| 1126 protocol::TracingHandler* tracing_handler = | |
| 1127 protocol::TracingHandler::FromSession(session()); | |
| 1128 if (frame_trace_recorder_ && tracing_handler->did_initiate_recording()) { | |
| 1129 frame_trace_recorder_->OnSynchronousSwapCompositorFrame( | 1127 frame_trace_recorder_->OnSynchronousSwapCompositorFrame( |
| 1130 current_ ? current_->host() : nullptr, | 1128 current_ ? current_->host() : nullptr, frame_metadata); |
| 1131 frame_metadata); | |
| 1132 } | 1129 } |
| 1133 } | 1130 } |
| 1134 | 1131 |
| 1135 void RenderFrameDevToolsAgentHost::OnDispatchOnInspectorFrontend( | 1132 void RenderFrameDevToolsAgentHost::OnDispatchOnInspectorFrontend( |
| 1136 RenderFrameHost* sender, | 1133 RenderFrameHost* sender, |
| 1137 const DevToolsMessageChunk& message) { | 1134 const DevToolsMessageChunk& message) { |
| 1138 bool success = true; | 1135 bool success = true; |
| 1139 if (current_ && current_->host() == sender) | 1136 if (current_ && current_->host() == sender) |
| 1140 success = current_->ProcessChunkedMessageFromAgent(message); | 1137 success = current_->ProcessChunkedMessageFromAgent(message); |
| 1141 else if (pending_ && pending_->host() == sender) | 1138 else if (pending_ && pending_->host() == sender) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1168 RenderFrameHost* host) { | 1165 RenderFrameHost* host) { |
| 1169 return (current_ && current_->host() == host) || | 1166 return (current_ && current_->host() == host) || |
| 1170 (pending_ && pending_->host() == host); | 1167 (pending_ && pending_->host() == host); |
| 1171 } | 1168 } |
| 1172 | 1169 |
| 1173 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 1170 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
| 1174 return current_ && current_->host()->GetParent(); | 1171 return current_ && current_->host()->GetParent(); |
| 1175 } | 1172 } |
| 1176 | 1173 |
| 1177 } // namespace content | 1174 } // namespace content |
| OLD | NEW |