OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/NavigationPreloadCallbacks.h" | 5 #include "modules/serviceworkers/NavigationPreloadCallbacks.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
9 #include "modules/serviceworkers/ServiceWorkerError.h" | 9 #include "modules/serviceworkers/ServiceWorkerError.h" |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 void EnableNavigationPreloadCallbacks::onError( | 28 void EnableNavigationPreloadCallbacks::onError( |
29 const WebServiceWorkerError& error) { | 29 const WebServiceWorkerError& error) { |
30 if (!m_resolver->getExecutionContext() || | 30 if (!m_resolver->getExecutionContext() || |
31 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) | 31 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) |
32 return; | 32 return; |
33 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error)); | 33 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error)); |
34 } | 34 } |
35 | 35 |
36 DisableNavigationPreloadCallbacks::DisableNavigationPreloadCallbacks( | |
37 ScriptPromiseResolver* resolver) | |
38 : m_resolver(resolver) { | |
39 DCHECK(m_resolver); | |
40 } | |
41 | |
42 DisableNavigationPreloadCallbacks::~DisableNavigationPreloadCallbacks() {} | |
43 | |
44 void DisableNavigationPreloadCallbacks::onSuccess() { | |
45 if (!m_resolver->getExecutionContext() || | |
46 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) | |
47 return; | |
48 m_resolver->resolve(); | |
49 } | |
50 | |
51 void DisableNavigationPreloadCallbacks::onError( | |
52 const WebServiceWorkerError& error) { | |
53 if (!m_resolver->getExecutionContext() || | |
54 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) | |
55 return; | |
56 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error)); | |
57 } | |
58 | |
59 } // namespace blink | 36 } // namespace blink |
OLD | NEW |