Chromium Code Reviews| Index: content/browser/service_worker/embedded_worker_instance.cc |
| diff --git a/content/browser/service_worker/embedded_worker_instance.cc b/content/browser/service_worker/embedded_worker_instance.cc |
| index 24d2a9529a9843eb6dbf7c36e44efeabd748dd4d..d17c9736bde174a5e6adc135c13867df9f93960e 100644 |
| --- a/content/browser/service_worker/embedded_worker_instance.cc |
| +++ b/content/browser/service_worker/embedded_worker_instance.cc |
| @@ -4,8 +4,10 @@ |
| #include "content/browser/service_worker/embedded_worker_instance.h" |
| +#include "content/browser/devtools/embedded_worker_devtools_manager.h" |
| #include "content/browser/service_worker/embedded_worker_registry.h" |
| #include "content/common/service_worker/embedded_worker_messages.h" |
| +#include "content/public/browser/browser_thread.h" |
| #include "ipc/ipc_message.h" |
| #include "url/gurl.h" |
| @@ -19,6 +21,20 @@ struct SecondGreater { |
| return lhs.second > rhs.second; |
| } |
| }; |
| + |
| +void NotifyWorkerContextStartedOnUI(int worker_process_id, |
| + int worker_route_id) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + EmbeddedWorkerDevToolsManager::GetInstance()->WorkerContextStarted( |
| + worker_process_id, worker_route_id); |
| +} |
| + |
| +void NotifyWorkerDestroyedOnUI(int worker_process_id, int worker_route_id) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + EmbeddedWorkerDevToolsManager::GetInstance()->WorkerDestroyed( |
| + worker_process_id, worker_route_id); |
| +} |
|
kinuko
2014/05/02 11:12:45
This part... and GetRoutingIDAndNotifyWorkerCreate
horo
2014/05/07 08:34:44
Introduced DevToolsManagerBridge and moved DevTool
|
| + |
| } // namespace |
| EmbeddedWorkerInstance::~EmbeddedWorkerInstance() { |
| @@ -100,7 +116,13 @@ void EmbeddedWorkerInstance::RecordProcessId( |
| } |
| void EmbeddedWorkerInstance::OnScriptLoaded() { |
| - // TODO(horo): Implement this. |
| + if (worker_devtools_agent_route_id_ != MSG_ROUTING_NONE) { |
| + BrowserThread::PostTask(BrowserThread::UI, |
| + FROM_HERE, |
| + base::Bind(NotifyWorkerContextStartedOnUI, |
| + process_id_, |
| + worker_devtools_agent_route_id_)); |
| + } |
| } |
| void EmbeddedWorkerInstance::OnScriptLoadFailed() { |
| @@ -117,6 +139,13 @@ void EmbeddedWorkerInstance::OnStarted(int thread_id) { |
| } |
| void EmbeddedWorkerInstance::OnStopped() { |
| + if (worker_devtools_agent_route_id_ != MSG_ROUTING_NONE) { |
| + BrowserThread::PostTask(BrowserThread::UI, |
| + FROM_HERE, |
| + base::Bind(NotifyWorkerDestroyedOnUI, |
| + process_id_, |
| + worker_devtools_agent_route_id_)); |
| + } |
| status_ = STOPPED; |
| process_id_ = -1; |
| thread_id_ = -1; |