Index: components/copresence/copresence_client.cc |
diff --git a/components/copresence/copresence_client.cc b/components/copresence/copresence_client.cc |
index 60e45e15d2156368eddf0e575f1812e6339e9dc6..7cff41d8649277cbc16ca98f4bead7ca777ddce0 100644 |
--- a/components/copresence/copresence_client.cc |
+++ b/components/copresence/copresence_client.cc |
@@ -26,16 +26,17 @@ CopresenceClient::CopresenceClient(CopresenceClientDelegate* delegate) |
: delegate_(delegate), init_failed_(false), pending_init_operations_(0) { |
DVLOG(3) << "Initializing client."; |
pending_init_operations_++; |
- rpc_handler_.reset( |
- new RpcHandler(delegate, |
- base::Bind(&CopresenceClient::InitStepComplete, |
- AsWeakPtr(), |
- "Copresence device registration"))); |
+ rpc_handler_.reset(new RpcHandler(delegate)); |
+ // We own the RpcHandler, so it won't outlive us. |
+ rpc_handler_->Initialize(base::Bind(&CopresenceClient::InitStepComplete, |
+ base::Unretained(this), |
+ "Copresence device registration")); |
pending_init_operations_++; |
delegate_->GetWhispernetClient()->Initialize( |
base::Bind(&CopresenceClient::InitStepComplete, |
- AsWeakPtr(), |
+ // The WhispernetClient should clear this on Shutdown. |
+ base::Unretained(this), |
"Whispernet proxy initialization")); |
} |
@@ -45,7 +46,7 @@ CopresenceClient::~CopresenceClient() { |
void CopresenceClient::Shutdown() { |
rkc
2014/08/07 22:49:51
Get rid of Shutdown. We aren't using it anymore fr
Charlie
2014/08/07 23:33:04
Done. Except we still need to notify WhispernetCli
|
DVLOG(3) << "Shutting down client."; |
delegate_->GetWhispernetClient()->Shutdown(); |
- rpc_handler_->DisconnectFromWhispernet(); |
+ rpc_handler_->Shutdown(); |
} |
// Returns false if any operations were malformed. |
@@ -76,7 +77,7 @@ void CopresenceClient::CompleteInitialization() { |
return; |
if (!init_failed_) |
- rpc_handler_->ConnectToWhispernet(delegate_->GetWhispernetClient()); |
+ rpc_handler_->ConnectToWhispernet(); |
for (std::vector<PendingRequest>::iterator request = |
pending_requests_queue_.begin(); |