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

Unified Diff: content/browser/presentation/presentation_service_impl.cc

Issue 1202963004: Gets presentation ID from route ID upon route creation, and overrides previous presentation ID with… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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 side-by-side diff with in-line comments
Download patch
Index: content/browser/presentation/presentation_service_impl.cc
diff --git a/content/browser/presentation/presentation_service_impl.cc b/content/browser/presentation/presentation_service_impl.cc
index f3870970f70712e3ba73eefc00d2362524f9005c..6546c600c359bdb07ca731e4675fceca9edc2332 100644
--- a/content/browser/presentation/presentation_service_impl.cc
+++ b/content/browser/presentation/presentation_service_impl.cc
@@ -457,18 +457,23 @@ void PresentationServiceImpl::ListenForSessionMessages(
void PresentationServiceImpl::OnSessionMessages(
scoped_ptr<ScopedVector<PresentationSessionMessage>> messages) {
- DCHECK(messages.get() && !messages->empty());
if (!on_session_messages_callback_.get()) {
// The Reset method of this class was invoked.
return;
}
- mojo::Array<presentation::SessionMessagePtr> mojoMessages(messages->size());
- for (size_t i = 0; i < messages->size(); ++i) {
- mojoMessages[i] = ToMojoSessionMessage((*messages)[i]);
+ if (!messages.get() || messages->empty()) {
+ // Error handling. Session is either closed or in error state.
+ on_session_messages_callback_->Run(
+ mojo::Array<presentation::SessionMessagePtr>());
+ } else {
+ mojo::Array<presentation::SessionMessagePtr> mojoMessages(messages->size());
+ for (size_t i = 0; i < messages->size(); ++i) {
+ mojoMessages[i] = ToMojoSessionMessage((*messages)[i]);
+ }
+ on_session_messages_callback_->Run(mojoMessages.Pass());
}
- on_session_messages_callback_->Run(mojoMessages.Pass());
on_session_messages_callback_.reset();
}

Powered by Google App Engine
This is Rietveld 408576698