| 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 "modules/serviceworkers/WaitUntilObserver.h" | 5 #include "modules/serviceworkers/WaitUntilObserver.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptFunction.h" | 7 #include "bindings/core/v8/ScriptFunction.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
| 11 #include "core/dom/ExceptionCode.h" | 11 #include "core/dom/ExceptionCode.h" |
| 12 #include "core/dom/ExecutionContext.h" | 12 #include "core/dom/ExecutionContext.h" |
| 13 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 13 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
| 14 #include "platform/LayoutTestSupport.h" | 14 #include "platform/LayoutTestSupport.h" |
| 15 #include "public/platform/Platform.h" |
| 15 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" | 16 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" |
| 16 #include "wtf/Assertions.h" | 17 #include "wtf/Assertions.h" |
| 17 #include <v8.h> | 18 #include <v8.h> |
| 18 | 19 |
| 19 namespace blink { | 20 namespace blink { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 // Timeout before a service worker that was given window interaction | 24 // Timeout before a service worker that was given window interaction |
| 24 // permission loses them. The unit is seconds. | 25 // permission loses them. The unit is seconds. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 ThenFunction::createFunction(scriptState, this, ThenFunction::Rejected)); | 131 ThenFunction::createFunction(scriptState, this, ThenFunction::Rejected)); |
| 131 } | 132 } |
| 132 | 133 |
| 133 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, | 134 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, |
| 134 EventType type, | 135 EventType type, |
| 135 int eventID) | 136 int eventID) |
| 136 : m_executionContext(context), | 137 : m_executionContext(context), |
| 137 m_type(type), | 138 m_type(type), |
| 138 m_eventID(eventID), | 139 m_eventID(eventID), |
| 139 m_consumeWindowInteractionTimer( | 140 m_consumeWindowInteractionTimer( |
| 141 Platform::current()->currentThread()->getWebTaskRunner(), |
| 140 this, | 142 this, |
| 141 &WaitUntilObserver::consumeWindowInteraction) {} | 143 &WaitUntilObserver::consumeWindowInteraction) {} |
| 142 | 144 |
| 143 void WaitUntilObserver::reportError(const ScriptValue& value) { | 145 void WaitUntilObserver::reportError(const ScriptValue& value) { |
| 144 // FIXME: Propagate error message to the client for onerror handling. | 146 // FIXME: Propagate error message to the client for onerror handling. |
| 145 NOTIMPLEMENTED(); | 147 NOTIMPLEMENTED(); |
| 146 | 148 |
| 147 m_hasError = true; | 149 m_hasError = true; |
| 148 } | 150 } |
| 149 | 151 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 if (!m_executionContext) | 205 if (!m_executionContext) |
| 204 return; | 206 return; |
| 205 m_executionContext->consumeWindowInteraction(); | 207 m_executionContext->consumeWindowInteraction(); |
| 206 } | 208 } |
| 207 | 209 |
| 208 DEFINE_TRACE(WaitUntilObserver) { | 210 DEFINE_TRACE(WaitUntilObserver) { |
| 209 visitor->trace(m_executionContext); | 211 visitor->trace(m_executionContext); |
| 210 } | 212 } |
| 211 | 213 |
| 212 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |