Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
|
nasko
2016/03/02 00:20:20
Same here, 2016.
benjhayden
2016/03/02 18:53:03
Done.
| |
| 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 : parentNodeId_(-1), | |
| 18 url_(node.current_url().spec()), | |
| 19 processId_(-1), | |
| 20 routingId_(-1) { | |
| 21 FrameTreeNode* parent = node.parent(); | |
| 22 if (parent) | |
| 23 parentNodeId_ = parent->frame_tree_node_id(); | |
| 24 | |
| 25 RenderFrameHostImpl* current_frame_host = node.current_frame_host(); | |
| 26 if (current_frame_host) { | |
|
nasko
2016/03/02 00:20:20
There should always be a current_frame_host.
benjhayden
2016/03/02 18:53:03
Done.
| |
| 27 processId_ = current_frame_host->GetProcess()->GetHandle(); | |
| 28 routingId_ = current_frame_host->GetRoutingID(); | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 TracedFrameTreeNode::~TracedFrameTreeNode() { | |
| 33 } | |
| 34 | |
| 35 void TracedFrameTreeNode::AppendAsTraceFormat(std::string* out) const { | |
| 36 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | |
| 37 | |
| 38 if (parentNodeId_ >= 0) { | |
| 39 scoped_ptr<base::DictionaryValue> ref(new base::DictionaryValue()); | |
| 40 ref->SetString("id_ref", base::StringPrintf("0x%x", parentNodeId_)); | |
| 41 ref->SetString("scope", "FrameTreeNode"); | |
| 42 value->Set("parent", std::move(ref)); | |
| 43 } | |
| 44 | |
| 45 if (routingId_ >= 0) { | |
|
nasko
2016/03/02 00:20:20
routing_id != MSG_ROUTING_NONE is more correct com
benjhayden
2016/03/02 18:53:03
Done.
| |
| 46 scoped_ptr<base::DictionaryValue> ref(new base::DictionaryValue()); | |
| 47 ref->SetInteger("pid_ref", processId_); | |
| 48 ref->SetString("id_ref", base::StringPrintf("0x%x", routingId_)); | |
| 49 ref->SetString("scope", "RenderFrame"); | |
| 50 value->Set("RenderFrame", std::move(ref)); | |
| 51 } | |
| 52 | |
| 53 value->SetString("url", url_); | |
| 54 std::string tmp; | |
| 55 base::JSONWriter::Write(*value, &tmp); | |
| 56 *out += tmp; | |
| 57 } | |
| 58 | |
| 59 } // content | |
| OLD | NEW |