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

Side by Side Diff: chrome/browser/media/router/media_router_mojo_impl.cc

Issue 1245213002: [MediaRouter] Implement send binary message from PSDImpl to MRPManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review fixes Created 5 years, 5 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 "chrome/browser/media/router/media_router_mojo_impl.h" 5 #include "chrome/browser/media/router/media_router_mojo_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 void MediaRouterMojoImpl::SendRouteMessage( 237 void MediaRouterMojoImpl::SendRouteMessage(
238 const MediaRoute::Id& route_id, 238 const MediaRoute::Id& route_id,
239 const std::string& message, 239 const std::string& message,
240 const SendRouteMessageCallback& callback) { 240 const SendRouteMessageCallback& callback) {
241 DCHECK(thread_checker_.CalledOnValidThread()); 241 DCHECK(thread_checker_.CalledOnValidThread());
242 242
243 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoSendSessionMessage, 243 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoSendSessionMessage,
244 base::Unretained(this), route_id, message, callback)); 244 base::Unretained(this), route_id, message, callback));
245 } 245 }
246 246
247 void MediaRouterMojoImpl::SendRouteBinaryMessage(
248 const MediaRoute::Id& route_id,
249 const std::vector<uint8>& data,
250 const SendRouteMessageCallback& callback) {
251 DCHECK(thread_checker_.CalledOnValidThread());
252
253 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoSendSessionBinaryMessage,
254 base::Unretained(this), route_id, data, callback));
255 }
256
247 void MediaRouterMojoImpl::ListenForRouteMessages( 257 void MediaRouterMojoImpl::ListenForRouteMessages(
248 const std::vector<MediaRoute::Id>& route_ids, 258 const std::vector<MediaRoute::Id>& route_ids,
249 const PresentationSessionMessageCallback& message_cb) { 259 const PresentationSessionMessageCallback& message_cb) {
250 DCHECK(thread_checker_.CalledOnValidThread()); 260 DCHECK(thread_checker_.CalledOnValidThread());
251 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoListenForRouteMessages, 261 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoListenForRouteMessages,
252 base::Unretained(this), route_ids, message_cb)); 262 base::Unretained(this), route_ids, message_cb));
253 } 263 }
254 264
255 void MediaRouterMojoImpl::ClearIssue(const Issue::Id& issue_id) { 265 void MediaRouterMojoImpl::ClearIssue(const Issue::Id& issue_id) {
256 DCHECK(thread_checker_.CalledOnValidThread()); 266 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 381 }
372 382
373 void MediaRouterMojoImpl::DoSendSessionMessage( 383 void MediaRouterMojoImpl::DoSendSessionMessage(
374 const MediaRoute::Id& route_id, 384 const MediaRoute::Id& route_id,
375 const std::string& message, 385 const std::string& message,
376 const SendRouteMessageCallback& callback) { 386 const SendRouteMessageCallback& callback) {
377 DVLOG_WITH_INSTANCE(1) << "SendRouteMessage " << route_id; 387 DVLOG_WITH_INSTANCE(1) << "SendRouteMessage " << route_id;
378 media_route_provider_->SendRouteMessage(route_id, message, callback); 388 media_route_provider_->SendRouteMessage(route_id, message, callback);
379 } 389 }
380 390
391 void MediaRouterMojoImpl::DoSendSessionBinaryMessage(
392 const MediaRoute::Id& route_id,
393 const std::vector<uint8>& data,
394 const SendRouteMessageCallback& callback) {
395 DVLOG_WITH_INSTANCE(1) << "SendRouteBinaryMessage " << route_id;
396 media_route_provider_->SendRouteBinaryMessage(
397 route_id, mojo::Array<uint8>::From(data), callback);
haibinlu 2015/07/25 01:15:53 "From" makes a copy of the underlying data. Is the
398 }
399
381 void MediaRouterMojoImpl::DoListenForRouteMessages( 400 void MediaRouterMojoImpl::DoListenForRouteMessages(
382 const std::vector<MediaRoute::Id>& route_ids, 401 const std::vector<MediaRoute::Id>& route_ids,
383 const PresentationSessionMessageCallback& message_cb) { 402 const PresentationSessionMessageCallback& message_cb) {
384 DVLOG_WITH_INSTANCE(1) << "ListenForRouteMessages"; 403 DVLOG_WITH_INSTANCE(1) << "ListenForRouteMessages";
385 media_route_provider_->ListenForRouteMessages( 404 media_route_provider_->ListenForRouteMessages(
386 mojo::Array<mojo::String>::From(route_ids), 405 mojo::Array<mojo::String>::From(route_ids),
387 base::Bind(&MediaRouterMojoImpl::OnRouteMessageReceived, 406 base::Bind(&MediaRouterMojoImpl::OnRouteMessageReceived,
388 base::Unretained(this), message_cb)); 407 base::Unretained(this), message_cb));
389 } 408 }
390 409
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 return; 490 return;
472 } 491 }
473 492
474 for (const auto& next_request : pending_requests_) 493 for (const auto& next_request : pending_requests_)
475 next_request.Run(); 494 next_request.Run();
476 495
477 pending_requests_.clear(); 496 pending_requests_.clear();
478 } 497 }
479 498
480 } // namespace media_router 499 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698