Chromium Code Reviews| 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/service_worker_dispatcher_host.h" | 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/browser/message_port_message_filter.h" | 9 #include "content/browser/message_port_message_filter.h" |
| 10 #include "content/browser/message_port_service.h" | 10 #include "content/browser/message_port_service.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 386 void ServiceWorkerDispatcherHost::OnWorkerReadyForInspection( | 386 void ServiceWorkerDispatcherHost::OnWorkerReadyForInspection( |
| 387 int embedded_worker_id) { | 387 int embedded_worker_id) { |
| 388 if (!GetContext()) | 388 if (!GetContext()) |
| 389 return; | 389 return; |
| 390 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); | 390 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); |
| 391 if (!registry->CanHandle(embedded_worker_id)) | 391 if (!registry->CanHandle(embedded_worker_id)) |
| 392 return; | 392 return; |
| 393 registry->OnWorkerReadyForInspection(render_process_id_, embedded_worker_id); | 393 registry->OnWorkerReadyForInspection(render_process_id_, embedded_worker_id); |
| 394 } | 394 } |
| 395 | 395 |
| 396 void ServiceWorkerDispatcherHost::OnWorkerScriptLoaded(int embedded_worker_id) { | 396 void ServiceWorkerDispatcherHost::OnWorkerScriptLoaded( |
| 397 int embedded_worker_id, int thread_id) { | |
|
nasko
2014/08/26 15:58:24
style: if params are on new line, they should all
| |
| 397 if (!GetContext()) | 398 if (!GetContext()) |
| 398 return; | 399 return; |
| 399 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); | 400 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); |
| 400 if (!registry->CanHandle(embedded_worker_id)) | 401 if (!registry->CanHandle(embedded_worker_id)) |
| 401 return; | 402 return; |
| 402 registry->OnWorkerScriptLoaded(render_process_id_, embedded_worker_id); | 403 registry->OnWorkerScriptLoaded( |
| 404 render_process_id_, thread_id, embedded_worker_id); | |
| 403 } | 405 } |
| 404 | 406 |
| 405 void ServiceWorkerDispatcherHost::OnWorkerScriptLoadFailed( | 407 void ServiceWorkerDispatcherHost::OnWorkerScriptLoadFailed( |
| 406 int embedded_worker_id) { | 408 int embedded_worker_id) { |
| 407 if (!GetContext()) | 409 if (!GetContext()) |
| 408 return; | 410 return; |
| 409 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); | 411 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); |
| 410 if (!registry->CanHandle(embedded_worker_id)) | 412 if (!registry->CanHandle(embedded_worker_id)) |
| 411 return; | 413 return; |
| 412 registry->OnWorkerScriptLoadFailed(render_process_id_, embedded_worker_id); | 414 registry->OnWorkerScriptLoadFailed(render_process_id_, embedded_worker_id); |
| 413 } | 415 } |
| 414 | 416 |
| 415 void ServiceWorkerDispatcherHost::OnWorkerStarted( | 417 void ServiceWorkerDispatcherHost::OnWorkerStarted(int embedded_worker_id) { |
| 416 int thread_id, int embedded_worker_id) { | |
| 417 if (!GetContext()) | 418 if (!GetContext()) |
| 418 return; | 419 return; |
| 419 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); | 420 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); |
| 420 if (!registry->CanHandle(embedded_worker_id)) | 421 if (!registry->CanHandle(embedded_worker_id)) |
| 421 return; | 422 return; |
| 422 registry->OnWorkerStarted(render_process_id_, thread_id, embedded_worker_id); | 423 registry->OnWorkerStarted(render_process_id_, embedded_worker_id); |
| 423 } | 424 } |
| 424 | 425 |
| 425 void ServiceWorkerDispatcherHost::OnWorkerStopped(int embedded_worker_id) { | 426 void ServiceWorkerDispatcherHost::OnWorkerStopped(int embedded_worker_id) { |
| 426 if (!GetContext()) | 427 if (!GetContext()) |
| 427 return; | 428 return; |
| 428 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); | 429 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); |
| 429 if (!registry->CanHandle(embedded_worker_id)) | 430 if (!registry->CanHandle(embedded_worker_id)) |
| 430 return; | 431 return; |
| 431 registry->OnWorkerStopped(render_process_id_, embedded_worker_id); | 432 registry->OnWorkerStopped(render_process_id_, embedded_worker_id); |
| 432 } | 433 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 541 status, &error_type, &error_message); | 542 status, &error_type, &error_message); |
| 542 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( | 543 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( |
| 543 thread_id, request_id, error_type, error_message)); | 544 thread_id, request_id, error_type, error_message)); |
| 544 } | 545 } |
| 545 | 546 |
| 546 ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() { | 547 ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() { |
| 547 return context_wrapper_->context(); | 548 return context_wrapper_->context(); |
| 548 } | 549 } |
| 549 | 550 |
| 550 } // namespace content | 551 } // namespace content |
| OLD | NEW |