Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| 11 | 11 |
| 12 namespace copresence { | 12 namespace copresence { |
| 13 | 13 |
| 14 PendingRequest::PendingRequest(const copresence::ReportRequest& report, | 14 PendingRequest::PendingRequest(const copresence::ReportRequest& report, |
| 15 const std::string app_id, | 15 const std::string app_id, |
| 16 const StatusCallback& callback) | 16 const StatusCallback& callback) |
| 17 : report(report), app_id(app_id), callback(callback) { | 17 : report(report), app_id(app_id), callback(callback) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 PendingRequest::~PendingRequest() { | 20 PendingRequest::~PendingRequest() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Public methods | 23 // Public methods |
| 24 | 24 |
| 25 CopresenceManagerImpl::~CopresenceManagerImpl() {} | 25 CopresenceManagerImpl::~CopresenceManagerImpl() { |
| 26 init_callback_.Cancel(); | |
|
Daniel Erat
2014/08/28 21:32:41
looking at CancelableCallback, i don't think you n
rkc
2014/08/28 21:51:50
Done.
| |
| 27 } | |
| 26 | 28 |
| 27 // Returns false if any operations were malformed. | 29 // Returns false if any operations were malformed. |
| 28 void CopresenceManagerImpl::ExecuteReportRequest( | 30 void CopresenceManagerImpl::ExecuteReportRequest( |
| 29 ReportRequest request, | 31 ReportRequest request, |
| 30 const std::string& app_id, | 32 const std::string& app_id, |
| 31 const StatusCallback& callback) { | 33 const StatusCallback& callback) { |
| 32 // Don't take on any more requests. We can't execute them since init failed. | 34 // Don't take on any more requests. We can't execute them since init failed. |
| 33 if (init_failed_) { | 35 if (init_failed_) { |
| 34 callback.Run(FAIL); | 36 callback.Run(FAIL); |
| 35 return; | 37 return; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 LOG(ERROR) << step << " failed!"; | 88 LOG(ERROR) << step << " failed!"; |
| 87 init_failed_ = true; | 89 init_failed_ = true; |
| 88 } | 90 } |
| 89 | 91 |
| 90 DVLOG(3) << "Init step: " << step << " complete."; | 92 DVLOG(3) << "Init step: " << step << " complete."; |
| 91 pending_init_operations_--; | 93 pending_init_operations_--; |
| 92 CompleteInitialization(); | 94 CompleteInitialization(); |
| 93 } | 95 } |
| 94 | 96 |
| 95 } // namespace copresence | 97 } // namespace copresence |
| OLD | NEW |