Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp

Issue 2602523002: [Presentation API] Resolve PresentationRequest::reconnect() with existing presentation connection i… (Closed)
Patch Set: remove getExecutionContext() null check in PresentationRequest::reconnect() Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/PresentationConnectionCallbacks.h" 5 #include "modules/presentation/PresentationConnectionCallbacks.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "modules/presentation/PresentationConnection.h" 9 #include "modules/presentation/PresentationConnection.h"
10 #include "modules/presentation/PresentationError.h" 10 #include "modules/presentation/PresentationError.h"
11 #include "modules/presentation/PresentationRequest.h" 11 #include "modules/presentation/PresentationRequest.h"
12 #include "public/platform/modules/presentation/WebPresentationError.h" 12 #include "public/platform/modules/presentation/WebPresentationError.h"
13 #include "wtf/PtrUtil.h" 13 #include "wtf/PtrUtil.h"
14 #include <memory> 14 #include <memory>
15 15
16 namespace blink { 16 namespace blink {
17 17
18 PresentationConnectionCallbacks::PresentationConnectionCallbacks( 18 PresentationConnectionCallbacks::PresentationConnectionCallbacks(
19 ScriptPromiseResolver* resolver, 19 ScriptPromiseResolver* resolver,
20 PresentationRequest* request) 20 PresentationRequest* request)
21 : m_resolver(resolver), m_request(request) { 21 : m_resolver(resolver), m_request(request) {
22 ASSERT(m_resolver); 22 ASSERT(m_resolver);
23 ASSERT(m_request); 23 ASSERT(m_request);
24 } 24 }
25 25
26 void PresentationConnectionCallbacks::onSuccess( 26 void PresentationConnectionCallbacks::onSuccess(
27 const WebPresentationSessionInfo& sessionInfo) { 27 const WebPresentationSessionInfo& sessionInfo) {
28 if (!m_resolver->getExecutionContext() || 28 if (!m_resolver->getExecutionContext() ||
29 m_resolver->getExecutionContext()->isContextDestroyed()) 29 m_resolver->getExecutionContext()->isContextDestroyed()) {
30 return; 30 return;
31 }
31 m_resolver->resolve( 32 m_resolver->resolve(
32 PresentationConnection::take(m_resolver.get(), sessionInfo, m_request)); 33 PresentationConnection::take(m_resolver.get(), sessionInfo, m_request));
33 } 34 }
34 35
35 void PresentationConnectionCallbacks::onError( 36 void PresentationConnectionCallbacks::onError(
36 const WebPresentationError& error) { 37 const WebPresentationError& error) {
37 if (!m_resolver->getExecutionContext() || 38 if (!m_resolver->getExecutionContext() ||
38 m_resolver->getExecutionContext()->isContextDestroyed()) 39 m_resolver->getExecutionContext()->isContextDestroyed())
39 return; 40 return;
40 m_resolver->reject(PresentationError::take(error)); 41 m_resolver->reject(PresentationError::take(error));
41 } 42 }
42 43
43 } // namespace blink 44 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698