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

Unified Diff: components/copresence/copresence_manager.cc

Issue 517753002: Remove weak_ptr from CopresenceManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/copresence/copresence_manager_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/copresence/copresence_manager.cc
diff --git a/components/copresence/copresence_manager.cc b/components/copresence/copresence_manager.cc
index fa89006376fd2d9f5e56f85bc3a6b6249aaf510f..3a4e73c9c9547f8d6a7dad4ef0b04528b07c09cc 100644
--- a/components/copresence/copresence_manager.cc
+++ b/components/copresence/copresence_manager.cc
@@ -23,14 +23,17 @@ scoped_ptr<CopresenceManager> CopresenceManager::Create(
base::Unretained(manager),
"Copresence device registration"));
+ // This callback will be canceled on manager's destruction, hence unretained
+ // is safe to use here.
+ manager->init_callback_.Reset(
+ base::Bind(&CopresenceManagerImpl::InitStepComplete,
+ base::Unretained(manager),
+ "Whispernet proxy initialization"));
+
manager->pending_init_operations_++;
DCHECK(delegate->GetWhispernetClient());
delegate->GetWhispernetClient()->Initialize(
- base::Bind(&CopresenceManagerImpl::InitStepComplete,
- // We cannot cancel WhispernetClient initialization.
- // TODO(ckehoe): Get rid of this.
- manager->AsWeakPtr(),
- "Whispernet proxy initialization"));
+ manager->init_callback_.callback());
return make_scoped_ptr<CopresenceManager>(manager);
}
« no previous file with comments | « no previous file | components/copresence/copresence_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698