| Index: content/browser/frame_host/frame_tree_node_blame_context.h
|
| diff --git a/content/browser/frame_host/frame_tree_node_blame_context.h b/content/browser/frame_host/frame_tree_node_blame_context.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a50ac52bb9fa5c93a3e6e2cd805d225e77fee3cf
|
| --- /dev/null
|
| +++ b/content/browser/frame_host/frame_tree_node_blame_context.h
|
| @@ -0,0 +1,65 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_BLAME_CONTEXT_H
|
| +#define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_BLAME_CONTEXT_H
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/synchronization/lock.h"
|
| +#include "base/trace_event/blame_context.h"
|
| +#include "url/gurl.h"
|
| +
|
| +namespace base {
|
| +namespace trace_event {
|
| +class TracedValue;
|
| +}
|
| +}
|
| +
|
| +namespace content {
|
| +
|
| +class FrameTreeNode;
|
| +
|
| +// FrameTreeNodeBlameContext is a helper class for tracing snapshots of each
|
| +// FrameTreeNode and attributing browser activities to frames (when possible),
|
| +// in the framework of FrameBlamer (crbug.com/546021).
|
| +//
|
| +//
|
| +// *** LIFECYCLE ***
|
| +//
|
| +// Each FrameTreeNodeBlameContext is owned by a FrameTreeNode, and each
|
| +// FrameTreeNode owns at most one FrameTreeNodeBlameContext. The lifecycle
|
| +// of each FrameTreeNodeBlameContext is managed by its owner node.
|
| +// Creation: For each root FrameTreeNode, its blame context is created right
|
| +// after the node's intialization. For each other node, its blame context is
|
| +// created after the node is attached to a parent node. If the owner node is
|
| +// reattached to a different parent node, its original blame context gets
|
| +// destroyed and replaced by a new one.
|
| +// Update: Whenever the owner node navigates, it calls UpdateArguments() of
|
| +// its blame context to update its value. The is the only way to update the
|
| +// value of a FrameTreeNodeBlameContext.
|
| +// Deletion: A FrameTreeNodeBlameContext is deleted when its owner node is
|
| +// deleted or reattached to a different parent node.
|
| +
|
| +class FrameTreeNodeBlameContext : public base::trace_event::BlameContext {
|
| + public:
|
| + FrameTreeNodeBlameContext(FrameTreeNode* node);
|
| + ~FrameTreeNodeBlameContext() override;
|
| + void UpdateArguments();
|
| +
|
| + private:
|
| + void AsValueInto(base::trace_event::TracedValue* value) override;
|
| +
|
| + // Buffered information of the owner node, maintained by UpdateArguments().
|
| + int process_id_;
|
| + int routing_id_;
|
| + GURL url_;
|
| +
|
| + FrameTreeNode* const owner_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(FrameTreeNodeBlameContext);
|
| +};
|
| +
|
| +} // content
|
| +
|
| +#endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_BLAME_CONTEXT_H
|
|
|