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

Side by Side Diff: content/renderer/presentation/presentation_dispatcher.cc

Issue 1118103002: Implements ListenForSessionMessages in PresentationServiceImpl; uses Swap to avoid copying large da… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « content/public/browser/presentation_session_message.cc ('k') | 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 "content/renderer/presentation/presentation_dispatcher.h" 5 #include "content/renderer/presentation/presentation_dispatcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/presentation/presentation_service.mojom.h" 8 #include "content/common/presentation/presentation_service.mojom.h"
9 #include "content/public/common/service_registry.h" 9 #include "content/public/common/service_registry.h"
10 #include "content/public/renderer/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 base::Unretained(this))); 206 base::Unretained(this)));
207 207
208 DCHECK(!session_info.is_null()); 208 DCHECK(!session_info.is_null());
209 controller_->didChangeSessionState( 209 controller_->didChangeSessionState(
210 new PresentationSessionClient(session_info.Pass()), 210 new PresentationSessionClient(session_info.Pass()),
211 GetWebPresentationSessionStateFromMojo(session_state)); 211 GetWebPresentationSessionStateFromMojo(session_state));
212 } 212 }
213 213
214 void PresentationDispatcher::OnSessionMessagesReceived( 214 void PresentationDispatcher::OnSessionMessagesReceived(
215 mojo::Array<presentation::SessionMessagePtr> messages) { 215 mojo::Array<presentation::SessionMessagePtr> messages) {
216 if (!controller_) 216 // When messages is null, there is an error at presentation service side.
217 if (!controller_ || messages.is_null())
217 return; 218 return;
218 219
219 for (size_t i = 0; i < messages.size(); ++i) { 220 for (size_t i = 0; i < messages.size(); ++i) {
220 if (messages[i]->type == 221 if (messages[i]->type ==
221 presentation::PresentationMessageType::PRESENTATION_MESSAGE_TYPE_TEXT) { 222 presentation::PresentationMessageType::PRESENTATION_MESSAGE_TYPE_TEXT) {
222 controller_->didReceiveSessionTextMessage( 223 controller_->didReceiveSessionTextMessage(
223 new PresentationSessionClient(messages[i]->presentation_url, 224 new PresentationSessionClient(messages[i]->presentation_url,
224 messages[i]->presentation_id), 225 messages[i]->presentation_id),
225 blink::WebString::fromUTF8(messages[i]->message)); 226 blink::WebString::fromUTF8(messages[i]->message));
226 } else { 227 } else {
(...skipping 21 matching lines...) Expand all
248 presentation_service_->ListenForSessionStateChange(base::Bind( 249 presentation_service_->ListenForSessionStateChange(base::Bind(
249 &PresentationDispatcher::OnSessionStateChange, 250 &PresentationDispatcher::OnSessionStateChange,
250 base::Unretained(this))); 251 base::Unretained(this)));
251 presentation_service_->ListenForSessionMessages( 252 presentation_service_->ListenForSessionMessages(
252 base::Bind(&PresentationDispatcher::OnSessionMessagesReceived, 253 base::Bind(&PresentationDispatcher::OnSessionMessagesReceived,
253 base::Unretained(this))); 254 base::Unretained(this)));
254 */ 255 */
255 } 256 }
256 257
257 } // namespace content 258 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/presentation_session_message.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698