OLD | NEW |
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 ASSERT(m_workerGlobalScope); | 94 ASSERT(m_workerGlobalScope); |
95 RespondWithObserver* observer = RespondWithObserver::create(m_workerGlobalSc
ope, eventID, webRequest.mode(), webRequest.frameType()); | 95 RespondWithObserver* observer = RespondWithObserver::create(m_workerGlobalSc
ope, eventID, webRequest.mode(), webRequest.frameType()); |
96 bool defaultPrevented = false; | 96 bool defaultPrevented = false; |
97 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) { | 97 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) { |
98 observer->didDispatchEvent(defaultPrevented); | 98 observer->didDispatchEvent(defaultPrevented); |
99 return; | 99 return; |
100 } | 100 } |
101 | 101 |
102 Request* request = Request::create(m_workerGlobalScope, webRequest); | 102 Request* request = Request::create(m_workerGlobalScope, webRequest); |
103 request->headers()->setGuard(Headers::ImmutableGuard); | 103 request->headers()->setGuard(Headers::ImmutableGuard); |
104 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(observer, reque
st)); | 104 FetchEventInit eventInit; |
105 fetchEvent->setIsReload(webRequest.isReload()); | 105 eventInit.setRequest(request); |
| 106 eventInit.setIsReload(webRequest.isReload()); |
| 107 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames:
:fetch, eventInit, observer)); |
106 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release())
; | 108 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release())
; |
107 observer->didDispatchEvent(defaultPrevented); | 109 observer->didDispatchEvent(defaultPrevented); |
108 } | 110 } |
109 | 111 |
110 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof
encingEventType eventType, const WebString& regionID, const WebCircularGeofencin
gRegion& region) | 112 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof
encingEventType eventType, const WebString& regionID, const WebCircularGeofencin
gRegion& region) |
111 { | 113 { |
112 ASSERT(m_workerGlobalScope); | 114 ASSERT(m_workerGlobalScope); |
113 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT
ypeNames::geofenceenter : EventTypeNames::geofenceleave; | 115 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT
ypeNames::geofenceenter : EventTypeNames::geofenceleave; |
114 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C
ircularGeofencingRegion::create(regionID, region))); | 116 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C
ircularGeofencingRegion::create(regionID, region))); |
115 } | 117 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 234 |
233 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 235 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
234 : m_embeddedWorker(embeddedWorker) | 236 : m_embeddedWorker(embeddedWorker) |
235 , m_document(document) | 237 , m_document(document) |
236 , m_client(client) | 238 , m_client(client) |
237 , m_workerGlobalScope(0) | 239 , m_workerGlobalScope(0) |
238 { | 240 { |
239 } | 241 } |
240 | 242 |
241 } // namespace blink | 243 } // namespace blink |
OLD | NEW |