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

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

Issue 2116503004: Make Foreign Fetch an origin trial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check for correct RuntimeEnabledFeatures to determine which features were installed. Created 4 years, 4 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 19 matching lines...) Expand all
30 30
31 #include "web/ServiceWorkerGlobalScopeProxy.h" 31 #include "web/ServiceWorkerGlobalScopeProxy.h"
32 32
33 #include "bindings/core/v8/SourceLocation.h" 33 #include "bindings/core/v8/SourceLocation.h"
34 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" 34 #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
35 #include "core/dom/CrossThreadTask.h" 35 #include "core/dom/CrossThreadTask.h"
36 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
37 #include "core/dom/ExecutionContext.h" 37 #include "core/dom/ExecutionContext.h"
38 #include "core/dom/MessagePort.h" 38 #include "core/dom/MessagePort.h"
39 #include "core/inspector/ConsoleMessage.h" 39 #include "core/inspector/ConsoleMessage.h"
40 #include "core/origin_trials/OriginTrials.h"
40 #include "core/workers/WorkerGlobalScope.h" 41 #include "core/workers/WorkerGlobalScope.h"
41 #include "core/workers/WorkerThread.h" 42 #include "core/workers/WorkerThread.h"
42 #include "modules/background_sync/SyncEvent.h" 43 #include "modules/background_sync/SyncEvent.h"
43 #include "modules/fetch/Headers.h" 44 #include "modules/fetch/Headers.h"
44 #include "modules/notifications/Notification.h" 45 #include "modules/notifications/Notification.h"
45 #include "modules/notifications/NotificationEvent.h" 46 #include "modules/notifications/NotificationEvent.h"
46 #include "modules/notifications/NotificationEventInit.h" 47 #include "modules/notifications/NotificationEventInit.h"
47 #include "modules/push_messaging/PushEvent.h" 48 #include "modules/push_messaging/PushEvent.h"
48 #include "modules/push_messaging/PushMessageData.h" 49 #include "modules/push_messaging/PushMessageData.h"
49 #include "modules/serviceworkers/ExtendableEvent.h" 50 #include "modules/serviceworkers/ExtendableEvent.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 respondWithObserver->didDispatchEvent(dispatchResult); 171 respondWithObserver->didDispatchEvent(dispatchResult);
171 // false is okay because waitUntil for foreign fetch event doesn't care 172 // false is okay because waitUntil for foreign fetch event doesn't care
172 // about the promise rejection or an uncaught runtime script error. 173 // about the promise rejection or an uncaught runtime script error.
173 waitUntilObserver->didDispatchEvent(false /* errorOccurred */); 174 waitUntilObserver->didDispatchEvent(false /* errorOccurred */);
174 } 175 }
175 176
176 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) 177 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID)
177 { 178 {
178 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Install, eventID); 179 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Install, eventID);
179 Event* event; 180 Event* event;
180 if (RuntimeEnabledFeatures::foreignFetchEnabled()) 181 if (OriginTrials::foreignFetchEnabled(workerGlobalScope()))
181 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni t(), observer); 182 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni t(), observer);
182 else 183 else
183 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent Init(), observer); 184 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent Init(), observer);
184 workerGlobalScope()->dispatchExtendableEvent(event, observer); 185 workerGlobalScope()->dispatchExtendableEvent(event, observer);
185 } 186 }
186 187
187 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID, int64_t notificationID, const WebNotificationData& data, int actionIndex) 188 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID, int64_t notificationID, const WebNotificationData& data, int actionIndex)
188 { 189 {
189 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::NotificationClick, eventID); 190 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::NotificationClick, eventID);
190 NotificationEventInit eventInit; 191 NotificationEventInit eventInit;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 return *m_document; 311 return *m_document;
311 } 312 }
312 313
313 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con st 314 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con st
314 { 315 {
315 DCHECK(m_workerGlobalScope); 316 DCHECK(m_workerGlobalScope);
316 return m_workerGlobalScope; 317 return m_workerGlobalScope;
317 } 318 }
318 319
319 } // namespace blink 320 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698