#include "extensions/renderer/worker_thread_dispatcher.h"
#include <utility>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/no_destructor.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread_local.h"
#include "base/unguessable_token.h"
#include "base/values.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/worker_thread.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/mojom/event_dispatcher.mojom.h"
#include "extensions/renderer/api/messaging/native_renderer_messaging_service.h"
#include "extensions/renderer/dispatcher.h"
#include "extensions/renderer/extension_interaction_provider.h"
#include "extensions/renderer/extensions_renderer_client.h"
#include "extensions/renderer/native_extension_bindings_system.h"
#include "extensions/renderer/service_worker_data.h"
#include "extensions/renderer/worker_script_context_set.h"
#include "extensions/renderer/worker_thread_util.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace extensions {
namespace {
ABSL_CONST_INIT thread_local extensions::ServiceWorkerData*
service_worker_data = …;
ServiceWorkerData* GetServiceWorkerDataChecked() { … }
}
WorkerThreadDispatcher::WorkerThreadDispatcher() = default;
WorkerThreadDispatcher::~WorkerThreadDispatcher() = default;
WorkerThreadDispatcher* WorkerThreadDispatcher::Get() { … }
void WorkerThreadDispatcher::Init(content::RenderThread* render_thread) { … }
NativeExtensionBindingsSystem* WorkerThreadDispatcher::GetBindingsSystem() { … }
V8SchemaRegistry* WorkerThreadDispatcher::GetV8SchemaRegistry() { … }
ScriptContext* WorkerThreadDispatcher::GetScriptContext() { … }
ServiceWorkerData* WorkerThreadDispatcher::GetServiceWorkerData() { … }
void WorkerThreadDispatcher::UpdateBindingsOnWorkerThread(
const std::optional<ExtensionId>& extension_id) { … }
bool WorkerThreadDispatcher::UpdateBindingsForWorkers(
const ExtensionId& extension_id) { … }
void WorkerThreadDispatcher::UpdateAllServiceWorkerBindings() { … }
void WorkerThreadDispatcher::AddWorkerData(
blink::WebServiceWorkerContextProxy* proxy,
int64_t service_worker_version_id,
const std::optional<base::UnguessableToken>& activation_sequence,
const blink::ServiceWorkerToken& service_worker_token,
ScriptContext* script_context,
std::unique_ptr<NativeExtensionBindingsSystem> bindings_system) { … }
void WorkerThreadDispatcher::RemoveWorkerData(
int64_t service_worker_version_id) { … }
ScriptContextSetIterable* WorkerThreadDispatcher::GetScriptContextSet() { … }
bool WorkerThreadDispatcher::UpdateBindingsHelper(
const std::optional<ExtensionId>& extension_id) { … }
}