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

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 f6527896aa2837af9ebbcf4ba91a26cfa0607cac..bf467e3e4f7dc1ec77b9dc639d3c69dd6e123576 100644
--- a/content/browser/presentation/presentation_service_impl.cc
+++ b/content/browser/presentation/presentation_service_impl.cc
@@ -405,11 +405,11 @@ void PresentationServiceImpl::SendSessionMessage(
weak_factory_.GetWeakPtr()));
}
-void PresentationServiceImpl::OnSendMessageCallback() {
+void PresentationServiceImpl::OnSendMessageCallback(bool sent) {
// It is possible that Reset() is invoked before receiving this callback.
// So, always check send_message_callback_ for non-null.
if (send_message_callback_) {
- send_message_callback_->Run(true);
+ send_message_callback_->Run(sent);
send_message_callback_.reset();
}
}
@@ -457,18 +457,22 @@ 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()) {
+ on_session_messages_callback_->Run(
Kevin M 2015/06/24 23:02:07 Add a comment indicating that branch is an error h
haibinlu 2015/06/24 23:25:13 Done.
+ 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();
}
« no previous file with comments | « content/browser/presentation/presentation_service_impl.h ('k') | content/public/browser/presentation_service_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698