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

Unified Diff: components/gcm_driver/gcm_driver_desktop.cc

Issue 2473813002: Notify GCMAppHandlers when the store is reset, so they clear cached IDs (Closed)
Patch Set: Update Cryptauth comment Created 4 years, 1 month 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 | « components/gcm_driver/gcm_driver_desktop.h ('k') | components/invalidation/impl/gcm_invalidation_bridge.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop.h ('k') | components/invalidation/impl/gcm_invalidation_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698