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

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

Issue 1406823002: Start of foreign fetch implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove blank line Created 5 years, 2 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "modules/navigatorconnect/CrossOriginServiceWorkerClient.h" 49 #include "modules/navigatorconnect/CrossOriginServiceWorkerClient.h"
50 #include "modules/navigatorconnect/ServicePortCollection.h" 50 #include "modules/navigatorconnect/ServicePortCollection.h"
51 #include "modules/navigatorconnect/WorkerNavigatorServices.h" 51 #include "modules/navigatorconnect/WorkerNavigatorServices.h"
52 #include "modules/notifications/Notification.h" 52 #include "modules/notifications/Notification.h"
53 #include "modules/notifications/NotificationEvent.h" 53 #include "modules/notifications/NotificationEvent.h"
54 #include "modules/notifications/NotificationEventInit.h" 54 #include "modules/notifications/NotificationEventInit.h"
55 #include "modules/push_messaging/PushEvent.h" 55 #include "modules/push_messaging/PushEvent.h"
56 #include "modules/push_messaging/PushMessageData.h" 56 #include "modules/push_messaging/PushMessageData.h"
57 #include "modules/serviceworkers/ExtendableEvent.h" 57 #include "modules/serviceworkers/ExtendableEvent.h"
58 #include "modules/serviceworkers/FetchEvent.h" 58 #include "modules/serviceworkers/FetchEvent.h"
59 #include "modules/serviceworkers/InstallEvent.h"
59 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" 60 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
60 #include "modules/serviceworkers/WaitUntilObserver.h" 61 #include "modules/serviceworkers/WaitUntilObserver.h"
61 #include "platform/RuntimeEnabledFeatures.h" 62 #include "platform/RuntimeEnabledFeatures.h"
62 #include "public/platform/WebCrossOriginServiceWorkerClient.h" 63 #include "public/platform/WebCrossOriginServiceWorkerClient.h"
63 #include "public/platform/modules/notifications/WebNotificationData.h" 64 #include "public/platform/modules/notifications/WebNotificationData.h"
64 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" 65 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h"
65 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" 66 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h"
66 #include "public/web/WebSerializedScriptValue.h" 67 #include "public/web/WebSerializedScriptValue.h"
67 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" 68 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h"
68 #include "web/WebEmbeddedWorkerImpl.h" 69 #include "web/WebEmbeddedWorkerImpl.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 { 116 {
116 ASSERT(m_workerGlobalScope); 117 ASSERT(m_workerGlobalScope);
117 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave; 118 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave;
118 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C ircularGeofencingRegion::create(regionID, region))); 119 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C ircularGeofencingRegion::create(regionID, region)));
119 } 120 }
120 121
121 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) 122 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID)
122 { 123 {
123 ASSERT(m_workerGlobalScope); 124 ASSERT(m_workerGlobalScope);
124 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope, WaitUntilObserver::Install, eventID); 125 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope, WaitUntilObserver::Install, eventID);
125 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::inst all, ExtendableEventInit(), observer)); 126 RefPtrWillBeRawPtr<Event> event;
127 if (RuntimeEnabledFeatures::foreignFetchEnabled()) {
128 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni t(), observer);
129 } else {
130 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent Init(), observer);
131 }
126 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); 132 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer);
127 } 133 }
128 134
129 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag e, const WebMessagePortChannelArray& webChannels) 135 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag e, const WebMessagePortChannelArray& webChannels)
130 { 136 {
131 ASSERT(m_workerGlobalScope); 137 ASSERT(m_workerGlobalScope);
132 138
133 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop e, webChannels); 139 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop e, webChannels);
134 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e); 140 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e);
135 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports, value)); 141 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports, value));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) 246 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client)
241 : m_embeddedWorker(embeddedWorker) 247 : m_embeddedWorker(embeddedWorker)
242 , m_document(document) 248 , m_document(document)
243 , m_documentURL(document.url().copy()) 249 , m_documentURL(document.url().copy())
244 , m_client(client) 250 , m_client(client)
245 , m_workerGlobalScope(nullptr) 251 , m_workerGlobalScope(nullptr)
246 { 252 {
247 } 253 }
248 254
249 } // namespace blink 255 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698