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

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

Issue 2628553002: ServiceWorker: OnSimpleEventFinished could be called after timed out (Closed)
Patch Set: Fix comments Created 3 years, 11 months 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 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 } 1104 }
1105 1105
1106 embedded_worker_->SendMessage( 1106 embedded_worker_->SendMessage(
1107 ServiceWorkerMsg_DidGetClients(request_id, *clients)); 1107 ServiceWorkerMsg_DidGetClients(request_id, *clients));
1108 } 1108 }
1109 1109
1110 void ServiceWorkerVersion::OnSimpleEventFinished( 1110 void ServiceWorkerVersion::OnSimpleEventFinished(
1111 int request_id, 1111 int request_id,
1112 ServiceWorkerStatusCode status, 1112 ServiceWorkerStatusCode status,
1113 base::Time dispatch_event_time) { 1113 base::Time dispatch_event_time) {
1114 PendingRequest* request = pending_requests_.Lookup(request_id);
1115 // |request| will be null when the request has been timed out.
1116 if (!request)
1117 return;
1114 // Copy error callback before calling FinishRequest. 1118 // Copy error callback before calling FinishRequest.
1115 PendingRequest* request = pending_requests_.Lookup(request_id);
1116 DCHECK(request) << "Invalid request id";
1117 StatusCallback callback = request->error_callback; 1119 StatusCallback callback = request->error_callback;
1118 1120
1119 FinishRequest(request_id, status == SERVICE_WORKER_OK, dispatch_event_time); 1121 FinishRequest(request_id, status == SERVICE_WORKER_OK, dispatch_event_time);
1120 1122
1121 callback.Run(status); 1123 callback.Run(status);
1122 } 1124 }
1123 1125
1124 void ServiceWorkerVersion::NotifyMainScriptRequestHandlerCreated() { 1126 void ServiceWorkerVersion::NotifyMainScriptRequestHandlerCreated() {
1125 main_script_request_handler_created_ = true; 1127 main_script_request_handler_created_ = true;
1126 } 1128 }
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 1926
1925 void ServiceWorkerVersion::CleanUpExternalRequest( 1927 void ServiceWorkerVersion::CleanUpExternalRequest(
1926 const std::string& request_uuid, 1928 const std::string& request_uuid,
1927 ServiceWorkerStatusCode status) { 1929 ServiceWorkerStatusCode status) {
1928 if (status == SERVICE_WORKER_OK) 1930 if (status == SERVICE_WORKER_OK)
1929 return; 1931 return;
1930 external_request_uuid_to_request_id_.erase(request_uuid); 1932 external_request_uuid_to_request_id_.erase(request_uuid);
1931 } 1933 }
1932 1934
1933 } // namespace content 1935 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698