| Index: content/browser/shared_worker/shared_worker_host.cc
|
| diff --git a/content/browser/shared_worker/shared_worker_host.cc b/content/browser/shared_worker/shared_worker_host.cc
|
| index eb58399bc9466779b549c3e79d713419d1d328c3..50951446b7b1328ccc0a9dd274950f1aca6b6b3b 100644
|
| --- a/content/browser/shared_worker/shared_worker_host.cc
|
| +++ b/content/browser/shared_worker/shared_worker_host.cc
|
| @@ -4,15 +4,18 @@
|
|
|
| #include "content/browser/shared_worker/shared_worker_host.h"
|
|
|
| +#include "content/browser/devtools/shared_worker_devtools_manager.h"
|
| #include "content/browser/frame_host/render_frame_host_delegate.h"
|
| #include "content/browser/frame_host/render_frame_host_impl.h"
|
| #include "content/browser/message_port_service.h"
|
| #include "content/browser/shared_worker/shared_worker_instance.h"
|
| #include "content/browser/shared_worker/shared_worker_message_filter.h"
|
| +#include "content/browser/shared_worker/shared_worker_service_impl.h"
|
| #include "content/common/view_messages.h"
|
| #include "content/common/worker_messages.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/content_browser_client.h"
|
| +#include "content/public/browser/render_process_host.h"
|
| #include "content/public/common/content_client.h"
|
|
|
| namespace content {
|
| @@ -26,6 +29,27 @@ void WorkerCrashCallback(int render_process_unique_id, int render_frame_id) {
|
| host->delegate()->WorkerCrashed(host);
|
| }
|
|
|
| +void NotifyWorkerCreatedOnUI(int worker_process_id,
|
| + int worker_route_id,
|
| + const GURL& url,
|
| + const base::string16& name) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + SharedWorkerDevToolsManager::GetInstance()->WorkerCreated(
|
| + worker_process_id, worker_route_id, url, name);
|
| +}
|
| +
|
| +void NotifyWorkerScriptLoadedOnUI(int worker_process_id, int worker_route_id) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + SharedWorkerDevToolsManager::GetInstance()->WorkerContextStarted(
|
| + worker_process_id, worker_route_id);
|
| +}
|
| +
|
| +void NotifyWorkerDestroyedOnUI(int worker_process_id, int worker_route_id) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + SharedWorkerDevToolsManager::GetInstance()->WorkerDestroyed(worker_process_id,
|
| + worker_route_id);
|
| +}
|
| +
|
| } // namespace
|
|
|
| SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance)
|
| @@ -52,6 +76,13 @@ SharedWorkerHost::~SharedWorkerHost() {
|
| parent_iter->render_frame_id()));
|
| }
|
| }
|
| + BrowserThread::PostTask(
|
| + BrowserThread::UI,
|
| + FROM_HERE,
|
| + base::Bind(
|
| + &NotifyWorkerDestroyedOnUI, worker_process_id_, worker_route_id_));
|
| + SharedWorkerServiceImpl::GetInstance()->NotifyWorkerDestroyed(
|
| + worker_process_id_, worker_route_id_);
|
| }
|
|
|
| bool SharedWorkerHost::Send(IPC::Message* message) {
|
| @@ -66,8 +97,17 @@ void SharedWorkerHost::Init(SharedWorkerMessageFilter* filter) {
|
| CHECK(instance_);
|
| DCHECK(worker_route_id_ == MSG_ROUTING_NONE);
|
| container_render_filter_ = filter;
|
| + worker_process_id_ = filter->render_process_id();
|
| worker_route_id_ = filter->GetNextRoutingID();
|
|
|
| + BrowserThread::PostTask(BrowserThread::UI,
|
| + FROM_HERE,
|
| + base::Bind(&NotifyWorkerCreatedOnUI,
|
| + worker_process_id_,
|
| + worker_route_id_,
|
| + instance_->url(),
|
| + instance_->name()));
|
| +
|
| WorkerProcessMsg_CreateWorker_Params params;
|
| params.url = instance_->url();
|
| params.name = instance_->name();
|
| @@ -130,13 +170,15 @@ void SharedWorkerHost::WorkerContextClosed() {
|
| }
|
|
|
| void SharedWorkerHost::WorkerContextDestroyed() {
|
| - if (!instance_)
|
| - return;
|
| instance_.reset();
|
| }
|
|
|
| void SharedWorkerHost::WorkerScriptLoaded() {
|
| - // TODO(horo): implement this.
|
| + BrowserThread::PostTask(
|
| + BrowserThread::UI,
|
| + FROM_HERE,
|
| + base::Bind(
|
| + &NotifyWorkerScriptLoadedOnUI, worker_process_id_, worker_route_id_));
|
| }
|
|
|
| void SharedWorkerHost::WorkerScriptLoadFailed() {
|
|
|