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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 FindRegistrationHandle(provider_id, registration_id); | 369 FindRegistrationHandle(provider_id, registration_id); |
370 ServiceWorkerRegistrationObjectInfo info; | 370 ServiceWorkerRegistrationObjectInfo info; |
371 if (handle) { | 371 if (handle) { |
372 handle->IncrementRefCount(); | 372 handle->IncrementRefCount(); |
373 info = handle->GetObjectInfo(); | 373 info = handle->GetObjectInfo(); |
374 } else { | 374 } else { |
375 scoped_ptr<ServiceWorkerRegistrationHandle> new_handle( | 375 scoped_ptr<ServiceWorkerRegistrationHandle> new_handle( |
376 new ServiceWorkerRegistrationHandle( | 376 new ServiceWorkerRegistrationHandle( |
377 GetContext()->AsWeakPtr(), this, provider_id, registration)); | 377 GetContext()->AsWeakPtr(), this, provider_id, registration)); |
378 info = new_handle->GetObjectInfo(); | 378 info = new_handle->GetObjectInfo(); |
| 379 handle = new_handle.get(); |
379 RegisterServiceWorkerRegistrationHandle(new_handle.Pass()); | 380 RegisterServiceWorkerRegistrationHandle(new_handle.Pass()); |
380 } | 381 } |
381 | 382 |
| 383 ServiceWorkerVersionAttributes attrs; |
| 384 attrs.installing = handle->CreateServiceWorkerHandleAndPass( |
| 385 registration->installing_version()); |
| 386 attrs.waiting = handle->CreateServiceWorkerHandleAndPass( |
| 387 registration->waiting_version()); |
| 388 attrs.active = handle->CreateServiceWorkerHandleAndPass( |
| 389 registration->active_version()); |
| 390 |
382 Send(new ServiceWorkerMsg_ServiceWorkerRegistered( | 391 Send(new ServiceWorkerMsg_ServiceWorkerRegistered( |
383 thread_id, request_id, info)); | 392 thread_id, request_id, info, attrs)); |
384 } | 393 } |
385 | 394 |
386 void ServiceWorkerDispatcherHost::OnWorkerReadyForInspection( | 395 void ServiceWorkerDispatcherHost::OnWorkerReadyForInspection( |
387 int embedded_worker_id) { | 396 int embedded_worker_id) { |
388 if (!GetContext()) | 397 if (!GetContext()) |
389 return; | 398 return; |
390 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); | 399 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); |
391 if (!registry->CanHandle(embedded_worker_id)) | 400 if (!registry->CanHandle(embedded_worker_id)) |
392 return; | 401 return; |
393 registry->OnWorkerReadyForInspection(render_process_id_, embedded_worker_id); | 402 registry->OnWorkerReadyForInspection(render_process_id_, embedded_worker_id); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 status, &error_type, &error_message); | 552 status, &error_type, &error_message); |
544 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( | 553 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( |
545 thread_id, request_id, error_type, error_message)); | 554 thread_id, request_id, error_type, error_message)); |
546 } | 555 } |
547 | 556 |
548 ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() { | 557 ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() { |
549 return context_wrapper_->context(); | 558 return context_wrapper_->context(); |
550 } | 559 } |
551 | 560 |
552 } // namespace content | 561 } // namespace content |
OLD | NEW |