#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 {
template <>
struct CrossThreadCopier<V8ContextDescriptionPtr>
: public WTF::CrossThreadCopierByValuePassThrough<V8ContextDescriptionPtr> { … };
template <>
struct CrossThreadCopier<IframeAttributionDataPtr>
: public WTF::CrossThreadCopierByValuePassThrough<
IframeAttributionDataPtr> { … };
template <>
struct CrossThreadCopier<blink::V8ContextToken>
: public WTF::CrossThreadCopierPassThrough<blink::V8ContextToken> { … };
}
namespace blink {
namespace {
bool IsExtensionStableWorldId(const String& stable_world_id) { … }
bool ShouldSendIframeNotificationsFor(const HTMLFrameOwnerElement& owner) { … }
LocalFrame* GetLocalParentOfRemoteFrame(const Frame& frame) { … }
IframeAttributionDataPtr AttributionDataForOwner(
const HTMLFrameOwnerElement& owner) { … }
}
RendererResourceCoordinatorImpl::~RendererResourceCoordinatorImpl() = default;
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) { … }
}