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

Side by Side Diff: Source/modules/presentation/PresentationSessionClientCallbacks.cpp

Issue 1209473003: Marks session as connected upon StartSession success (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "modules/presentation/PresentationSessionClientCallbacks.h" 6 #include "modules/presentation/PresentationSessionClientCallbacks.h"
7 7
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 void PresentationSessionClientCallbacks::onSuccess(WebPresentationSessionClient* client) 34 void PresentationSessionClientCallbacks::onSuccess(WebPresentationSessionClient* client)
35 { 35 {
36 ASSERT(client); 36 ASSERT(client);
37 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped()) { 37 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped()) {
38 PresentationSession::dispose(client); 38 PresentationSession::dispose(client);
39 return; 39 return;
40 } 40 }
41 41
42 m_resolver->resolve(PresentationSession::take(client, m_presentation)); 42 PresentationSession* session = PresentationSession::take(client, m_presentat ion);
43 session->didChangeState(WebPresentationSessionState::Connected);
whywhat 2015/06/25 17:33:45 Seems wasteful to dispatch an event to just create
haibinlu 2015/06/25 18:45:36 Make sense. Pass in the initial state.
44 m_resolver->resolve(session);
43 } 45 }
44 46
45 void PresentationSessionClientCallbacks::onError(WebPresentationError* error) 47 void PresentationSessionClientCallbacks::onError(WebPresentationError* error)
46 { 48 {
47 ASSERT(error); 49 ASSERT(error);
48 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped()) { 50 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped()) {
49 PresentationError::dispose(error); 51 PresentationError::dispose(error);
50 return; 52 return;
51 } 53 }
52 54
53 m_resolver->reject(PresentationError::take(error)); 55 m_resolver->reject(PresentationError::take(error));
54 } 56 }
55 57
56 } // namespace blink 58 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698