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/navigatorconnect/AcceptConnectionObserver.h" | 6 #include "modules/navigatorconnect/AcceptConnectionObserver.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptFunction.h" | 9 #include "bindings/core/v8/ScriptFunction.h" |
10 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
11 #include "bindings/core/v8/ScriptValue.h" | 11 #include "bindings/core/v8/ScriptValue.h" |
12 #include "core/dom/ExceptionCode.h" | 12 #include "core/dom/ExceptionCode.h" |
13 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" | 13 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 // Function that is called when the promise passed to acceptConnection is either | 17 // Function that is called when the promise passed to acceptConnection is either |
18 // rejected or fulfilled. Calls the corresponding method on | 18 // rejected or fulfilled. Calls the corresponding method on |
19 // AcceptConnectionObserver. | 19 // AcceptConnectionObserver. |
20 class AcceptConnectionObserver::ThenFunction final : public ScriptFunction { | 20 class AcceptConnectionObserver::ThenFunction final : public ScriptFunction { |
21 public: | 21 public: |
22 enum ResolveType { | 22 enum ResolveType { |
23 Fulfilled, | 23 Fulfilled, |
24 Rejected, | 24 Rejected, |
25 }; | 25 }; |
26 | 26 |
27 static v8::Handle<v8::Function> createFunction(ScriptState* scriptState, Acc
eptConnectionObserver* observer, ResolveType type) | 27 static v8::Local<v8::Function> createFunction(ScriptState* scriptState, Acce
ptConnectionObserver* observer, ResolveType type) |
28 { | 28 { |
29 ThenFunction* self = new ThenFunction(scriptState, observer, type); | 29 ThenFunction* self = new ThenFunction(scriptState, observer, type); |
30 return self->bindToV8Function(); | 30 return self->bindToV8Function(); |
31 } | 31 } |
32 | 32 |
33 DEFINE_INLINE_VIRTUAL_TRACE() | 33 DEFINE_INLINE_VIRTUAL_TRACE() |
34 { | 34 { |
35 visitor->trace(m_observer); | 35 visitor->trace(m_observer); |
36 ScriptFunction::trace(visitor); | 36 ScriptFunction::trace(visitor); |
37 } | 37 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 , m_state(Initial) | 116 , m_state(Initial) |
117 { | 117 { |
118 } | 118 } |
119 | 119 |
120 DEFINE_TRACE(AcceptConnectionObserver) | 120 DEFINE_TRACE(AcceptConnectionObserver) |
121 { | 121 { |
122 ContextLifecycleObserver::trace(visitor); | 122 ContextLifecycleObserver::trace(visitor); |
123 } | 123 } |
124 | 124 |
125 } // namespace blink | 125 } // namespace blink |
OLD | NEW |