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

Side by Side Diff: components/copresence/copresence_manager_impl.cc

Issue 637223011: Redesign the copresence audio handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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/copresence_manager_impl.h" 5 #include "components/copresence/copresence_manager_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "components/copresence/public/copresence_delegate.h" 8 #include "components/copresence/public/copresence_delegate.h"
9 #include "components/copresence/public/whispernet_client.h" 9 #include "components/copresence/public/whispernet_client.h"
10 #include "components/copresence/rpc/rpc_handler.h" 10 #include "components/copresence/rpc/rpc_handler.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 void CopresenceManagerImpl::CompleteInitialization() { 59 void CopresenceManagerImpl::CompleteInitialization() {
60 if (pending_init_operations_) 60 if (pending_init_operations_)
61 return; 61 return;
62 62
63 DCHECK(rpc_handler_.get()); 63 DCHECK(rpc_handler_.get());
64 if (!init_failed_) 64 if (!init_failed_)
65 rpc_handler_->ConnectToWhispernet(); 65 rpc_handler_->ConnectToWhispernet();
66 66
67 for (PendingRequest& request : pending_requests_queue_) { 67 // for (PendingRequest& request : pending_requests_queue_) {
Daniel Erat 2014/10/17 22:25:59 delete this comment
Charlie 2014/10/17 22:42:25 ?
rkc 2014/10/18 00:21:54 Whoops, leftover from debugging. Done.
rkc 2014/10/18 00:21:54 Done.
Charlie 2014/10/18 00:44:11 Sorry, why can't we use the range-based version?
rkc 2014/10/18 00:51:30 Nothing, I had commented it out since I was debugg
68 for (size_t i = 0; i < pending_requests_queue_.size(); ++i) {
69 PendingRequest request = pending_requests_queue_[i];
68 if (init_failed_) { 70 if (init_failed_) {
69 request.callback.Run(FAIL); 71 request.callback.Run(FAIL);
70 } else { 72 } else {
71 rpc_handler_->SendReportRequest( 73 rpc_handler_->SendReportRequest(
72 make_scoped_ptr(new copresence::ReportRequest(request.report)), 74 make_scoped_ptr(new copresence::ReportRequest(request.report)),
73 request.app_id, 75 request.app_id,
74 request.callback); 76 request.callback);
75 } 77 }
76 } 78 }
77 pending_requests_queue_.clear(); 79 pending_requests_queue_.clear();
78 } 80 }
79 81
80 void CopresenceManagerImpl::InitStepComplete( 82 void CopresenceManagerImpl::InitStepComplete(
81 const std::string& step, bool success) { 83 const std::string& step, bool success) {
82 if (!success) { 84 if (!success) {
83 LOG(ERROR) << step << " failed!"; 85 LOG(ERROR) << step << " failed!";
84 init_failed_ = true; 86 init_failed_ = true;
85 } 87 }
86 88
87 DVLOG(3) << "Init step: " << step << " complete."; 89 DVLOG(3) << "Init step: " << step << " complete.";
88 pending_init_operations_--; 90 pending_init_operations_--;
89 CompleteInitialization(); 91 CompleteInitialization();
90 } 92 }
91 93
92 } // namespace copresence 94 } // namespace copresence
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698