Chromium Code Reviews| 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 #ifndef CONTENT_BROWSER_DEVTOOLS_RENDER_FRAME_DEVTOOLS_AGENT_HOST_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_RENDER_FRAME_DEVTOOLS_AGENT_HOST_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_RENDER_FRAME_DEVTOOLS_AGENT_HOST_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_RENDER_FRAME_DEVTOOLS_AGENT_HOST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 private WebContentsObserver { | 44 private WebContentsObserver { |
| 45 public: | 45 public: |
| 46 static void AddAllAgentHosts(DevToolsAgentHost::List* result); | 46 static void AddAllAgentHosts(DevToolsAgentHost::List* result); |
| 47 static scoped_refptr<DevToolsAgentHost> GetOrCreateFor( | 47 static scoped_refptr<DevToolsAgentHost> GetOrCreateFor( |
| 48 FrameTreeNode* frame_tree_node); | 48 FrameTreeNode* frame_tree_node); |
| 49 | 49 |
| 50 static void OnCancelPendingNavigation(RenderFrameHost* pending, | 50 static void OnCancelPendingNavigation(RenderFrameHost* pending, |
| 51 RenderFrameHost* current); | 51 RenderFrameHost* current); |
| 52 static void OnBeforeNavigation(RenderFrameHost* current, | 52 static void OnBeforeNavigation(RenderFrameHost* current, |
| 53 RenderFrameHost* pending); | 53 RenderFrameHost* pending); |
| 54 static void OnBeforeNavigation(NavigationHandle* navigation_handle); | |
| 55 static void OnFailedNavigation(RenderFrameHost* host, | 54 static void OnFailedNavigation(RenderFrameHost* host, |
| 56 const CommonNavigationParams& common_params, | 55 const CommonNavigationParams& common_params, |
| 57 const BeginNavigationParams& begin_params, | 56 const BeginNavigationParams& begin_params, |
| 58 net::Error error_code); | 57 net::Error error_code); |
| 59 static std::unique_ptr<NavigationThrottle> CreateThrottleForNavigation( | 58 static std::unique_ptr<NavigationThrottle> CreateThrottleForNavigation( |
| 60 NavigationHandle* navigation_handle); | 59 NavigationHandle* navigation_handle); |
| 61 static bool IsNetworkHandlerEnabled(FrameTreeNode* frame_tree_node); | 60 static bool IsNetworkHandlerEnabled(FrameTreeNode* frame_tree_node); |
| 62 static std::string UserAgentOverride(FrameTreeNode* frame_tree_node); | 61 static std::string UserAgentOverride(FrameTreeNode* frame_tree_node); |
| 63 | 62 |
| 64 static void WebContentsCreated(WebContents* web_contents); | 63 static void WebContentsCreated(WebContents* web_contents); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 93 | 92 |
| 94 // DevToolsAgentHostImpl overrides. | 93 // DevToolsAgentHostImpl overrides. |
| 95 void AttachSession(DevToolsSession* session) override; | 94 void AttachSession(DevToolsSession* session) override; |
| 96 void DetachSession(int session_id) override; | 95 void DetachSession(int session_id) override; |
| 97 void InspectElement(DevToolsSession* session, int x, int y) override; | 96 void InspectElement(DevToolsSession* session, int x, int y) override; |
| 98 bool DispatchProtocolMessage( | 97 bool DispatchProtocolMessage( |
| 99 DevToolsSession* session, | 98 DevToolsSession* session, |
| 100 const std::string& message) override; | 99 const std::string& message) override; |
| 101 | 100 |
| 102 // WebContentsObserver overrides. | 101 // WebContentsObserver overrides. |
| 102 void DidStartNavigation(NavigationHandle* navigation_handle) override; | |
| 103 void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override; | 103 void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override; |
| 104 void DidFinishNavigation(NavigationHandle* navigation_handle) override; | 104 void DidFinishNavigation(NavigationHandle* navigation_handle) override; |
| 105 void RenderFrameHostChanged(RenderFrameHost* old_host, | 105 void RenderFrameHostChanged(RenderFrameHost* old_host, |
| 106 RenderFrameHost* new_host) override; | 106 RenderFrameHost* new_host) override; |
| 107 void FrameDeleted(RenderFrameHost* rfh) override; | 107 void FrameDeleted(RenderFrameHost* rfh) override; |
| 108 void RenderFrameDeleted(RenderFrameHost* rfh) override; | 108 void RenderFrameDeleted(RenderFrameHost* rfh) override; |
| 109 void RenderProcessGone(base::TerminationStatus status) override; | 109 void RenderProcessGone(base::TerminationStatus status) override; |
| 110 bool OnMessageReceived(const IPC::Message& message, | 110 bool OnMessageReceived(const IPC::Message& message, |
| 111 RenderFrameHost* render_frame_host) override; | 111 RenderFrameHost* render_frame_host) override; |
| 112 void DidAttachInterstitialPage() override; | 112 void DidAttachInterstitialPage() override; |
| 113 void DidDetachInterstitialPage() override; | 113 void DidDetachInterstitialPage() override; |
| 114 void WasShown() override; | 114 void WasShown() override; |
| 115 void WasHidden() override; | 115 void WasHidden() override; |
| 116 void DidReceiveCompositorFrame() override; | 116 void DidReceiveCompositorFrame() override; |
| 117 | 117 |
| 118 void AboutToNavigateRenderFrame(RenderFrameHost* old_host, | 118 void AboutToNavigateRenderFrame(RenderFrameHost* old_host, |
| 119 RenderFrameHost* new_host); | 119 RenderFrameHost* new_host); |
| 120 void AboutToNavigate(NavigationHandle* navigation_handle); | |
| 121 void OnFailedNavigation(const CommonNavigationParams& common_params, | |
| 122 const BeginNavigationParams& begin_params, | |
| 123 net::Error error_code); | |
| 124 | |
| 125 void DispatchBufferedProtocolMessagesIfNecessary(); | |
| 126 | 120 |
| 127 void SetPending(RenderFrameHostImpl* host); | 121 void SetPending(RenderFrameHostImpl* host); |
| 128 void CommitPending(); | 122 void CommitPending(); |
| 129 void DiscardPending(); | 123 void DiscardPending(); |
| 130 void UpdateProtocolHandlers(RenderFrameHostImpl* host); | 124 void UpdateProtocolHandlers(RenderFrameHostImpl* host); |
| 131 | 125 |
| 132 bool IsChildFrame(); | 126 bool IsChildFrame(); |
| 133 | 127 |
| 134 void OnClientAttached(); | 128 void OnClientAttached(); |
| 135 void OnClientDetached(); | 129 void OnClientDetached(); |
| 136 | 130 |
| 137 void RenderFrameCrashed(); | 131 void RenderFrameCrashed(); |
| 138 void OnSwapCompositorFrame(const IPC::Message& message); | 132 void OnSwapCompositorFrame(const IPC::Message& message); |
| 139 void OnDispatchOnInspectorFrontend( | 133 void OnDispatchOnInspectorFrontend( |
| 140 RenderFrameHost* sender, | 134 RenderFrameHost* sender, |
| 141 const DevToolsMessageChunk& message); | 135 const DevToolsMessageChunk& message); |
| 142 void OnRequestNewWindow(RenderFrameHost* sender, int new_routing_id); | 136 void OnRequestNewWindow(RenderFrameHost* sender, int new_routing_id); |
| 143 void DestroyOnRenderFrameGone(); | 137 void DestroyOnRenderFrameGone(); |
| 144 | 138 |
| 145 bool CheckConsistency(); | 139 bool CheckConsistency(); |
| 140 void UpdateFrameHost(RenderFrameHostImpl* frame_host); | |
| 141 void MaybeReattachToRenderFrame(); | |
| 142 void SendMessageFromProcessor(int session_id, const std::string& message); | |
| 143 void GrantPolicy(RenderFrameHostImpl* host); | |
| 144 void RevokePolicy(RenderFrameHostImpl* host); | |
| 146 | 145 |
| 147 #if defined(OS_ANDROID) | 146 #if defined(OS_ANDROID) |
| 148 device::mojom::WakeLock* GetWakeLock(); | 147 device::mojom::WakeLock* GetWakeLock(); |
| 149 #endif | 148 #endif |
| 150 | 149 |
| 151 void SynchronousSwapCompositorFrame( | 150 void SynchronousSwapCompositorFrame( |
| 152 cc::CompositorFrameMetadata frame_metadata); | 151 cc::CompositorFrameMetadata frame_metadata); |
| 153 | 152 |
| 154 class FrameHostHolder; | 153 class FrameHostHolder; |
| 155 | 154 |
| 156 std::unique_ptr<FrameHostHolder> current_; | 155 std::unique_ptr<FrameHostHolder> current_; |
| 157 std::unique_ptr<FrameHostHolder> pending_; | 156 std::unique_ptr<FrameHostHolder> pending_; |
| 158 | 157 |
| 159 // Stores per-host state between DisconnectWebContents and ConnectWebContents. | 158 // Stores per-host state between DisconnectWebContents and ConnectWebContents. |
| 160 std::unique_ptr<FrameHostHolder> disconnected_; | 159 std::unique_ptr<FrameHostHolder> disconnected_; |
| 161 | 160 |
| 162 std::unique_ptr<DevToolsFrameTraceRecorder> frame_trace_recorder_; | 161 std::unique_ptr<DevToolsFrameTraceRecorder> frame_trace_recorder_; |
| 163 #if defined(OS_ANDROID) | 162 #if defined(OS_ANDROID) |
| 164 device::mojom::WakeLockPtr wake_lock_; | 163 device::mojom::WakeLockPtr wake_lock_; |
| 165 #endif | 164 #endif |
| 166 RenderFrameHostImpl* handlers_frame_host_; | 165 RenderFrameHostImpl* handlers_frame_host_; |
| 167 bool current_frame_crashed_; | 166 bool current_frame_crashed_; |
| 168 | 167 |
| 169 // PlzNavigate | 168 // PlzNavigate |
| 170 | 169 |
| 171 // Handle that caused the setting of pending_. | 170 // The active host we are talking to. |
| 172 NavigationHandle* pending_handle_; | 171 RenderFrameHostImpl* frame_host_ = nullptr; |
| 173 | 172 struct Message { |
| 174 // List of handles currently navigating. | |
| 175 std::set<NavigationHandle*> navigating_handles_; | |
| 176 | |
| 177 struct PendingMessage { | |
| 178 int session_id; | 173 int session_id; |
| 174 int call_id; | |
|
caseq
2017/06/10 00:02:46
I don't think you actually need it.
dgozman
2017/06/10 01:36:35
Done.
| |
| 179 std::string method; | 175 std::string method; |
| 180 std::string message; | 176 std::string message; |
| 181 }; | 177 }; |
| 182 // <call_id> -> PendingMessage | 178 // Chunk processor's state cookie always corresponds to a state before |
| 183 std::map<int, PendingMessage> in_navigation_protocol_message_buffer_; | 179 // any of the suspended or waiting for response messages have been handled. |
| 180 DevToolsMessageChunkProcessor chunk_processor_; | |
| 181 int suspended_count_ = 0; | |
| 182 bool render_frame_alive_ = false; | |
| 183 // These messages were sent before suspending, but their result have not been | |
| 184 // received yet, and state cookie has not been updated. | |
| 185 std::map<int, Message> waiting_for_response_messages_; | |
| 186 // These messages were queued after suspending, not sent to the agent, | |
| 187 // and will be sent after resuming. | |
| 188 std::map<int, Message> suspended_messages_; | |
| 184 | 189 |
| 185 // The FrameTreeNode associated with this agent. | 190 // The FrameTreeNode associated with this agent. |
| 186 FrameTreeNode* frame_tree_node_; | 191 FrameTreeNode* frame_tree_node_; |
| 187 | 192 |
| 188 DISALLOW_COPY_AND_ASSIGN(RenderFrameDevToolsAgentHost); | 193 DISALLOW_COPY_AND_ASSIGN(RenderFrameDevToolsAgentHost); |
| 189 }; | 194 }; |
| 190 | 195 |
| 191 } // namespace content | 196 } // namespace content |
| 192 | 197 |
| 193 #endif // CONTENT_BROWSER_DEVTOOLS_RENDER_FRAME_DEVTOOLS_AGENT_HOST_H_ | 198 #endif // CONTENT_BROWSER_DEVTOOLS_RENDER_FRAME_DEVTOOLS_AGENT_HOST_H_ |
| OLD | NEW |