| Index: chrome/browser/chromeos/contacts/contact_manager.cc
|
| diff --git a/chrome/browser/chromeos/contacts/contact_manager.cc b/chrome/browser/chromeos/contacts/contact_manager.cc
|
| index ee9db7518ab7a81c9d4cb5afb6fa7db5bb320ae2..fe10537179d4bbc891f25fe7dff853353f83c8a1 100644
|
| --- a/chrome/browser/chromeos/contacts/contact_manager.cc
|
| +++ b/chrome/browser/chromeos/contacts/contact_manager.cc
|
| @@ -37,7 +37,8 @@ ContactManager* ContactManager::GetInstance() {
|
| ContactManager::ContactManager()
|
| : profile_observers_deleter_(&profile_observers_),
|
| contact_store_factory_(new GoogleContactStoreFactory),
|
| - contact_stores_deleter_(&contact_stores_) {
|
| + contact_stores_deleter_(&contact_stores_),
|
| + ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| DCHECK(!g_instance);
|
| g_instance = this;
|
| @@ -46,6 +47,7 @@ ContactManager::ContactManager()
|
| ContactManager::~ContactManager() {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| DCHECK_EQ(g_instance, this);
|
| + weak_ptr_factory_.InvalidateWeakPtrs();
|
| g_instance = NULL;
|
| for (ContactStoreMap::const_iterator it = contact_stores_.begin();
|
| it != contact_stores_.end(); ++it) {
|
| @@ -77,6 +79,11 @@ void ContactManager::Init() {
|
| HandleProfileCreated(profiles[i]);
|
| }
|
|
|
| +base::WeakPtr<ContactManagerInterface> ContactManager::GetWeakPtr() {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + return weak_ptr_factory_.GetWeakPtr();
|
| +}
|
| +
|
| void ContactManager::AddObserver(ContactManagerObserver* observer,
|
| Profile* profile) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|