blob: 74ed6ee2b256f6318586fc8577b3fd54eba0761b [file] [log] [blame]
skyostilb4cce1b2016-03-31 17:56:341// 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
7#include "base/trace_event/trace_event_argument.h"
8#include "content/renderer/render_frame_impl.h"
9#include "content/renderer/top_level_blame_context.h"
10#include "third_party/WebKit/public/platform/Platform.h"
11#include "third_party/WebKit/public/web/WebLocalFrame.h"
12
13namespace content {
14namespace {
15
16base::trace_event::BlameContext* GetParentBlameContext(
17 RenderFrameImpl* parent_frame) {
18 if (parent_frame)
19 return parent_frame->frameBlameContext();
20 return blink::Platform::current()->topLevelBlameContext();
21}
22
23} // namespace
24
25const char kFrameBlameContextCategory[] = "blink";
26const char kFrameBlameContextName[] = "FrameBlameContext";
27const char kFrameBlameContextType[] = "Frame";
28const char kFrameBlameContextScope[] = "RenderFrame";
29
30FrameBlameContext::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
39FrameBlameContext::~FrameBlameContext() {}
40
41} // namespace content