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

Side by Side Diff: third_party/WebKit/Source/modules/background_fetch/BackgroundFetchManager.cpp

Issue 2762663002: BackgroundFetchRegistration.abort() should return a Promise. (Closed)
Patch Set: Created 3 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/background_fetch/BackgroundFetchManager.h" 5 #include "modules/background_fetch/BackgroundFetchManager.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "bindings/core/v8/ScriptState.h" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "bindings/core/v8/V8ThrowException.h" 9 #include "bindings/core/v8/V8ThrowException.h"
10 #include "modules/background_fetch/BackgroundFetchBridge.h" 10 #include "modules/background_fetch/BackgroundFetchBridge.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 void BackgroundFetchManager::didGetRegistration( 72 void BackgroundFetchManager::didGetRegistration(
73 ScriptPromiseResolver* resolver, 73 ScriptPromiseResolver* resolver,
74 mojom::blink::BackgroundFetchError error, 74 mojom::blink::BackgroundFetchError error,
75 BackgroundFetchRegistration* registration) { 75 BackgroundFetchRegistration* registration) {
76 switch (error) { 76 switch (error) {
77 case mojom::blink::BackgroundFetchError::NONE: 77 case mojom::blink::BackgroundFetchError::NONE:
78 resolver->resolve(registration); 78 resolver->resolve(registration);
79 return; 79 return;
80 case mojom::blink::BackgroundFetchError::DUPLICATED_TAG: 80 case mojom::blink::BackgroundFetchError::DUPLICATED_TAG:
81 case mojom::blink::BackgroundFetchError::INVALID_TAG:
81 // Not applicable for this callback. 82 // Not applicable for this callback.
82 break; 83 break;
83 } 84 }
84 85
85 NOTREACHED(); 86 NOTREACHED();
86 } 87 }
87 88
88 ScriptPromise BackgroundFetchManager::getTags(ScriptState* scriptState) { 89 ScriptPromise BackgroundFetchManager::getTags(ScriptState* scriptState) {
89 if (!m_registration->active()) { 90 if (!m_registration->active()) {
90 return ScriptPromise::reject( 91 return ScriptPromise::reject(
(...skipping 14 matching lines...) Expand all
105 106
106 void BackgroundFetchManager::didGetTags( 107 void BackgroundFetchManager::didGetTags(
107 ScriptPromiseResolver* resolver, 108 ScriptPromiseResolver* resolver,
108 mojom::blink::BackgroundFetchError error, 109 mojom::blink::BackgroundFetchError error,
109 const Vector<String>& tags) { 110 const Vector<String>& tags) {
110 switch (error) { 111 switch (error) {
111 case mojom::blink::BackgroundFetchError::NONE: 112 case mojom::blink::BackgroundFetchError::NONE:
112 resolver->resolve(tags); 113 resolver->resolve(tags);
113 return; 114 return;
114 case mojom::blink::BackgroundFetchError::DUPLICATED_TAG: 115 case mojom::blink::BackgroundFetchError::DUPLICATED_TAG:
116 case mojom::blink::BackgroundFetchError::INVALID_TAG:
115 // Not applicable for this callback. 117 // Not applicable for this callback.
116 break; 118 break;
117 } 119 }
118 120
119 NOTREACHED(); 121 NOTREACHED();
120 } 122 }
121 123
122 DEFINE_TRACE(BackgroundFetchManager) { 124 DEFINE_TRACE(BackgroundFetchManager) {
123 visitor->trace(m_registration); 125 visitor->trace(m_registration);
124 visitor->trace(m_bridge); 126 visitor->trace(m_bridge);
125 } 127 }
126 128
127 } // namespace blink 129 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698