| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/presentation/PresentationRequest.h" | 5 #include "modules/presentation/PresentationRequest.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const AtomicString& eventType, | 94 const AtomicString& eventType, |
| 95 RegisteredEventListener& registeredListener) { | 95 RegisteredEventListener& registeredListener) { |
| 96 EventTargetWithInlineData::addedEventListener(eventType, registeredListener); | 96 EventTargetWithInlineData::addedEventListener(eventType, registeredListener); |
| 97 if (eventType == EventTypeNames::connectionavailable) | 97 if (eventType == EventTypeNames::connectionavailable) |
| 98 UseCounter::count( | 98 UseCounter::count( |
| 99 getExecutionContext(), | 99 getExecutionContext(), |
| 100 UseCounter::PresentationRequestConnectionAvailableEventListener); | 100 UseCounter::PresentationRequestConnectionAvailableEventListener); |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool PresentationRequest::hasPendingActivity() const { | 103 bool PresentationRequest::hasPendingActivity() const { |
| 104 if (!getExecutionContext() || | 104 if (!getExecutionContext() || getExecutionContext()->isContextDestroyed()) |
| 105 getExecutionContext()->activeDOMObjectsAreStopped()) | |
| 106 return false; | 105 return false; |
| 107 | 106 |
| 108 // Prevents garbage collecting of this object when not hold by another | 107 // Prevents garbage collecting of this object when not hold by another |
| 109 // object but still has listeners registered. | 108 // object but still has listeners registered. |
| 110 return hasEventListeners(); | 109 return hasEventListeners(); |
| 111 } | 110 } |
| 112 | 111 |
| 113 ScriptPromise PresentationRequest::start(ScriptState* scriptState) { | 112 ScriptPromise PresentationRequest::start(ScriptState* scriptState) { |
| 114 Settings* contextSettings = settings(getExecutionContext()); | 113 Settings* contextSettings = settings(getExecutionContext()); |
| 115 bool isUserGestureRequired = | 114 bool isUserGestureRequired = |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 ActiveDOMObject::trace(visitor); | 208 ActiveDOMObject::trace(visitor); |
| 210 } | 209 } |
| 211 | 210 |
| 212 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, | 211 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, |
| 213 const KURL& url) | 212 const KURL& url) |
| 214 : ActiveScriptWrappable(this), | 213 : ActiveScriptWrappable(this), |
| 215 ActiveDOMObject(executionContext), | 214 ActiveDOMObject(executionContext), |
| 216 m_url(url) {} | 215 m_url(url) {} |
| 217 | 216 |
| 218 } // namespace blink | 217 } // namespace blink |
| OLD | NEW |