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 ChangedVersionAttributesMask mask; | |
michaeln
2014/08/29 00:57:57
the 'change mask' seems out of place here? what's
nhiroki
2014/08/29 08:23:10
That makes sense. Removed the mask and made the di
| |
384 ServiceWorkerVersionAttributes attrs; | |
385 | |
386 if (registration->installing_version()) { | |
387 mask.add(ChangedVersionAttributesMask::INSTALLING_VERSION); | |
388 attrs.installing = handle->CreateServiceWorkerHandleAndPass( | |
389 registration->installing_version()); | |
390 } | |
391 if (registration->waiting_version()) { | |
392 mask.add(ChangedVersionAttributesMask::WAITING_VERSION); | |
393 attrs.waiting = handle->CreateServiceWorkerHandleAndPass( | |
394 registration->waiting_version()); | |
395 } | |
396 if (registration->active_version()) { | |
397 mask.add(ChangedVersionAttributesMask::ACTIVE_VERSION); | |
398 attrs.active = handle->CreateServiceWorkerHandleAndPass( | |
399 registration->active_version()); | |
400 } | |
401 attrs.changed_mask = mask.changed(); | |
402 | |
382 Send(new ServiceWorkerMsg_ServiceWorkerRegistered( | 403 Send(new ServiceWorkerMsg_ServiceWorkerRegistered( |
383 thread_id, request_id, info)); | 404 thread_id, request_id, info, attrs)); |
384 } | 405 } |
385 | 406 |
386 void ServiceWorkerDispatcherHost::OnWorkerReadyForInspection( | 407 void ServiceWorkerDispatcherHost::OnWorkerReadyForInspection( |
387 int embedded_worker_id) { | 408 int embedded_worker_id) { |
388 if (!GetContext()) | 409 if (!GetContext()) |
389 return; | 410 return; |
390 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); | 411 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); |
391 if (!registry->CanHandle(embedded_worker_id)) | 412 if (!registry->CanHandle(embedded_worker_id)) |
392 return; | 413 return; |
393 registry->OnWorkerReadyForInspection(render_process_id_, embedded_worker_id); | 414 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); | 564 status, &error_type, &error_message); |
544 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( | 565 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( |
545 thread_id, request_id, error_type, error_message)); | 566 thread_id, request_id, error_type, error_message)); |
546 } | 567 } |
547 | 568 |
548 ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() { | 569 ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() { |
549 return context_wrapper_->context(); | 570 return context_wrapper_->context(); |
550 } | 571 } |
551 | 572 |
552 } // namespace content | 573 } // namespace content |
OLD | NEW |