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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 ServiceWorker* source = ServiceWorker::from(m_workerGlobalScope->getExecutio
nContext(), adoptPtr(handle.release())); | 128 ServiceWorker* source = ServiceWorker::from(m_workerGlobalScope->getExecutio
nContext(), adoptPtr(handle.release())); |
129 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Message, eventID); | 129 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Message, eventID); |
130 | 130 |
131 Event* event = ExtendableMessageEvent::create(value, origin, ports, source,
observer); | 131 Event* event = ExtendableMessageEvent::create(value, origin, ports, source,
observer); |
132 workerGlobalScope()->dispatchExtendableEvent(event, observer); | 132 workerGlobalScope()->dispatchExtendableEvent(event, observer); |
133 } | 133 } |
134 | 134 |
135 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) | 135 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) |
136 { | 136 { |
137 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop
e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe
quest.requestContext()); | 137 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop
e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe
quest.requestContext()); |
138 Request* request = Request::create(workerGlobalScope(), webRequest); | 138 Request* request = Request::create(workerGlobalScope()->scriptController()->
getScriptState(), webRequest); |
139 request->getHeaders()->setGuard(Headers::ImmutableGuard); | 139 request->getHeaders()->setGuard(Headers::ImmutableGuard); |
140 FetchEventInit eventInit; | 140 FetchEventInit eventInit; |
141 eventInit.setCancelable(true); | 141 eventInit.setCancelable(true); |
142 eventInit.setRequest(request); | 142 eventInit.setRequest(request); |
143 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); | 143 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); |
144 eventInit.setIsReload(webRequest.isReload()); | 144 eventInit.setIsReload(webRequest.isReload()); |
145 FetchEvent* fetchEvent = FetchEvent::create(EventTypeNames::fetch, eventInit
, observer); | 145 FetchEvent* fetchEvent = FetchEvent::create(EventTypeNames::fetch, eventInit
, observer); |
146 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); | 146 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); |
147 observer->didDispatchEvent(dispatchResult); | 147 observer->didDispatchEvent(dispatchResult); |
148 } | 148 } |
149 | 149 |
150 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(int eventID, const
WebServiceWorkerRequest& webRequest) | 150 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(int eventID, const
WebServiceWorkerRequest& webRequest) |
151 { | 151 { |
152 ForeignFetchRespondWithObserver* observer = ForeignFetchRespondWithObserver:
:create(workerGlobalScope(), eventID, webRequest.url(), webRequest.mode(), webRe
quest.frameType(), webRequest.requestContext()); | 152 ForeignFetchRespondWithObserver* observer = ForeignFetchRespondWithObserver:
:create(workerGlobalScope(), eventID, webRequest.url(), webRequest.mode(), webRe
quest.frameType(), webRequest.requestContext()); |
153 Request* request = Request::create(workerGlobalScope(), webRequest); | 153 Request* request = Request::create(workerGlobalScope()->scriptController()->
getScriptState(), webRequest); |
154 request->getHeaders()->setGuard(Headers::ImmutableGuard); | 154 request->getHeaders()->setGuard(Headers::ImmutableGuard); |
155 ForeignFetchEventInit eventInit; | 155 ForeignFetchEventInit eventInit; |
156 eventInit.setCancelable(true); | 156 eventInit.setCancelable(true); |
157 eventInit.setRequest(request); | 157 eventInit.setRequest(request); |
158 ForeignFetchEvent* fetchEvent = ForeignFetchEvent::create(EventTypeNames::fo
reignfetch, eventInit, observer); | 158 ForeignFetchEvent* fetchEvent = ForeignFetchEvent::create(EventTypeNames::fo
reignfetch, eventInit, observer); |
159 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); | 159 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); |
160 observer->didDispatchEvent(dispatchResult); | 160 observer->didDispatchEvent(dispatchResult); |
161 } | 161 } |
162 | 162 |
163 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof
encingEventType eventType, const WebString& regionID, const WebCircularGeofencin
gRegion& region) | 163 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof
encingEventType eventType, const WebString& regionID, const WebCircularGeofencin
gRegion& region) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 return *m_document; | 296 return *m_document; |
297 } | 297 } |
298 | 298 |
299 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st | 299 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st |
300 { | 300 { |
301 DCHECK(m_workerGlobalScope); | 301 DCHECK(m_workerGlobalScope); |
302 return m_workerGlobalScope; | 302 return m_workerGlobalScope; |
303 } | 303 } |
304 | 304 |
305 } // namespace blink | 305 } // namespace blink |
OLD | NEW |