Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: content/browser/frame_host/frame_tree.cc

Issue 1390053002: Trace FrameTreeNode Snapshots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/frame_tree.h" 5 #include "content/browser/frame_host/frame_tree.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "content/browser/frame_host/frame_tree_node.h" 14 #include "content/browser/frame_host/frame_tree_node.h"
15 #include "content/browser/frame_host/navigator.h" 15 #include "content/browser/frame_host/navigator.h"
16 #include "content/browser/frame_host/render_frame_host_factory.h" 16 #include "content/browser/frame_host/render_frame_host_factory.h"
17 #include "content/browser/frame_host/render_frame_host_impl.h" 17 #include "content/browser/frame_host/render_frame_host_impl.h"
18 #include "content/browser/frame_host/render_frame_proxy_host.h" 18 #include "content/browser/frame_host/render_frame_proxy_host.h"
19 #include "content/browser/frame_host/traced_frame_tree.h"
19 #include "content/browser/renderer_host/render_view_host_factory.h" 20 #include "content/browser/renderer_host/render_view_host_factory.h"
20 #include "content/browser/renderer_host/render_view_host_impl.h" 21 #include "content/browser/renderer_host/render_view_host_impl.h"
21 #include "content/common/site_isolation_policy.h" 22 #include "content/common/site_isolation_policy.h"
22 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 23 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
23 24
24 namespace content { 25 namespace content {
25 26
26 namespace { 27 namespace {
27 28
28 // Used with FrameTree::ForEach() to search for the FrameTreeNode 29 // Used with FrameTree::ForEach() to search for the FrameTreeNode
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (parent->current_frame_host()->GetProcess()->GetID() != process_id) 201 if (parent->current_frame_host()->GetProcess()->GetID() != process_id)
201 return nullptr; 202 return nullptr;
202 203
203 scoped_ptr<FrameTreeNode> node( 204 scoped_ptr<FrameTreeNode> node(
204 new FrameTreeNode(this, parent->navigator(), render_frame_delegate_, 205 new FrameTreeNode(this, parent->navigator(), render_frame_delegate_,
205 render_view_delegate_, render_widget_delegate_, 206 render_view_delegate_, render_widget_delegate_,
206 manager_delegate_, scope, frame_name, sandbox_flags)); 207 manager_delegate_, scope, frame_name, sandbox_flags));
207 FrameTreeNode* node_ptr = node.get(); 208 FrameTreeNode* node_ptr = node.get();
208 // AddChild is what creates the RenderFrameHost. 209 // AddChild is what creates the RenderFrameHost.
209 parent->AddChild(node.Pass(), process_id, new_routing_id); 210 parent->AddChild(node.Pass(), process_id, new_routing_id);
211 TraceSnapshot();
210 return node_ptr->current_frame_host(); 212 return node_ptr->current_frame_host();
211 } 213 }
212 214
213 void FrameTree::RemoveFrame(FrameTreeNode* child) { 215 void FrameTree::RemoveFrame(FrameTreeNode* child) {
214 FrameTreeNode* parent = child->parent(); 216 FrameTreeNode* parent = child->parent();
215 if (!parent) { 217 if (!parent) {
216 NOTREACHED() << "Unexpected RemoveFrame call for main frame."; 218 NOTREACHED() << "Unexpected RemoveFrame call for main frame.";
217 return; 219 return;
218 } 220 }
219 221
220 parent->RemoveChild(child); 222 parent->RemoveChild(child);
223 TraceSnapshot();
221 } 224 }
222 225
223 void FrameTree::CreateProxiesForSiteInstance( 226 void FrameTree::CreateProxiesForSiteInstance(
224 FrameTreeNode* source, 227 FrameTreeNode* source,
225 SiteInstance* site_instance) { 228 SiteInstance* site_instance) {
226 // Create the swapped out RVH for the new SiteInstance. This will create 229 // Create the swapped out RVH for the new SiteInstance. This will create
227 // a top-level swapped out RFH as well, which will then be wrapped by a 230 // a top-level swapped out RFH as well, which will then be wrapped by a
228 // RenderFrameProxyHost. 231 // RenderFrameProxyHost.
229 if (!source || !source->IsMainFrame()) { 232 if (!source || !source->IsMainFrame()) {
230 RenderViewHostImpl* render_view_host = GetRenderViewHost(site_instance); 233 RenderViewHostImpl* render_view_host = GetRenderViewHost(site_instance);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 ForEach(base::Bind(&ResetNodeLoadProgress)); 407 ForEach(base::Bind(&ResetNodeLoadProgress));
405 load_progress_ = 0.0; 408 load_progress_ = 0.0;
406 } 409 }
407 410
408 bool FrameTree::IsLoading() { 411 bool FrameTree::IsLoading() {
409 bool is_loading = false; 412 bool is_loading = false;
410 ForEach(base::Bind(&IsNodeLoading, &is_loading)); 413 ForEach(base::Bind(&IsNodeLoading, &is_loading));
411 return is_loading; 414 return is_loading;
412 } 415 }
413 416
417 void FrameTree::TraceSnapshot() const {
418 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("navigation", "FrameTree", this,
419 scoped_refptr<base::trace_event::ConvertableToTraceFormat>(
420 TracedFrameTree::Create(*this)));
421 }
422
414 } // namespace content 423 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698