skyostil | b4cce1b | 2016-03-31 17:56:34 | [diff] [blame] | 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/renderer/frame_blame_context.h" |
| 6 | |
David 'Digit' Turner | ea07114 | 2018-10-29 15:38:12 | [diff] [blame] | 7 | #include "base/trace_event/traced_value.h" |
skyostil | b4cce1b | 2016-03-31 17:56:34 | [diff] [blame] | 8 | #include "content/renderer/render_frame_impl.h" |
| 9 | #include "content/renderer/top_level_blame_context.h" |
Blink Reformat | a30d423 | 2018-04-07 15:31:06 | [diff] [blame] | 10 | #include "third_party/blink/public/platform/platform.h" |
| 11 | #include "third_party/blink/public/web/web_local_frame.h" |
skyostil | b4cce1b | 2016-03-31 17:56:34 | [diff] [blame] | 12 | |
| 13 | namespace content { |
| 14 | namespace { |
| 15 | |
| 16 | base::trace_event::BlameContext* GetParentBlameContext( |
| 17 | RenderFrameImpl* parent_frame) { |
| 18 | if (parent_frame) |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 19 | return parent_frame->GetFrameBlameContext(); |
| 20 | return blink::Platform::Current()->GetTopLevelBlameContext(); |
skyostil | b4cce1b | 2016-03-31 17:56:34 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | } // namespace |
| 24 | |
| 25 | const char kFrameBlameContextCategory[] = "blink"; |
| 26 | const char kFrameBlameContextName[] = "FrameBlameContext"; |
xiaochengh | 9b9e5ba | 2016-05-27 01:13:01 | [diff] [blame] | 27 | const char kFrameBlameContextType[] = "RenderFrame"; |
skyostil | b4cce1b | 2016-03-31 17:56:34 | [diff] [blame] | 28 | const char kFrameBlameContextScope[] = "RenderFrame"; |
| 29 | |
| 30 | FrameBlameContext::FrameBlameContext(RenderFrameImpl* render_frame, |
| 31 | RenderFrameImpl* parent_frame) |
| 32 | : base::trace_event::BlameContext(kFrameBlameContextCategory, |
| 33 | kFrameBlameContextName, |
| 34 | kFrameBlameContextType, |
| 35 | kFrameBlameContextScope, |
| 36 | render_frame->GetRoutingID(), |
| 37 | GetParentBlameContext(parent_frame)) {} |
| 38 | |
| 39 | FrameBlameContext::~FrameBlameContext() {} |
| 40 | |
| 41 | } // namespace content |