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

Side by Side Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 1763123002: [BackgroundSync] Remove BackgroundSyncRegistrationHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from PS6 Created 4 years, 9 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "modules/push_messaging/PushEvent.h" 53 #include "modules/push_messaging/PushEvent.h"
54 #include "modules/push_messaging/PushMessageData.h" 54 #include "modules/push_messaging/PushMessageData.h"
55 #include "modules/serviceworkers/ExtendableEvent.h" 55 #include "modules/serviceworkers/ExtendableEvent.h"
56 #include "modules/serviceworkers/ExtendableMessageEvent.h" 56 #include "modules/serviceworkers/ExtendableMessageEvent.h"
57 #include "modules/serviceworkers/FetchEvent.h" 57 #include "modules/serviceworkers/FetchEvent.h"
58 #include "modules/serviceworkers/InstallEvent.h" 58 #include "modules/serviceworkers/InstallEvent.h"
59 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" 59 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
60 #include "modules/serviceworkers/WaitUntilObserver.h" 60 #include "modules/serviceworkers/WaitUntilObserver.h"
61 #include "platform/RuntimeEnabledFeatures.h" 61 #include "platform/RuntimeEnabledFeatures.h"
62 #include "public/platform/WebCrossOriginServiceWorkerClient.h" 62 #include "public/platform/WebCrossOriginServiceWorkerClient.h"
63 #include "public/platform/modules/background_sync/WebSyncRegistration.h" 63 #include "public/platform/modules/background_sync/WebSyncRegistration.h"
iclelland 2016/03/11 14:50:12 I think we can probably get rid of this include as
jkarlin 2016/03/15 12:50:16 Done.
64 #include "public/platform/modules/notifications/WebNotificationData.h" 64 #include "public/platform/modules/notifications/WebNotificationData.h"
65 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" 65 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h"
66 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" 66 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h"
67 #include "public/web/WebSerializedScriptValue.h" 67 #include "public/web/WebSerializedScriptValue.h"
68 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" 68 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h"
69 #include "web/WebEmbeddedWorkerImpl.h" 69 #include "web/WebEmbeddedWorkerImpl.h"
70 #include "wtf/Assertions.h" 70 #include "wtf/Assertions.h"
71 #include "wtf/Functional.h" 71 #include "wtf/Functional.h"
72 #include "wtf/PassOwnPtr.h" 72 #include "wtf/PassOwnPtr.h"
73 73
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); 179 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer);
180 } 180 }
181 181
182 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString& origin, WebServicePortID portID) 182 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString& origin, WebServicePortID portID)
183 { 183 {
184 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback s); 184 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback s);
185 ServicePortCollection* collection = WorkerNavigatorServices::services(worker GlobalScope(), *workerGlobalScope()->navigator()); 185 ServicePortCollection* collection = WorkerNavigatorServices::services(worker GlobalScope(), *workerGlobalScope()->navigator());
186 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por tID); 186 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por tID);
187 } 187 }
188 188
189 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebSync Registration& registration, LastChanceOption lastChance) 189 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebStri ng& tag, LastChanceOption lastChance)
190 { 190 {
191 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { 191 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) {
192 ServiceWorkerGlobalScopeClient::from(workerGlobalScope())->didHandleSync Event(eventID, WebServiceWorkerEventResultCompleted); 192 ServiceWorkerGlobalScopeClient::from(workerGlobalScope())->didHandleSync Event(eventID, WebServiceWorkerEventResultCompleted);
193 return; 193 return;
194 } 194 }
195 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Sync, eventID); 195 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Sync, eventID);
196 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, regi stration.tag, lastChance == IsLastChance, observer)); 196 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, tag, lastChance == IsLastChance, observer));
197 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); 197 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer);
198 } 198 }
199 199
200 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa gePortChannelArray& webChannels) 200 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa gePortChannelArray& webChannels)
201 { 201 {
202 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope( ), webChannels); 202 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope( ), webChannels);
203 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e); 203 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e);
204 // FIXME: Have proper source for this MessageEvent. 204 // FIXME: Have proper source for this MessageEvent.
205 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value, webClient.origin.string()); 205 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value, webClient.origin.string());
206 event->setType(EventTypeNames::crossoriginmessage); 206 event->setType(EventTypeNames::crossoriginmessage);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 eventInit.setCancelable(true); 302 eventInit.setCancelable(true);
303 eventInit.setRequest(request); 303 eventInit.setRequest(request);
304 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq uest.clientId()); 304 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq uest.clientId());
305 eventInit.setIsReload(webRequest.isReload()); 305 eventInit.setIsReload(webRequest.isReload());
306 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName, eventInit, observer)); 306 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName, eventInit, observer));
307 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc hEvent.release()); 307 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc hEvent.release());
308 observer->didDispatchEvent(dispatchResult); 308 observer->didDispatchEvent(dispatchResult);
309 } 309 }
310 310
311 } // namespace blink 311 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698