chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.h"

#include <utility>

#include "base/check.h"
#include "base/functional/bind.h"
#include "third_party/blink/public/common/frame/frame_owner_element_type.h"
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/frame.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/remote_frame.h"
#include "third_party/blink/renderer/core/html/html_frame_owner_element.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/scheduler/public/main_thread.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"

IframeAttributionData;
IframeAttributionDataPtr;
ProcessCoordinationUnit;
V8ContextDescription;
V8ContextDescriptionPtr;
V8ContextWorldType;

namespace WTF {

// Copies the data by move.
template <>
struct CrossThreadCopier<V8ContextDescriptionPtr>
    : public WTF::CrossThreadCopierByValuePassThrough<V8ContextDescriptionPtr> {};

// Copies the data by move.
template <>
struct CrossThreadCopier<IframeAttributionDataPtr>
    : public WTF::CrossThreadCopierByValuePassThrough<
          IframeAttributionDataPtr> {};

// Copies the data using the copy constructor.
template <>
struct CrossThreadCopier<blink::V8ContextToken>
    : public WTF::CrossThreadCopierPassThrough<blink::V8ContextToken> {};

}  // namespace WTF

namespace blink {

namespace {

// Determines if the given stable world ID is an extension world ID.
// Extensions IDs are 32-character strings containing characters in the range of
// 'a' to 'p', inclusive.
// TODO(chrisha): Lift this somewhere public and common in components/extensions
// and reuse it from there.
bool IsExtensionStableWorldId(const String& stable_world_id) {}

// Returns true if |owner| is an iframe, false otherwise.
// This will also return true for custom elements built on iframe, like
// <webview> and <guestview>. Since the renderer has no knowledge of these they
// must be filtered out on the browser side.
bool ShouldSendIframeNotificationsFor(const HTMLFrameOwnerElement& owner) {}

// If |frame| is a RemoteFrame with a local parent, returns the parent.
// Otherwise returns nullptr.
LocalFrame* GetLocalParentOfRemoteFrame(const Frame& frame) {}

IframeAttributionDataPtr AttributionDataForOwner(
    const HTMLFrameOwnerElement& owner) {}

}  // namespace

RendererResourceCoordinatorImpl::~RendererResourceCoordinatorImpl() = default;

// static
void RendererResourceCoordinatorImpl::MaybeInitialize() {}

void RendererResourceCoordinatorImpl::SetMainThreadTaskLoadIsLow(
    bool main_thread_task_load_is_low) {}

void RendererResourceCoordinatorImpl::OnScriptStateCreated(
    ScriptState* script_state,
    ExecutionContext* execution_context) {}

void RendererResourceCoordinatorImpl::OnScriptStateDetached(
    ScriptState* script_state) {}

void RendererResourceCoordinatorImpl::OnScriptStateDestroyed(
    ScriptState* script_state) {}

void RendererResourceCoordinatorImpl::OnBeforeContentFrameAttached(
    const Frame& frame,
    const HTMLFrameOwnerElement& owner) {}

void RendererResourceCoordinatorImpl::OnBeforeContentFrameDetached(
    const Frame& frame,
    const HTMLFrameOwnerElement& owner) {}

void RendererResourceCoordinatorImpl::FireBackgroundTracingTrigger(
    const String& trigger_name) {}

RendererResourceCoordinatorImpl::RendererResourceCoordinatorImpl(
    mojo::PendingRemote<ProcessCoordinationUnit> remote) {}

void RendererResourceCoordinatorImpl::DispatchOnV8ContextCreated(
    V8ContextDescriptionPtr v8_desc,
    IframeAttributionDataPtr iframe_attribution_data) {}

void RendererResourceCoordinatorImpl::DispatchOnV8ContextDetached(
    const blink::V8ContextToken& token) {}
void RendererResourceCoordinatorImpl::DispatchOnV8ContextDestroyed(
    const blink::V8ContextToken& token) {}

void RendererResourceCoordinatorImpl::DispatchFireBackgroundTracingTrigger(
    const String& trigger_name) {}

}  // namespace blink