#include "third_party/blink/public/platform/platform.h"
#include <memory>
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_checker.h"
#include "base/trace_event/memory_dump_manager.h"
#include "build/build_config.h"
#include "components/viz/common/gpu/raster_context_provider.h"
#include "gpu/ipc/client/gpu_channel_host.h"
#include "media/base/media_log.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_fetch_handler_bypass_option.mojom-blink-forward.h"
#include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h"
#include "third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h"
#include "third_party/blink/public/platform/web_graphics_context_3d_provider.h"
#include "third_party/blink/public/platform/websocket_handshake_throttle.h"
#include "third_party/blink/renderer/platform/bindings/parkable_string_manager.h"
#include "third_party/blink/renderer/platform/font_family_names.h"
#include "third_party/blink/renderer/platform/fonts/font_cache_memory_dump_provider.h"
#include "third_party/blink/renderer/platform/geometry/length.h"
#include "third_party/blink/renderer/platform/graphics/parkable_image_manager.h"
#include "third_party/blink/renderer/platform/heap/blink_gc_memory_dump_provider.h"
#include "third_party/blink/renderer/platform/heap/process_heap.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/instrumentation/canvas_memory_dump_provider.h"
#include "third_party/blink/renderer/platform/instrumentation/instance_counters_memory_dump_provider.h"
#include "third_party/blink/renderer/platform/instrumentation/memory_pressure_listener.h"
#include "third_party/blink/renderer/platform/instrumentation/partition_alloc_memory_dump_provider.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/memory_cache_dump_provider.h"
#include "third_party/blink/renderer/platform/language.h"
#include "third_party/blink/renderer/platform/loader/fetch/url_loader/url_loader_factory.h"
#include "third_party/blink/renderer/platform/scheduler/common/simple_main_thread_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/dummy_schedulers.h"
#include "third_party/blink/renderer/platform/scheduler/public/main_thread.h"
#include "third_party/blink/renderer/platform/scheduler/public/non_main_thread.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/theme/web_theme_engine_helper.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/hash_map.h"
#include "third_party/webrtc/api/rtp_parameters.h"
#include "third_party/webrtc/p2p/base/port_allocator.h"
namespace blink {
namespace {
class DefaultBrowserInterfaceBrokerProxy
: public ThreadSafeBrowserInterfaceBrokerProxy { … };
class IdleDelayedTaskHelper : public base::SingleThreadTaskRunner { … };
}
static Platform* g_platform = …;
static bool did_initialize_blink_ = …;
Platform::Platform() = default;
Platform::~Platform() = default;
WebThemeEngine* Platform::ThemeEngine() { … }
void Platform::InitializeBlink() { … }
void Platform::InitializeMainThread(
Platform* platform,
scheduler::WebThreadScheduler* main_thread_scheduler) { … }
void Platform::CreateMainThreadAndInitialize(Platform* platform) { … }
void Platform::InitializeMainThreadCommon(
Platform* platform,
std::unique_ptr<MainThread> main_thread) { … }
void Platform::SetCurrentPlatformForTesting(Platform* platform) { … }
void Platform::CreateMainThreadForTesting() { … }
void Platform::SetMainThreadTaskRunnerForTesting() { … }
void Platform::UnsetMainThreadTaskRunnerForTesting() { … }
Platform* Platform::Current() { … }
std::unique_ptr<WebDedicatedWorkerHostFactoryClient>
Platform::CreateDedicatedWorkerHostFactoryClient(
WebDedicatedWorker*,
const BrowserInterfaceBrokerProxy&) { … }
void Platform::CreateServiceWorkerSubresourceLoaderFactory(
CrossVariantMojoRemote<mojom::ServiceWorkerContainerHostInterfaceBase>
service_worker_container_host,
const WebString& client_id,
std::unique_ptr<network::PendingSharedURLLoaderFactory> fallback_factory,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver,
scoped_refptr<base::SequencedTaskRunner> task_runner) { … }
ThreadSafeBrowserInterfaceBrokerProxy* Platform::GetBrowserInterfaceBroker() { … }
void Platform::CreateAndSetCompositorThread() { … }
scoped_refptr<base::SingleThreadTaskRunner>
Platform::CompositorThreadTaskRunner() { … }
std::unique_ptr<WebGraphicsContext3DProvider>
Platform::CreateOffscreenGraphicsContext3DProvider(
const Platform::ContextAttributes&,
const WebURL& document_url,
Platform::GraphicsInfo*) { … }
std::unique_ptr<WebGraphicsContext3DProvider>
Platform::CreateSharedOffscreenGraphicsContext3DProvider() { … }
std::unique_ptr<WebGraphicsContext3DProvider>
Platform::CreateWebGPUGraphicsContext3DProvider(const WebURL& document_url) { … }
void Platform::CreateWebGPUGraphicsContext3DProviderAsync(
const blink::WebURL& document_url,
base::OnceCallback<
void(std::unique_ptr<blink::WebGraphicsContext3DProvider>)> callback) { … }
scoped_refptr<viz::RasterContextProvider>
Platform::SharedMainThreadContextProvider() { … }
scoped_refptr<cc::RasterContextProviderWrapper>
Platform::SharedCompositorWorkerContextProvider(
cc::RasterDarkModeFilter* dark_mode_filter) { … }
scoped_refptr<gpu::GpuChannelHost> Platform::EstablishGpuChannelSync() { … }
bool Platform::IsGpuRemoteDisconnected() { … }
void Platform::EstablishGpuChannel(EstablishGpuChannelCallback callback) { … }
gfx::ColorSpace Platform::GetRenderingColorSpace() const { … }
std::unique_ptr<media::MediaLog> Platform::GetMediaLog(
MediaInspectorContext* inspector_context,
scoped_refptr<base::SingleThreadTaskRunner> owner_task_runner,
bool is_on_worker) { … }
size_t Platform::GetMaxDecodedImageBytes() { … }
}