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/WaitUntilObserver.h" | 6 #include "modules/serviceworkers/WaitUntilObserver.h" |
7 | 7 |
8 #include "bindings/v8/ScriptFunction.h" | 8 #include "bindings/v8/ScriptFunction.h" |
9 #include "bindings/v8/ScriptPromise.h" | 9 #include "bindings/v8/ScriptPromise.h" |
10 #include "bindings/v8/ScriptValue.h" | 10 #include "bindings/v8/ScriptValue.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 | 69 |
70 void WaitUntilObserver::didDispatchEvent() | 70 void WaitUntilObserver::didDispatchEvent() |
71 { | 71 { |
72 decrementPendingActivity(); | 72 decrementPendingActivity(); |
73 } | 73 } |
74 | 74 |
75 void WaitUntilObserver::waitUntil(const ScriptValue& value) | 75 void WaitUntilObserver::waitUntil(const ScriptValue& value) |
76 { | 76 { |
77 incrementPendingActivity(); | 77 incrementPendingActivity(); |
78 ScriptPromise(value).then( | 78 ScriptPromise::cast(value).then( |
79 ThenFunction::create(this, ThenFunction::Fulfilled), | 79 ThenFunction::create(this, ThenFunction::Fulfilled), |
80 ThenFunction::create(this, ThenFunction::Rejected)); | 80 ThenFunction::create(this, ThenFunction::Rejected)); |
81 } | 81 } |
82 | 82 |
83 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, int eventID) | 83 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, int eventID) |
84 : ContextLifecycleObserver(context) | 84 : ContextLifecycleObserver(context) |
85 , m_eventID(eventID) | 85 , m_eventID(eventID) |
86 , m_pendingActivity(0) | 86 , m_pendingActivity(0) |
87 { | 87 { |
88 } | 88 } |
(...skipping 13 matching lines...) Expand all Loading... |
102 { | 102 { |
103 ASSERT(m_pendingActivity > 0); | 103 ASSERT(m_pendingActivity > 0); |
104 if (--m_pendingActivity || !executionContext()) | 104 if (--m_pendingActivity || !executionContext()) |
105 return; | 105 return; |
106 | 106 |
107 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleInstallEv
ent(m_eventID); | 107 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleInstallEv
ent(m_eventID); |
108 observeContext(0); | 108 observeContext(0); |
109 } | 109 } |
110 | 110 |
111 } // namespace WebCore | 111 } // namespace WebCore |
OLD | NEW |