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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 FROM_HERE, | 187 FROM_HERE, |
188 base::Bind(&EmbeddedWorkerContextClient::SendWorkerStarted, | 188 base::Bind(&EmbeddedWorkerContextClient::SendWorkerStarted, |
189 weak_factory_.GetWeakPtr())); | 189 weak_factory_.GetWeakPtr())); |
190 TRACE_EVENT_ASYNC_STEP_INTO0( | 190 TRACE_EVENT_ASYNC_STEP_INTO0( |
191 "ServiceWorker", | 191 "ServiceWorker", |
192 "EmbeddedWorkerContextClient::StartingWorkerContext", | 192 "EmbeddedWorkerContextClient::StartingWorkerContext", |
193 this, | 193 this, |
194 "ExecuteScript"); | 194 "ExecuteScript"); |
195 } | 195 } |
196 | 196 |
| 197 void EmbeddedWorkerContextClient::didEvaluateWorkerScript(bool success) { |
| 198 Send(new EmbeddedWorkerHostMsg_WorkerScriptEvaluated( |
| 199 embedded_worker_id_, success)); |
| 200 } |
| 201 |
197 void EmbeddedWorkerContextClient::willDestroyWorkerContext() { | 202 void EmbeddedWorkerContextClient::willDestroyWorkerContext() { |
198 // At this point OnWorkerRunLoopStopped is already called, so | 203 // At this point OnWorkerRunLoopStopped is already called, so |
199 // worker_task_runner_->RunsTasksOnCurrentThread() returns false | 204 // worker_task_runner_->RunsTasksOnCurrentThread() returns false |
200 // (while we're still on the worker thread). | 205 // (while we're still on the worker thread). |
201 script_context_.reset(); | 206 script_context_.reset(); |
202 | 207 |
203 // This also lets the message filter stop dispatching messages to | 208 // This also lets the message filter stop dispatching messages to |
204 // this client. | 209 // this client. |
205 g_worker_client_tls.Pointer()->Set(NULL); | 210 g_worker_client_tls.Pointer()->Set(NULL); |
206 } | 211 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 365 |
361 void EmbeddedWorkerContextClient::SendWorkerStarted() { | 366 void EmbeddedWorkerContextClient::SendWorkerStarted() { |
362 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 367 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
363 TRACE_EVENT_ASYNC_END0("ServiceWorker", | 368 TRACE_EVENT_ASYNC_END0("ServiceWorker", |
364 "EmbeddedWorkerContextClient::StartingWorkerContext", | 369 "EmbeddedWorkerContextClient::StartingWorkerContext", |
365 this); | 370 this); |
366 Send(new EmbeddedWorkerHostMsg_WorkerStarted(embedded_worker_id_)); | 371 Send(new EmbeddedWorkerHostMsg_WorkerStarted(embedded_worker_id_)); |
367 } | 372 } |
368 | 373 |
369 } // namespace content | 374 } // namespace content |
OLD | NEW |