| 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/browser/service_worker/embedded_worker_instance.h" | 5 #include "content/browser/service_worker/embedded_worker_instance.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 221 } |
| 222 instance->ProcessAllocated(params.Pass(), callback, process_id, status); | 222 instance->ProcessAllocated(params.Pass(), callback, process_id, status); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void EmbeddedWorkerInstance::ProcessAllocated( | 225 void EmbeddedWorkerInstance::ProcessAllocated( |
| 226 scoped_ptr<EmbeddedWorkerMsg_StartWorker_Params> params, | 226 scoped_ptr<EmbeddedWorkerMsg_StartWorker_Params> params, |
| 227 const StatusCallback& callback, | 227 const StatusCallback& callback, |
| 228 int process_id, | 228 int process_id, |
| 229 ServiceWorkerStatusCode status) { | 229 ServiceWorkerStatusCode status) { |
| 230 DCHECK_EQ(process_id_, -1); | 230 DCHECK_EQ(process_id_, -1); |
| 231 TRACE_EVENT_ASYNC_END1("ServiceWorker", |
| 232 "EmbeddedWorkerInstance::ProcessAllocate", |
| 233 params.get(), |
| 234 "Status", status); |
| 231 if (status != SERVICE_WORKER_OK) { | 235 if (status != SERVICE_WORKER_OK) { |
| 232 status_ = STOPPED; | 236 status_ = STOPPED; |
| 233 callback.Run(status); | 237 callback.Run(status); |
| 234 return; | 238 return; |
| 235 } | 239 } |
| 236 const int64 service_worker_version_id = params->service_worker_version_id; | 240 const int64 service_worker_version_id = params->service_worker_version_id; |
| 237 process_id_ = process_id; | 241 process_id_ = process_id; |
| 238 GURL script_url(params->script_url); | 242 GURL script_url(params->script_url); |
| 239 TRACE_EVENT_ASYNC_END1("ServiceWorker", | |
| 240 "EmbeddedWorkerInstance::ProcessAllocate", | |
| 241 params.get(), | |
| 242 "Status", status); | |
| 243 RegisterToWorkerDevToolsManager( | 243 RegisterToWorkerDevToolsManager( |
| 244 process_id, | 244 process_id, |
| 245 context_.get(), | 245 context_.get(), |
| 246 context_, | 246 context_, |
| 247 service_worker_version_id, | 247 service_worker_version_id, |
| 248 script_url, | 248 script_url, |
| 249 base::Bind(&EmbeddedWorkerInstance::SendStartWorker, | 249 base::Bind(&EmbeddedWorkerInstance::SendStartWorker, |
| 250 weak_factory_.GetWeakPtr(), | 250 weak_factory_.GetWeakPtr(), |
| 251 base::Passed(¶ms), | 251 base::Passed(¶ms), |
| 252 callback)); | 252 callback)); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 342 |
| 343 void EmbeddedWorkerInstance::AddListener(Listener* listener) { | 343 void EmbeddedWorkerInstance::AddListener(Listener* listener) { |
| 344 listener_list_.AddObserver(listener); | 344 listener_list_.AddObserver(listener); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void EmbeddedWorkerInstance::RemoveListener(Listener* listener) { | 347 void EmbeddedWorkerInstance::RemoveListener(Listener* listener) { |
| 348 listener_list_.RemoveObserver(listener); | 348 listener_list_.RemoveObserver(listener); |
| 349 } | 349 } |
| 350 | 350 |
| 351 } // namespace content | 351 } // namespace content |
| OLD | NEW |