| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/serviceworkers/RespondWithObserver.h" | 6 #include "modules/serviceworkers/RespondWithObserver.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptFunction.h" | 8 #include "bindings/core/v8/ScriptFunction.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 else | 56 else |
| 57 m_observer->responseWasFulfilled(value); | 57 m_observer->responseWasFulfilled(value); |
| 58 m_observer = nullptr; | 58 m_observer = nullptr; |
| 59 return value; | 59 return value; |
| 60 } | 60 } |
| 61 | 61 |
| 62 Member<RespondWithObserver> m_observer; | 62 Member<RespondWithObserver> m_observer; |
| 63 ResolveType m_resolveType; | 63 ResolveType m_resolveType; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 RespondWithObserver* RespondWithObserver::create(ExecutionContext* context, int
eventID) | 66 RespondWithObserver* RespondWithObserver::create(ExecutionContext* context, int
eventID, WebURLRequest::ServiceWorkerRequestMode requestMode) |
| 67 { | 67 { |
| 68 return new RespondWithObserver(context, eventID); | 68 return new RespondWithObserver(context, eventID, requestMode); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void RespondWithObserver::contextDestroyed() | 71 void RespondWithObserver::contextDestroyed() |
| 72 { | 72 { |
| 73 ContextLifecycleObserver::contextDestroyed(); | 73 ContextLifecycleObserver::contextDestroyed(); |
| 74 m_state = Done; | 74 m_state = Done; |
| 75 } | 75 } |
| 76 | 76 |
| 77 void RespondWithObserver::didDispatchEvent() | 77 void RespondWithObserver::didDispatchEvent() |
| 78 { | 78 { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 if (!V8Response::hasInstance(value.v8Value(), toIsolate(executionContext()))
) { | 113 if (!V8Response::hasInstance(value.v8Value(), toIsolate(executionContext()))
) { |
| 114 responseWasRejected(); | 114 responseWasRejected(); |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 WebServiceWorkerResponse webResponse; | 117 WebServiceWorkerResponse webResponse; |
| 118 V8Response::toImplWithTypeCheck(toIsolate(executionContext()), value.v8Value
())->populateWebServiceWorkerResponse(webResponse); | 118 V8Response::toImplWithTypeCheck(toIsolate(executionContext()), value.v8Value
())->populateWebServiceWorkerResponse(webResponse); |
| 119 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleFetchEven
t(m_eventID, webResponse); | 119 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleFetchEven
t(m_eventID, webResponse); |
| 120 m_state = Done; | 120 m_state = Done; |
| 121 } | 121 } |
| 122 | 122 |
| 123 RespondWithObserver::RespondWithObserver(ExecutionContext* context, int eventID) | 123 RespondWithObserver::RespondWithObserver(ExecutionContext* context, int eventID,
WebURLRequest::ServiceWorkerRequestMode requestMode) |
| 124 : ContextLifecycleObserver(context) | 124 : ContextLifecycleObserver(context) |
| 125 , m_eventID(eventID) | 125 , m_eventID(eventID) |
| 126 , m_requestMode(requestMode) |
| 126 , m_state(Initial) | 127 , m_state(Initial) |
| 127 { | 128 { |
| 128 } | 129 } |
| 129 | 130 |
| 130 } // namespace blink | 131 } // namespace blink |
| OLD | NEW |