| 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 "modules/serviceworkers/RespondWithObserver.h" | 5 #include "modules/serviceworkers/RespondWithObserver.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptFunction.h" | 7 #include "bindings/core/v8/ScriptFunction.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 { | 138 { |
| 139 return new RespondWithObserver(context, eventID, requestURL, requestMode, fr
ameType, requestContext); | 139 return new RespondWithObserver(context, eventID, requestURL, requestMode, fr
ameType, requestContext); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void RespondWithObserver::contextDestroyed() | 142 void RespondWithObserver::contextDestroyed() |
| 143 { | 143 { |
| 144 ContextLifecycleObserver::contextDestroyed(); | 144 ContextLifecycleObserver::contextDestroyed(); |
| 145 m_state = Done; | 145 m_state = Done; |
| 146 } | 146 } |
| 147 | 147 |
| 148 void RespondWithObserver::didDispatchEvent(bool defaultPrevented) | 148 void RespondWithObserver::didDispatchEvent(DispatchEventResult dispatchResult) |
| 149 { | 149 { |
| 150 ASSERT(executionContext()); | 150 ASSERT(executionContext()); |
| 151 if (m_state != Initial) | 151 if (m_state != Initial) |
| 152 return; | 152 return; |
| 153 | 153 |
| 154 if (defaultPrevented) { | 154 if (dispatchResult != DispatchEventResult::NotCanceled) { |
| 155 responseWasRejected(WebServiceWorkerResponseErrorDefaultPrevented); | 155 responseWasRejected(WebServiceWorkerResponseErrorDefaultPrevented); |
| 156 return; | 156 return; |
| 157 } | 157 } |
| 158 | 158 |
| 159 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleFetchEven
t(m_eventID); | 159 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleFetchEven
t(m_eventID); |
| 160 m_state = Done; | 160 m_state = Done; |
| 161 } | 161 } |
| 162 | 162 |
| 163 void RespondWithObserver::respondWith(ScriptState* scriptState, ScriptPromise sc
riptPromise, ExceptionState& exceptionState) | 163 void RespondWithObserver::respondWith(ScriptState* scriptState, ScriptPromise sc
riptPromise, ExceptionState& exceptionState) |
| 164 { | 164 { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 , m_state(Initial) | 260 , m_state(Initial) |
| 261 { | 261 { |
| 262 } | 262 } |
| 263 | 263 |
| 264 DEFINE_TRACE(RespondWithObserver) | 264 DEFINE_TRACE(RespondWithObserver) |
| 265 { | 265 { |
| 266 ContextLifecycleObserver::trace(visitor); | 266 ContextLifecycleObserver::trace(visitor); |
| 267 } | 267 } |
| 268 | 268 |
| 269 } // namespace blink | 269 } // namespace blink |
| OLD | NEW |