Commit 2cdf1f35 authored by Yuta Kitamura's avatar Yuta Kitamura Committed by Commit Bot

Document the usage of WindowAgent constructor correctly.

Originally WindowAgent's constructor's comment suggested it should
not be used, but nevertheless Document was using it. This CL updates
the comment and adds information about when it should be used.

Change-Id: Ia960af496bdea3fe7dbb0e07dc1f6a97cf64b760
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1809035Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Yuta Kitamura <yutak@chromium.org>
Auto-Submit: Yuta Kitamura <yutak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699226}
parent d9e2bee0
...@@ -23,9 +23,18 @@ class MutationObserverNotifier; ...@@ -23,9 +23,18 @@ class MutationObserverNotifier;
// shared by associated Documents. // shared by associated Documents.
class WindowAgent final : public Agent { class WindowAgent final : public Agent {
public: public:
// Do not create the instance directly. Use // Normally you don't want to call this constructor; instead, use
// WindowAgentFactory::GetAgentForOrigin() instead. // WindowAgentFactory::GetAgentForOrigin() so you can get the agent shared
// on the same-site frames.
//
// This constructor creates a unique agent that won't be shared with any
// other frames. Use this constructor only if:
// - You want your agent NOT shared with other (possibly same-site) frames
// (i.e. document-access feature policy is disabled), or
// - An appropriate instance of WindowAgentFactory is not available
// (this should only happen in tests).
explicit WindowAgent(v8::Isolate* isolate); explicit WindowAgent(v8::Isolate* isolate);
~WindowAgent() override; ~WindowAgent() override;
void Trace(blink::Visitor*) override; void Trace(blink::Visitor*) override;
......
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