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

Side by Side Diff: components/copresence/rpc/rpc_handler.cc

Issue 598053003: Switching to C++11 template syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/copresence/rpc/rpc_handler.h" 5 #include "components/copresence/rpc/rpc_handler.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 if (!inaudible_token.empty()) 481 if (!inaudible_token.empty())
482 AddTokenToRequest(request, AudioToken(inaudible_token, false)); 482 AddTokenToRequest(request, AudioToken(inaudible_token, false));
483 } 483 }
484 484
485 void RpcHandler::DispatchMessages( 485 void RpcHandler::DispatchMessages(
486 const RepeatedPtrField<SubscribedMessage>& messages) { 486 const RepeatedPtrField<SubscribedMessage>& messages) {
487 if (messages.size() == 0) 487 if (messages.size() == 0)
488 return; 488 return;
489 489
490 // Index the messages by subscription id. 490 // Index the messages by subscription id.
491 std::map<std::string, std::vector<Message> > messages_by_subscription; 491 std::map<std::string, std::vector<Message>> messages_by_subscription;
492 DVLOG(3) << "Dispatching " << messages.size() << " messages"; 492 DVLOG(3) << "Dispatching " << messages.size() << " messages";
493 for (int m = 0; m < messages.size(); ++m) { 493 for (int m = 0; m < messages.size(); ++m) {
494 const RepeatedPtrField<std::string>& subscription_ids = 494 const RepeatedPtrField<std::string>& subscription_ids =
495 messages.Get(m).subscription_id(); 495 messages.Get(m).subscription_id();
496 for (int s = 0; s < subscription_ids.size(); ++s) { 496 for (int s = 0; s < subscription_ids.size(); ++s) {
497 messages_by_subscription[subscription_ids.Get(s)].push_back( 497 messages_by_subscription[subscription_ids.Get(s)].push_back(
498 messages.Get(m).published_message()); 498 messages.Get(m).published_message());
499 } 499 }
500 } 500 }
501 501
502 // Send the messages for each subscription. 502 // Send the messages for each subscription.
503 for (std::map<std::string, std::vector<Message> >::const_iterator 503 for (std::map<std::string, std::vector<Message>>::const_iterator
504 subscription = messages_by_subscription.begin(); 504 subscription = messages_by_subscription.begin();
505 subscription != messages_by_subscription.end(); 505 subscription != messages_by_subscription.end();
506 ++subscription) { 506 ++subscription) {
507 // TODO(ckehoe): Once we have the app ID from the server, we need to pass 507 // TODO(ckehoe): Once we have the app ID from the server, we need to pass
508 // it in here and get rid of the app id registry from the main API class. 508 // it in here and get rid of the app id registry from the main API class.
509 delegate_->HandleMessages("", subscription->first, subscription->second); 509 delegate_->HandleMessages("", subscription->first, subscription->second);
510 } 510 }
511 } 511 }
512 512
513 RequestHeader* RpcHandler::CreateRequestHeader( 513 RequestHeader* RpcHandler::CreateRequestHeader(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 bool audible, 573 bool audible,
574 const WhispernetClient::SamplesCallback& samples_callback) { 574 const WhispernetClient::SamplesCallback& samples_callback) {
575 WhispernetClient* whispernet_client = delegate_->GetWhispernetClient(); 575 WhispernetClient* whispernet_client = delegate_->GetWhispernetClient();
576 if (whispernet_client) { 576 if (whispernet_client) {
577 whispernet_client->RegisterSamplesCallback(samples_callback); 577 whispernet_client->RegisterSamplesCallback(samples_callback);
578 whispernet_client->EncodeToken(token, audible); 578 whispernet_client->EncodeToken(token, audible);
579 } 579 }
580 } 580 }
581 581
582 } // namespace copresence 582 } // namespace copresence
OLDNEW
« no previous file with comments | « components/copresence/handlers/audio/audio_directive_handler.h ('k') | components/copresence/rpc/rpc_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698