| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/service_worker/embedded_worker_context_client.h" | 5 #include "content/renderer/service_worker/embedded_worker_context_client.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 DCHECK(!script_context_); | 147 DCHECK(!script_context_); |
| 148 | 148 |
| 149 Send(new EmbeddedWorkerHostMsg_WorkerScriptLoadFailed(embedded_worker_id_)); | 149 Send(new EmbeddedWorkerHostMsg_WorkerScriptLoadFailed(embedded_worker_id_)); |
| 150 | 150 |
| 151 RenderThreadImpl::current()->embedded_worker_dispatcher()-> | 151 RenderThreadImpl::current()->embedded_worker_dispatcher()-> |
| 152 WorkerContextDestroyed(embedded_worker_id_); | 152 WorkerContextDestroyed(embedded_worker_id_); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void EmbeddedWorkerContextClient::workerContextStarted( | 155 void EmbeddedWorkerContextClient::workerContextStarted( |
| 156 blink::WebServiceWorkerContextProxy* proxy) { | 156 blink::WebServiceWorkerContextProxy* proxy) { |
| 157 DCHECK(!worker_task_runner_); | 157 DCHECK(!worker_task_runner_.get()); |
| 158 worker_task_runner_ = new WorkerThreadTaskRunner( | 158 worker_task_runner_ = new WorkerThreadTaskRunner( |
| 159 WorkerTaskRunner::Instance()->CurrentWorkerId()); | 159 WorkerTaskRunner::Instance()->CurrentWorkerId()); |
| 160 DCHECK_NE(0, WorkerTaskRunner::Instance()->CurrentWorkerId()); | 160 DCHECK_NE(0, WorkerTaskRunner::Instance()->CurrentWorkerId()); |
| 161 // g_worker_client_tls.Pointer()->Get() could return NULL if this context | 161 // g_worker_client_tls.Pointer()->Get() could return NULL if this context |
| 162 // gets deleted before workerContextStarted() is called. | 162 // gets deleted before workerContextStarted() is called. |
| 163 DCHECK(g_worker_client_tls.Pointer()->Get() == NULL); | 163 DCHECK(g_worker_client_tls.Pointer()->Get() == NULL); |
| 164 DCHECK(!script_context_); | 164 DCHECK(!script_context_); |
| 165 g_worker_client_tls.Pointer()->Set(this); | 165 g_worker_client_tls.Pointer()->Set(this); |
| 166 script_context_.reset(new ServiceWorkerScriptContext(this, proxy)); | 166 script_context_.reset(new ServiceWorkerScriptContext(this, proxy)); |
| 167 | 167 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 } | 327 } |
| 328 | 328 |
| 329 void EmbeddedWorkerContextClient::SendWorkerStarted() { | 329 void EmbeddedWorkerContextClient::SendWorkerStarted() { |
| 330 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 330 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 331 Send(new EmbeddedWorkerHostMsg_WorkerStarted( | 331 Send(new EmbeddedWorkerHostMsg_WorkerStarted( |
| 332 WorkerTaskRunner::Instance()->CurrentWorkerId(), | 332 WorkerTaskRunner::Instance()->CurrentWorkerId(), |
| 333 embedded_worker_id_)); | 333 embedded_worker_id_)); |
| 334 } | 334 } |
| 335 | 335 |
| 336 } // namespace content | 336 } // namespace content |
| OLD | NEW |