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

Side by Side Diff: Source/modules/serviceworkers/RespondWithObserver.cpp

Issue 1259023002: Service Worker: Use ScriptPromise instead of ScriptPromise&. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove the forward declaration (Included header will do). Created 5 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
« no previous file with comments | « Source/modules/serviceworkers/RespondWithObserver.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 if (defaultPrevented) { 126 if (defaultPrevented) {
127 responseWasRejected(WebServiceWorkerResponseErrorDefaultPrevented); 127 responseWasRejected(WebServiceWorkerResponseErrorDefaultPrevented);
128 return; 128 return;
129 } 129 }
130 130
131 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleFetchEven t(m_eventID); 131 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleFetchEven t(m_eventID);
132 m_state = Done; 132 m_state = Done;
133 } 133 }
134 134
135 void RespondWithObserver::respondWith(ScriptState* scriptState, ScriptPromise& s criptPromise, ExceptionState& exceptionState) 135 void RespondWithObserver::respondWith(ScriptState* scriptState, ScriptPromise sc riptPromise, ExceptionState& exceptionState)
136 { 136 {
137 if (m_state != Initial) { 137 if (m_state != Initial) {
138 exceptionState.throwDOMException(InvalidStateError, "The fetch event has already been responded to."); 138 exceptionState.throwDOMException(InvalidStateError, "The fetch event has already been responded to.");
139 return; 139 return;
140 } 140 }
141 141
142 m_state = Pending; 142 m_state = Pending;
143 scriptPromise.then( 143 scriptPromise.then(
144 ThenFunction::createFunction(scriptState, this, ThenFunction::Fulfilled) , 144 ThenFunction::createFunction(scriptState, this, ThenFunction::Fulfilled) ,
145 ThenFunction::createFunction(scriptState, this, ThenFunction::Rejected)) ; 145 ThenFunction::createFunction(scriptState, this, ThenFunction::Rejected)) ;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 , m_state(Initial) 222 , m_state(Initial)
223 { 223 {
224 } 224 }
225 225
226 DEFINE_TRACE(RespondWithObserver) 226 DEFINE_TRACE(RespondWithObserver)
227 { 227 {
228 ContextLifecycleObserver::trace(visitor); 228 ContextLifecycleObserver::trace(visitor);
229 } 229 }
230 230
231 } // namespace blink 231 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/RespondWithObserver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698