Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: content/browser/service_worker/service_worker_version.cc

Issue 2496653002: Part 2 of base::IDMap refactor to eliminate IDMapOwnPointer/IDMapExternalPointer modes (Closed)
Patch Set: typedefs => using statements, update comments in base/id_map.h Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 event_type(event_type) {} 853 event_type(event_type) {}
854 854
855 ServiceWorkerVersion::PendingRequest::~PendingRequest() {} 855 ServiceWorkerVersion::PendingRequest::~PendingRequest() {}
856 856
857 ServiceWorkerVersion::BaseMojoServiceWrapper::BaseMojoServiceWrapper( 857 ServiceWorkerVersion::BaseMojoServiceWrapper::BaseMojoServiceWrapper(
858 ServiceWorkerVersion* worker, 858 ServiceWorkerVersion* worker,
859 const char* service_name) 859 const char* service_name)
860 : worker_(worker), service_name_(service_name) {} 860 : worker_(worker), service_name_(service_name) {}
861 861
862 ServiceWorkerVersion::BaseMojoServiceWrapper::~BaseMojoServiceWrapper() { 862 ServiceWorkerVersion::BaseMojoServiceWrapper::~BaseMojoServiceWrapper() {
863 IDMap<PendingRequest, IDMapOwnPointer>::iterator iter( 863 IDMap<std::unique_ptr<PendingRequest>>::iterator iter(
864 &worker_->pending_requests_); 864 &worker_->pending_requests_);
865 while (!iter.IsAtEnd()) { 865 while (!iter.IsAtEnd()) {
866 PendingRequest* request = iter.GetCurrentValue(); 866 PendingRequest* request = iter.GetCurrentValue();
867 if (request->mojo_service == service_name_) { 867 if (request->mojo_service == service_name_) {
868 TRACE_EVENT_ASYNC_END1("ServiceWorker", "ServiceWorkerVersion::Request", 868 TRACE_EVENT_ASYNC_END1("ServiceWorker", "ServiceWorkerVersion::Request",
869 request, "Error", "Service Disconnected"); 869 request, "Error", "Service Disconnected");
870 request->error_callback.Run(SERVICE_WORKER_ERROR_FAILED); 870 request->error_callback.Run(SERVICE_WORKER_ERROR_FAILED);
871 worker_->pending_requests_.Remove(iter.GetCurrentKey()); 871 worker_->pending_requests_.Remove(iter.GetCurrentKey());
872 } 872 }
873 iter.Advance(); 873 iter.Advance();
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 1820
1821 if (!should_restart) { 1821 if (!should_restart) {
1822 // Let all start callbacks fail. 1822 // Let all start callbacks fail.
1823 FinishStartWorker(DeduceStartWorkerFailureReason( 1823 FinishStartWorker(DeduceStartWorkerFailureReason(
1824 SERVICE_WORKER_ERROR_START_WORKER_FAILED)); 1824 SERVICE_WORKER_ERROR_START_WORKER_FAILED));
1825 } 1825 }
1826 1826
1827 // Let all message callbacks fail (this will also fire and clear all 1827 // Let all message callbacks fail (this will also fire and clear all
1828 // callbacks for events). 1828 // callbacks for events).
1829 // TODO(kinuko): Consider if we want to add queue+resend mechanism here. 1829 // TODO(kinuko): Consider if we want to add queue+resend mechanism here.
1830 IDMap<PendingRequest, IDMapOwnPointer>::iterator iter(&pending_requests_); 1830 IDMap<std::unique_ptr<PendingRequest>>::iterator iter(&pending_requests_);
1831 while (!iter.IsAtEnd()) { 1831 while (!iter.IsAtEnd()) {
1832 TRACE_EVENT_ASYNC_END1("ServiceWorker", "ServiceWorkerVersion::Request", 1832 TRACE_EVENT_ASYNC_END1("ServiceWorker", "ServiceWorkerVersion::Request",
1833 iter.GetCurrentValue(), "Error", "Worker Stopped"); 1833 iter.GetCurrentValue(), "Error", "Worker Stopped");
1834 iter.GetCurrentValue()->error_callback.Run(SERVICE_WORKER_ERROR_FAILED); 1834 iter.GetCurrentValue()->error_callback.Run(SERVICE_WORKER_ERROR_FAILED);
1835 iter.Advance(); 1835 iter.Advance();
1836 } 1836 }
1837 pending_requests_.Clear(); 1837 pending_requests_.Clear();
1838 external_request_uuid_to_request_id_.clear(); 1838 external_request_uuid_to_request_id_.clear();
1839 event_dispatcher_.reset(); 1839 event_dispatcher_.reset();
1840 1840
(...skipping 27 matching lines...) Expand all
1868 1868
1869 void ServiceWorkerVersion::CleanUpExternalRequest( 1869 void ServiceWorkerVersion::CleanUpExternalRequest(
1870 const std::string& request_uuid, 1870 const std::string& request_uuid,
1871 ServiceWorkerStatusCode status) { 1871 ServiceWorkerStatusCode status) {
1872 if (status == SERVICE_WORKER_OK) 1872 if (status == SERVICE_WORKER_OK)
1873 return; 1873 return;
1874 external_request_uuid_to_request_id_.erase(request_uuid); 1874 external_request_uuid_to_request_id_.erase(request_uuid);
1875 } 1875 }
1876 1876
1877 } // namespace content 1877 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_version.h ('k') | content/child/appcache/web_application_cache_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698