Index: third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp |
diff --git a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp |
index 33c956687c779ba06f83f2e461109465f8a48b37..7523950c9b1cbab0375af6df91a5c4454038a725 100644 |
--- a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp |
+++ b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp |
@@ -47,7 +47,6 @@ |
#include "core/workers/ParentFrameTaskRunners.h" |
#include "core/workers/SharedWorkerGlobalScope.h" |
#include "core/workers/SharedWorkerThread.h" |
-#include "core/workers/WorkerClients.h" |
#include "core/workers/WorkerContentSettingsClient.h" |
#include "core/workers/WorkerGlobalScope.h" |
#include "core/workers/WorkerInspectorProxy.h" |
@@ -78,21 +77,12 @@ |
namespace blink { |
-namespace { |
- |
-// Vector of callbacks for the OnScriptLoaderFinished method. |
-using WorkerClientsCreatedCallbackVector = |
- WTF::Vector<WebSharedWorkerImpl::WorkerClientsCreatedCallback>; |
-WorkerClientsCreatedCallbackVector& GetWorkerClientsCreatedCallbackVector() { |
- DEFINE_STATIC_LOCAL(WorkerClientsCreatedCallbackVector, callback_vector, ()); |
- return callback_vector; |
-} |
- |
-} // namespace |
- |
// TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as |
// possible. |
+template class CORE_TEMPLATE_EXPORT |
+ WorkerClientsInitializer<WebSharedWorkerImpl>; |
+ |
WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client) |
: web_view_(nullptr), |
main_frame_(nullptr), |
@@ -263,11 +253,6 @@ void WebSharedWorkerImpl::DidTerminateWorkerThread() { |
delete this; |
} |
-void WebSharedWorkerImpl::RegisterWorkerClientsCreatedCallback( |
- WorkerClientsCreatedCallback callback) { |
- GetWorkerClientsCreatedCallbackVector().push_back(callback); |
-} |
- |
void WebSharedWorkerImpl::Connect( |
std::unique_ptr<WebMessagePortChannel> web_channel) { |
DCHECK(IsMainThread()); |
@@ -338,10 +323,7 @@ void WebSharedWorkerImpl::OnScriptLoaderFinished() { |
SecurityOrigin* starter_origin = loading_document_->GetSecurityOrigin(); |
WorkerClients* worker_clients = WorkerClients::Create(); |
- DCHECK(!GetWorkerClientsCreatedCallbackVector().IsEmpty()); |
- for (auto& callback : GetWorkerClientsCreatedCallbackVector()) { |
- callback(worker_clients); |
- } |
+ WorkerClientsInitializer<WebSharedWorkerImpl>::Run(worker_clients); |
WebSecurityOrigin web_security_origin(loading_document_->GetSecurityOrigin()); |
ProvideContentSettingsClientToWorker( |