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

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

Issue 1390053002: Trace FrameTreeNode Snapshots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GetProcId windows handle Created 4 years, 9 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
« no previous file with comments | « content/browser/frame_host/traced_frame_tree_node.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/frame_host/traced_frame_tree_node.h"
6
7 #include "base/command_line.h"
8 #include "base/json/json_writer.h"
9 #include "base/strings/stringprintf.h"
10 #include "content/browser/frame_host/frame_tree.h"
11 #include "content/public/common/content_switches.h"
12 #include "url/gurl.h"
13
14 namespace content {
15
16 TracedFrameTreeNode::TracedFrameTreeNode(const FrameTreeNode& node)
17 : parent_node_id_(-1),
18 url_(node.current_url().spec()),
19 process_id_(-1),
20 routing_id_(-1) {
21 FrameTreeNode* parent = node.parent();
22 if (parent)
23 parent_node_id_ = parent->frame_tree_node_id();
24
25 RenderFrameHostImpl* current_frame_host = node.current_frame_host();
26 process_id_ = base::GetProcId(current_frame_host->GetProcess()->GetHandle());
nasko 2016/03/03 19:03:51 Why are you using GetProcId? It is documented as d
benjhayden 2016/03/03 20:35:43 Done.
27 routing_id_ = current_frame_host->GetRoutingID();
28 DCHECK_NE(routing_id_, MSG_ROUTING_NONE);
29 }
30
31 TracedFrameTreeNode::~TracedFrameTreeNode() {
32 }
33
34 void TracedFrameTreeNode::AppendAsTraceFormat(std::string* out) const {
35 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
36
37 if (parent_node_id_ >= 0) {
38 scoped_ptr<base::DictionaryValue> ref(new base::DictionaryValue());
39 ref->SetString("id_ref", base::StringPrintf("0x%x", parent_node_id_));
40 ref->SetString("scope", "FrameTreeNode");
41 value->Set("parent", std::move(ref));
42 }
43
44 scoped_ptr<base::DictionaryValue> ref(new base::DictionaryValue());
45 ref->SetInteger("pid_ref", process_id_);
46 ref->SetString("id_ref", base::StringPrintf("0x%x", routing_id_));
47 ref->SetString("scope", "RenderFrame");
48 value->Set("RenderFrame", std::move(ref));
49
50 value->SetString("url", url_);
51 std::string tmp;
52 base::JSONWriter::Write(*value, &tmp);
53 *out += tmp;
54 }
55
56 } // content
OLDNEW
« no previous file with comments | « content/browser/frame_host/traced_frame_tree_node.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698