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

Unified Diff: content/browser/frame_host/frame_tree_node.cc

Issue 1901023003: Introduce browser side FrameTreeNodeBlameContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove thread safety handling (and its doc) Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/frame_tree_node.cc
diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc
index 547e872f2210bb42d1f420d3506b42d0f9b50a31..d2b232455f89babdc02e16dfbbe129fe969dc529 100644
--- a/content/browser/frame_host/frame_tree_node.cc
+++ b/content/browser/frame_host/frame_tree_node.cc
@@ -15,7 +15,6 @@
#include "content/browser/frame_host/navigation_request.h"
#include "content/browser/frame_host/navigator.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
-#include "content/browser/frame_host/traced_frame_tree_node.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/common/frame_messages.h"
#include "content/common/site_isolation_policy.h"
@@ -106,12 +105,6 @@ FrameTreeNode::FrameTreeNode(
g_frame_tree_node_id_map.Get().insert(
std::make_pair(frame_tree_node_id_, this));
CHECK(result.second);
-
- TRACE_EVENT_OBJECT_CREATED_WITH_ID(
- "navigation", "FrameTreeNode",
- TRACE_ID_WITH_SCOPE("FrameTreeNode", frame_tree_node_id_));
- // Don't TraceSnapshot() until the RenderFrameHostManager is initialized and
- // calls SetCurrentURL().
}
FrameTreeNode::~FrameTreeNode() {
@@ -123,10 +116,6 @@ FrameTreeNode::~FrameTreeNode() {
opener_->RemoveObserver(opener_observer_.get());
g_frame_tree_node_id_map.Get().erase(frame_tree_node_id_);
-
- TRACE_EVENT_OBJECT_DELETED_WITH_ID(
- "navigation", "FrameTreeNode",
- TRACE_ID_WITH_SCOPE("FrameTreeNode", frame_tree_node_id_));
}
void FrameTreeNode::AddObserver(Observer* observer) {
@@ -148,6 +137,8 @@ FrameTreeNode* FrameTreeNode::AddChild(std::unique_ptr<FrameTreeNode> child,
CHECK_EQ(process_id, render_manager_.current_host()->GetProcess()->GetID());
child->set_parent(this);
+ child->InitializeBlameContext();
+
// Initialize the RenderFrameHost for the new node. We always create child
// frames in the same SiteInstance as the current frame, and they can swap to
// a different one if they navigate away.
@@ -183,7 +174,11 @@ void FrameTreeNode::RemoveChild(FrameTreeNode* child) {
void FrameTreeNode::ResetForNewProcess() {
current_frame_host()->set_last_committed_url(GURL());
- TraceSnapshot();
+
+ if (blame_context_) {
+ blame_context_->UpdateArguments();
+ blame_context_->TakeSnapshot();
+ }
// Remove child nodes from the tree, then delete them. This destruction
// operation will notify observers.
@@ -209,7 +204,11 @@ void FrameTreeNode::SetCurrentURL(const GURL& url) {
if (!has_committed_real_load_ && url != GURL(url::kAboutBlankURL))
has_committed_real_load_ = true;
current_frame_host()->set_last_committed_url(url);
- TraceSnapshot();
+
+ if (blame_context_) {
+ blame_context_->UpdateArguments();
+ blame_context_->TakeSnapshot();
+ }
}
void FrameTreeNode::SetCurrentOrigin(
@@ -478,13 +477,10 @@ void FrameTreeNode::BeforeUnloadCanceled() {
}
}
-void FrameTreeNode::TraceSnapshot() const {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
- "navigation", "FrameTreeNode",
- TRACE_ID_WITH_SCOPE("FrameTreeNode", frame_tree_node_id_),
- std::unique_ptr<base::trace_event::ConvertableToTraceFormat>(
- new TracedFrameTreeNode(*this)));
+void FrameTreeNode::InitializeBlameContext() {
+ DCHECK(!blame_context_);
+ blame_context_ = base::WrapUnique(new FrameTreeNodeBlameContext(this));
+ blame_context_->Initialize();
}
} // namespace content
« no previous file with comments | « content/browser/frame_host/frame_tree_node.h ('k') | content/browser/frame_host/frame_tree_node_blame_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698