summaryrefslogtreecommitdiff
path: root/chromium/content/renderer/frame_blame_context.cc
blob: ae48d17e1cc5a79e52269fcbfb0ed8832607d011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// 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.

#include "content/renderer/frame_blame_context.h"

#include "base/trace_event/traced_value.h"
#include "content/renderer/render_frame_impl.h"
#include "content/renderer/top_level_blame_context.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/web/web_local_frame.h"

namespace content {
namespace {

base::trace_event::BlameContext* GetParentBlameContext(
    RenderFrameImpl* parent_frame) {
  if (parent_frame)
    return parent_frame->GetFrameBlameContext();
  return blink::Platform::Current()->GetTopLevelBlameContext();
}

}  // namespace

const char kFrameBlameContextCategory[] = "blink";
const char kFrameBlameContextName[] = "FrameBlameContext";
const char kFrameBlameContextType[] = "RenderFrame";
const char kFrameBlameContextScope[] = "RenderFrame";

FrameBlameContext::FrameBlameContext(RenderFrameImpl* render_frame,
                                     RenderFrameImpl* parent_frame)
    : base::trace_event::BlameContext(kFrameBlameContextCategory,
                                      kFrameBlameContextName,
                                      kFrameBlameContextType,
                                      kFrameBlameContextScope,
                                      render_frame->GetRoutingID(),
                                      GetParentBlameContext(parent_frame)) {}

FrameBlameContext::~FrameBlameContext() {}

}  // namespace content