Index: components/gcm_driver/gcm_driver_desktop.cc |
diff --git a/components/gcm_driver/gcm_driver_desktop.cc b/components/gcm_driver/gcm_driver_desktop.cc |
index 7015990337a46d494be2a7bc3ee77324a472623b..599957d2a5979fced996c2440031f4cee4344b7c 100644 |
--- a/components/gcm_driver/gcm_driver_desktop.cc |
+++ b/components/gcm_driver/gcm_driver_desktop.cc |
@@ -66,6 +66,7 @@ class GCMDriverDesktop::IOWorker : public GCMClient::Delegate { |
void OnActivityRecorded() override; |
void OnConnected(const net::IPEndPoint& ip_endpoint) override; |
void OnDisconnected() override; |
+ void OnStoreReset() override; |
// Called on IO thread. |
void Initialize( |
@@ -303,6 +304,11 @@ void GCMDriverDesktop::IOWorker::OnDisconnected() { |
base::Bind(&GCMDriverDesktop::OnDisconnected, service_)); |
} |
+void GCMDriverDesktop::IOWorker::OnStoreReset() { |
+ ui_thread_->PostTask(FROM_HERE, |
+ base::Bind(&GCMDriverDesktop::OnStoreReset, service_)); |
+} |
+ |
void GCMDriverDesktop::IOWorker::Start( |
GCMClient::StartMode start_mode, |
const base::WeakPtr<GCMDriverDesktop>& service) { |
@@ -1300,6 +1306,17 @@ void GCMDriverDesktop::OnDisconnected() { |
observer.OnDisconnected(); |
} |
+void GCMDriverDesktop::OnStoreReset() { |
+ // Defensive copy in case OnStoreReset calls Add/RemoveAppHandler. |
+ std::vector<GCMAppHandler*> app_handler_values; |
+ for (const auto& key_value : app_handlers()) |
+ app_handler_values.push_back(key_value.second); |
+ for (GCMAppHandler* app_handler : app_handler_values) { |
+ app_handler->OnStoreReset(); |
+ // app_handler might now have been deleted. |
+ } |
+} |
+ |
void GCMDriverDesktop::GetGCMStatisticsFinished( |
const GCMClient::GCMStatistics& stats) { |
DCHECK(ui_thread_->RunsTasksOnCurrentThread()); |