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/public/copresence_client.h" | 5 #include "components/copresence/public/copresence_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "components/copresence/public/copresence_client_delegate.h" | 8 #include "components/copresence/public/copresence_client_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 11 matching lines...) Expand all Loading... | |
| 22 | 22 |
| 23 // Public methods | 23 // Public methods |
| 24 | 24 |
| 25 CopresenceClient::CopresenceClient(CopresenceClientDelegate* delegate) | 25 CopresenceClient::CopresenceClient(CopresenceClientDelegate* delegate) |
| 26 : delegate_(delegate), init_failed_(false), pending_init_operations_(0) { | 26 : delegate_(delegate), init_failed_(false), pending_init_operations_(0) { |
| 27 DVLOG(3) << "Initializing client."; | 27 DVLOG(3) << "Initializing client."; |
| 28 pending_init_operations_++; | 28 pending_init_operations_++; |
| 29 rpc_handler_.reset(new RpcHandler(delegate)); | 29 rpc_handler_.reset(new RpcHandler(delegate)); |
| 30 // We own the RpcHandler, so it won't outlive us. | 30 // We own the RpcHandler, so it won't outlive us. |
| 31 rpc_handler_->Initialize(base::Bind(&CopresenceClient::InitStepComplete, | 31 rpc_handler_->Initialize(base::Bind(&CopresenceClient::InitStepComplete, |
| 32 base::Unretained(this), | 32 AsWeakPtr(), |
|
xiyuan
2014/08/08 20:40:53
If comment at line 30 is true, this change is not
rkc
2014/08/08 21:24:37
This code will go away with the RPC handler rebase
| |
| 33 "Copresence device registration")); | 33 "Copresence device registration")); |
| 34 | 34 |
| 35 pending_init_operations_++; | 35 pending_init_operations_++; |
| 36 delegate_->GetWhispernetClient()->Initialize( | 36 delegate_->GetWhispernetClient()->Initialize( |
| 37 base::Bind(&CopresenceClient::InitStepComplete, | 37 base::Bind(&CopresenceClient::InitStepComplete, |
| 38 // The WhispernetClient must discard this on Shutdown. | 38 // The WhispernetClient must discard this on Shutdown. |
| 39 base::Unretained(this), | 39 base::Unretained(this), |
| 40 "Whispernet proxy initialization")); | 40 "Whispernet proxy initialization")); |
| 41 } | 41 } |
| 42 | 42 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 LOG(ERROR) << step << " failed!"; | 95 LOG(ERROR) << step << " failed!"; |
| 96 init_failed_ = true; | 96 init_failed_ = true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 DVLOG(3) << "Init step: " << step << " complete."; | 99 DVLOG(3) << "Init step: " << step << " complete."; |
| 100 pending_init_operations_--; | 100 pending_init_operations_--; |
| 101 CompleteInitialization(); | 101 CompleteInitialization(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace copresence | 104 } // namespace copresence |
| OLD | NEW |