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

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: resolve code review comments from haraken, Mark, and mlamouri 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"
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 void PresentationConnectionCallbacks::onError( 40 void PresentationConnectionCallbacks::onError(
41 const WebPresentationError& error) { 41 const WebPresentationError& error) {
42 if (!m_resolver->getExecutionContext() || 42 if (!m_resolver->getExecutionContext() ||
43 m_resolver->getExecutionContext()->isContextDestroyed()) 43 m_resolver->getExecutionContext()->isContextDestroyed())
44 return; 44 return;
45 m_resolver->reject(PresentationError::take(error)); 45 m_resolver->reject(PresentationError::take(error));
46 } 46 }
47 47
48 ExistingPresentationConnectionCallbacks::
49 ExistingPresentationConnectionCallbacks(ScriptPromiseResolver* resolver,
50 PresentationConnection* connection)
51 : m_resolver(resolver), m_connection(connection) {
52 DCHECK(m_resolver);
53 DCHECK(m_connection);
54 }
55
56 void ExistingPresentationConnectionCallbacks::onSuccess(
57 std::unique_ptr<WebPresentationConnectionClient>
58 PresentationConnectionClient) {
59 if (!m_resolver->getExecutionContext() ||
60 m_resolver->getExecutionContext()->isContextDestroyed())
61 return;
mlamouri (slow - plz ping) 2017/01/03 12:02:11 style: add { } because of 2-line condition. You ca
zhaobin 2017/01/03 20:12:07 Done.
62
63 if (m_connection->getState() == WebPresentationConnectionState::Closed)
64 m_connection->didChangeState(WebPresentationConnectionState::Connecting);
65
66 m_resolver->resolve(m_connection);
67 }
68
69 void ExistingPresentationConnectionCallbacks::onError(
70 const WebPresentationError& error) {
71 NOTREACHED();
72 }
73
48 } // namespace blink 74 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698