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

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

Issue 2534403002: [ServiceWorker] Mojofy extendable message event. (Closed)
Patch Set: Fix win build 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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 // running status can be STARTING here. 1066 // running status can be STARTING here.
1067 if (running_status() != EmbeddedWorkerStatus::STARTING && 1067 if (running_status() != EmbeddedWorkerStatus::STARTING &&
1068 running_status() != EmbeddedWorkerStatus::RUNNING) { 1068 running_status() != EmbeddedWorkerStatus::RUNNING) {
1069 return; 1069 return;
1070 } 1070 }
1071 1071
1072 embedded_worker_->SendMessage( 1072 embedded_worker_->SendMessage(
1073 ServiceWorkerMsg_DidGetClients(request_id, *clients)); 1073 ServiceWorkerMsg_DidGetClients(request_id, *clients));
1074 } 1074 }
1075 1075
1076 void ServiceWorkerVersion::OnSimpleEventFinished(
1077 int request_id,
1078 ServiceWorkerStatusCode status,
1079 base::Time dispatch_event_time) {
1080 // Copy error callback before calling FinishRequest.
1081 PendingRequest* request = pending_requests_.Lookup(request_id);
1082 DCHECK(request) << "Invalid request id";
1083 StatusCallback callback = request->error_callback;
1084
1085 FinishRequest(request_id, status == SERVICE_WORKER_OK, dispatch_event_time);
1086
1087 callback.Run(status);
1088 }
1089
1076 void ServiceWorkerVersion::OnSimpleEventResponse( 1090 void ServiceWorkerVersion::OnSimpleEventResponse(
shimazu 2016/12/02 04:00:33 How about deduping the codes by calling OnSimpleEv
leonhsl(Using Gerrit) 2016/12/02 08:36:44 Acknowledged.
leonhsl(Using Gerrit) 2016/12/02 15:43:27 Put the duplicated codes into OnSimpleEventFinishe
shimazu 2016/12/05 03:40:21 Thanks, I could understand why the names are diffe
1077 int request_id, 1091 int request_id,
1078 blink::WebServiceWorkerEventResult result, 1092 blink::WebServiceWorkerEventResult result,
1079 base::Time dispatch_event_time) { 1093 base::Time dispatch_event_time) {
1080 // Copy error callback before calling FinishRequest. 1094 // Copy error callback before calling FinishRequest.
1081 PendingRequest* request = pending_requests_.Lookup(request_id); 1095 PendingRequest* request = pending_requests_.Lookup(request_id);
1082 DCHECK(request) << "Invalid request id"; 1096 DCHECK(request) << "Invalid request id";
1083 StatusCallback callback = request->error_callback; 1097 StatusCallback callback = request->error_callback;
1084 1098
1085 FinishRequest(request_id, 1099 FinishRequest(request_id,
1086 result == blink::WebServiceWorkerEventResultCompleted, 1100 result == blink::WebServiceWorkerEventResultCompleted,
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 1882
1869 void ServiceWorkerVersion::CleanUpExternalRequest( 1883 void ServiceWorkerVersion::CleanUpExternalRequest(
1870 const std::string& request_uuid, 1884 const std::string& request_uuid,
1871 ServiceWorkerStatusCode status) { 1885 ServiceWorkerStatusCode status) {
1872 if (status == SERVICE_WORKER_OK) 1886 if (status == SERVICE_WORKER_OK)
1873 return; 1887 return;
1874 external_request_uuid_to_request_id_.erase(request_uuid); 1888 external_request_uuid_to_request_id_.erase(request_uuid);
1875 } 1889 }
1876 1890
1877 } // namespace content 1891 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698