| 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/ServiceWorkerClients.h" | 6 #include "modules/serviceworkers/ServiceWorkerClients.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 ServiceWorkerClients* ServiceWorkerClients::create() | 46 ServiceWorkerClients* ServiceWorkerClients::create() |
| 47 { | 47 { |
| 48 return new ServiceWorkerClients(); | 48 return new ServiceWorkerClients(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 ServiceWorkerClients::ServiceWorkerClients() | 51 ServiceWorkerClients::ServiceWorkerClients() |
| 52 { | 52 { |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Deprecated, please use matchAll instead |
| 55 ScriptPromise ServiceWorkerClients::getAll(ScriptState* scriptState, const Clien
tQueryOptions& options) | 56 ScriptPromise ServiceWorkerClients::getAll(ScriptState* scriptState, const Clien
tQueryOptions& options) |
| 56 { | 57 { |
| 58 return matchAll(scriptState, options); |
| 59 } |
| 60 |
| 61 ScriptPromise ServiceWorkerClients::matchAll(ScriptState* scriptState, const Cli
entQueryOptions& options) |
| 62 { |
| 57 ExecutionContext* executionContext = scriptState->executionContext(); | 63 ExecutionContext* executionContext = scriptState->executionContext(); |
| 58 // FIXME: May be null due to worker termination: http://crbug.com/413518. | 64 // FIXME: May be null due to worker termination: http://crbug.com/413518. |
| 59 if (!executionContext) | 65 if (!executionContext) |
| 60 return ScriptPromise(); | 66 return ScriptPromise(); |
| 61 | 67 |
| 62 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); | 68 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); |
| 63 ScriptPromise promise = resolver->promise(); | 69 ScriptPromise promise = resolver->promise(); |
| 64 | 70 |
| 65 if (options.includeUncontrolled()) { | 71 if (options.includeUncontrolled()) { |
| 66 // FIXME: Currently we don't support includeUncontrolled=true. | 72 // FIXME: Currently we don't support includeUncontrolled=true. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 88 | 94 |
| 89 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); | 95 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); |
| 90 ScriptPromise promise = resolver->promise(); | 96 ScriptPromise promise = resolver->promise(); |
| 91 | 97 |
| 92 WebServiceWorkerClientsClaimCallbacks* callbacks = new CallbackPromiseAdapte
r<void, ServiceWorkerError>(resolver); | 98 WebServiceWorkerClientsClaimCallbacks* callbacks = new CallbackPromiseAdapte
r<void, ServiceWorkerError>(resolver); |
| 93 ServiceWorkerGlobalScopeClient::from(executionContext)->claim(callbacks); | 99 ServiceWorkerGlobalScopeClient::from(executionContext)->claim(callbacks); |
| 94 return promise; | 100 return promise; |
| 95 } | 101 } |
| 96 | 102 |
| 97 } // namespace blink | 103 } // namespace blink |
| OLD | NEW |