Commit 6310a9b2 authored by Chris Hamilton's avatar Chris Hamilton Committed by Commit Bot

Add LocalFrameToken to LocalDOMWindow.

This will be used to determine the attribution context for the
performance.measureMemory API.

BUG=1085129

Change-Id: Ia901dcc73e689984c3714c94f624dfb90b85c5fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2332331Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Chris Hamilton <chrisha@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794798}
parent 99d9a6be
......@@ -240,7 +240,8 @@ LocalDOMWindow::LocalDOMWindow(LocalFrame& frame, WindowAgent* agent)
MakeGarbageCollected<TextSuggestionController>(*this)),
isolated_world_csp_map_(
MakeGarbageCollected<
HeapHashMap<int, Member<ContentSecurityPolicy>>>()) {}
HeapHashMap<int, Member<ContentSecurityPolicy>>>()),
token_(LocalFrameToken(frame.GetFrameToken())) {}
void LocalDOMWindow::BindContentSecurityPolicy() {
DCHECK(!GetContentSecurityPolicy()->IsBound());
......
......@@ -29,6 +29,7 @@
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/document.h"
......@@ -104,9 +105,16 @@ class CORE_EXPORT LocalDOMWindow final : public DOMWindow,
static LocalDOMWindow* From(const ScriptState*);
explicit LocalDOMWindow(LocalFrame&, WindowAgent*);
LocalDOMWindow(LocalFrame&, WindowAgent*);
~LocalDOMWindow() override;
// Returns the token identifying the frame that this ExecutionContext was
// associated with at the moment of its creation. This remains valid even
// after the frame has been destroyed and the ExecutionContext is detached.
// This is used as a stable and persistent identifier for attributing detached
// context memory usage.
const LocalFrameToken& token() const { return token_; }
LocalFrame* GetFrame() const { return To<LocalFrame>(DOMWindow::GetFrame()); }
void Initialize();
......@@ -493,6 +501,11 @@ class CORE_EXPORT LocalDOMWindow final : public DOMWindow,
// document. This helps to count them only once per page load.
// We don't use std::bitset to avoid to include feature_policy.mojom-blink.h.
mutable Vector<bool> potentially_violated_features_;
// Token identifying the LocalFrame that this window was associated with at
// creation. Remains valid even after the frame is destroyed and the context
// is detached.
const LocalFrameToken token_;
};
template <>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment