| 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 void WaitUntilObserver::willDispatchEvent() | 68 void WaitUntilObserver::willDispatchEvent() |
| 69 { | 69 { |
| 70 incrementPendingActivity(); | 70 incrementPendingActivity(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void WaitUntilObserver::didDispatchEvent() | 73 void WaitUntilObserver::didDispatchEvent() |
| 74 { | 74 { |
| 75 decrementPendingActivity(); | 75 decrementPendingActivity(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void WaitUntilObserver::waitUntil(const ScriptValue& value) | 78 void WaitUntilObserver::waitUntil(ScriptState* scriptState, const ScriptValue& v
alue) |
| 79 { | 79 { |
| 80 incrementPendingActivity(); | 80 incrementPendingActivity(); |
| 81 ScriptPromise::cast(value).then( | 81 ScriptPromise::cast(scriptState, value).then( |
| 82 ThenFunction::create(this, ThenFunction::Fulfilled), | 82 ThenFunction::create(this, ThenFunction::Fulfilled), |
| 83 ThenFunction::create(this, ThenFunction::Rejected)); | 83 ThenFunction::create(this, ThenFunction::Rejected)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, EventType type,
int eventID) | 86 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, EventType type,
int eventID) |
| 87 : ContextLifecycleObserver(context) | 87 : ContextLifecycleObserver(context) |
| 88 , m_type(type) | 88 , m_type(type) |
| 89 , m_eventID(eventID) | 89 , m_eventID(eventID) |
| 90 , m_pendingActivity(0) | 90 , m_pendingActivity(0) |
| 91 , m_hasError(false) | 91 , m_hasError(false) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 118 client->didHandleActivateEvent(m_eventID, result); | 118 client->didHandleActivateEvent(m_eventID, result); |
| 119 break; | 119 break; |
| 120 case Install: | 120 case Install: |
| 121 client->didHandleInstallEvent(m_eventID, result); | 121 client->didHandleInstallEvent(m_eventID, result); |
| 122 break; | 122 break; |
| 123 } | 123 } |
| 124 observeContext(0); | 124 observeContext(0); |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace WebCore | 127 } // namespace WebCore |
| OLD | NEW |