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

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: pass scoped_ptr<>, avoid copying Created 5 years, 4 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 scoped_ptr<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.get(),
haibinlu 2015/07/28 18:57:19 data.Pass()
USE s.singapati at gmail.com 2015/07/28 19:11:46 Then DoSendSessionBinaryMessage() has to take scop
Kevin M 2015/07/28 20:03:36 Use base::Passed(data.Pass()). If you just pass t
USE s.singapati at gmail.com 2015/07/29 11:22:01 Done.
255 callback));
256 }
257
247 void MediaRouterMojoImpl::ListenForRouteMessages( 258 void MediaRouterMojoImpl::ListenForRouteMessages(
248 const std::vector<MediaRoute::Id>& route_ids, 259 const std::vector<MediaRoute::Id>& route_ids,
249 const PresentationSessionMessageCallback& message_cb) { 260 const PresentationSessionMessageCallback& message_cb) {
250 DCHECK(thread_checker_.CalledOnValidThread()); 261 DCHECK(thread_checker_.CalledOnValidThread());
251 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoListenForRouteMessages, 262 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoListenForRouteMessages,
252 base::Unretained(this), route_ids, message_cb)); 263 base::Unretained(this), route_ids, message_cb));
253 } 264 }
254 265
255 void MediaRouterMojoImpl::ClearIssue(const Issue::Id& issue_id) { 266 void MediaRouterMojoImpl::ClearIssue(const Issue::Id& issue_id) {
256 DCHECK(thread_checker_.CalledOnValidThread()); 267 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 382 }
372 383
373 void MediaRouterMojoImpl::DoSendSessionMessage( 384 void MediaRouterMojoImpl::DoSendSessionMessage(
374 const MediaRoute::Id& route_id, 385 const MediaRoute::Id& route_id,
375 const std::string& message, 386 const std::string& message,
376 const SendRouteMessageCallback& callback) { 387 const SendRouteMessageCallback& callback) {
377 DVLOG_WITH_INSTANCE(1) << "SendRouteMessage " << route_id; 388 DVLOG_WITH_INSTANCE(1) << "SendRouteMessage " << route_id;
378 media_route_provider_->SendRouteMessage(route_id, message, callback); 389 media_route_provider_->SendRouteMessage(route_id, message, callback);
379 } 390 }
380 391
392 void MediaRouterMojoImpl::DoSendSessionBinaryMessage(
393 const MediaRoute::Id& route_id,
394 std::vector<uint8>* data,
395 const SendRouteMessageCallback& callback) {
396 DVLOG_WITH_INSTANCE(1) << "SendRouteBinaryMessage " << route_id;
397 mojo::Array<uint8> mojo_array;
398 mojo_array.Swap(data);
399 media_route_provider_->SendRouteBinaryMessage(route_id, mojo_array.Pass(),
400 callback);
401 }
402
381 void MediaRouterMojoImpl::DoListenForRouteMessages( 403 void MediaRouterMojoImpl::DoListenForRouteMessages(
382 const std::vector<MediaRoute::Id>& route_ids, 404 const std::vector<MediaRoute::Id>& route_ids,
383 const PresentationSessionMessageCallback& message_cb) { 405 const PresentationSessionMessageCallback& message_cb) {
384 DVLOG_WITH_INSTANCE(1) << "ListenForRouteMessages"; 406 DVLOG_WITH_INSTANCE(1) << "ListenForRouteMessages";
385 media_route_provider_->ListenForRouteMessages( 407 media_route_provider_->ListenForRouteMessages(
386 mojo::Array<mojo::String>::From(route_ids), 408 mojo::Array<mojo::String>::From(route_ids),
387 base::Bind(&MediaRouterMojoImpl::OnRouteMessageReceived, 409 base::Bind(&MediaRouterMojoImpl::OnRouteMessageReceived,
388 base::Unretained(this), message_cb)); 410 base::Unretained(this), message_cb));
389 } 411 }
390 412
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 return; 493 return;
472 } 494 }
473 495
474 for (const auto& next_request : pending_requests_) 496 for (const auto& next_request : pending_requests_)
475 next_request.Run(); 497 next_request.Run();
476 498
477 pending_requests_.clear(); 499 pending_requests_.clear();
478 } 500 }
479 501
480 } // namespace media_router 502 } // namespace media_router
OLDNEW
« no previous file with comments | « chrome/browser/media/router/media_router_mojo_impl.h ('k') | chrome/browser/media/router/media_router_mojo_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698