| 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/browser/message_port_message_filter.h" | 10 #include "content/browser/message_port_message_filter.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 } | 588 } |
| 589 handle->DecrementRefCount(); | 589 handle->DecrementRefCount(); |
| 590 if (handle->HasNoRefCount()) | 590 if (handle->HasNoRefCount()) |
| 591 registration_handles_.Remove(registration_handle_id); | 591 registration_handles_.Remove(registration_handle_id); |
| 592 } | 592 } |
| 593 | 593 |
| 594 void ServiceWorkerDispatcherHost::UnregistrationComplete( | 594 void ServiceWorkerDispatcherHost::UnregistrationComplete( |
| 595 int thread_id, | 595 int thread_id, |
| 596 int request_id, | 596 int request_id, |
| 597 ServiceWorkerStatusCode status) { | 597 ServiceWorkerStatusCode status) { |
| 598 if (status != SERVICE_WORKER_OK) { | 598 if (status != SERVICE_WORKER_OK && status != SERVICE_WORKER_ERROR_NOT_FOUND) { |
| 599 SendUnregistrationError(thread_id, request_id, status); | 599 SendUnregistrationError(thread_id, request_id, status); |
| 600 return; | 600 return; |
| 601 } | 601 } |
| 602 | 602 const bool is_success = (status == SERVICE_WORKER_OK); |
| 603 Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(thread_id, request_id)); | 603 Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(thread_id, |
| 604 request_id, |
| 605 is_success)); |
| 604 TRACE_EVENT_ASYNC_END1( | 606 TRACE_EVENT_ASYNC_END1( |
| 605 "ServiceWorker", | 607 "ServiceWorker", |
| 606 "ServiceWorkerDispatcherHost::UnregisterServiceWorker", | 608 "ServiceWorkerDispatcherHost::UnregisterServiceWorker", |
| 607 request_id, | 609 request_id, |
| 608 "Status", status); | 610 "Status", status); |
| 609 } | 611 } |
| 610 | 612 |
| 611 void ServiceWorkerDispatcherHost::SendRegistrationError( | 613 void ServiceWorkerDispatcherHost::SendRegistrationError( |
| 612 int thread_id, | 614 int thread_id, |
| 613 int request_id, | 615 int request_id, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 630 status, &error_type, &error_message); | 632 status, &error_type, &error_message); |
| 631 Send(new ServiceWorkerMsg_ServiceWorkerUnregistrationError( | 633 Send(new ServiceWorkerMsg_ServiceWorkerUnregistrationError( |
| 632 thread_id, request_id, error_type, error_message)); | 634 thread_id, request_id, error_type, error_message)); |
| 633 } | 635 } |
| 634 | 636 |
| 635 ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() { | 637 ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() { |
| 636 return context_wrapper_->context(); | 638 return context_wrapper_->context(); |
| 637 } | 639 } |
| 638 | 640 |
| 639 } // namespace content | 641 } // namespace content |
| OLD | NEW |