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

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

Issue 1479923002: Enumerate the return value of dispatchEvent so it is clear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_passive_uma_add
Patch Set: Fix typo Created 4 years, 9 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
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 "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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698