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

Unified Diff: components/gcm_driver/gcm_driver.cc

Issue 618003002: [GCM] Handling connection events in GCMAccountTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing to Jian Li's patch and addressing unit tests failures Created 6 years, 2 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 | « components/gcm_driver/gcm_account_mapper_unittest.cc ('k') | components/gcm_driver/gcm_driver_desktop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/gcm_driver.cc
diff --git a/components/gcm_driver/gcm_driver.cc b/components/gcm_driver/gcm_driver.cc
index e9ff81975aac5f9d4b4bd064bcf67c4216761314..9882264d6c85b13910c3d8b8ea5959f7d8323285 100644
--- a/components/gcm_driver/gcm_driver.cc
+++ b/components/gcm_driver/gcm_driver.cc
@@ -151,8 +151,13 @@ void GCMDriver::SendFinished(const std::string& app_id,
void GCMDriver::Shutdown() {
for (GCMAppHandlerMap::const_iterator iter = app_handlers_.begin();
- iter != app_handlers_.end(); ++iter) {
- iter->second->ShutdownHandler();
+ iter != app_handlers_.end();) {
fgorski 2014/10/03 18:03:32 Jian Li, what do you think about this update?
+ DVLOG(1) << "Calling ShutdownHandler for: " << iter->first;
+ GCMAppHandler* handler = iter->second;
+ // Incrementing here, to make sure calls to RemoveAppHandler from
+ // ShutdownHandler don't invalidate the iterator.
+ ++iter;
+ handler->ShutdownHandler();
}
app_handlers_.clear();
}
@@ -163,11 +168,13 @@ void GCMDriver::AddAppHandler(const std::string& app_id,
DCHECK(handler);
DCHECK_EQ(app_handlers_.count(app_id), 0u);
app_handlers_[app_id] = handler;
+ DVLOG(1) << "App handler added for: " << app_id;
}
void GCMDriver::RemoveAppHandler(const std::string& app_id) {
DCHECK(!app_id.empty());
app_handlers_.erase(app_id);
+ DVLOG(1) << "App handler removed for: " << app_id;
}
GCMAppHandler* GCMDriver::GetAppHandler(const std::string& app_id) {
« no previous file with comments | « components/gcm_driver/gcm_account_mapper_unittest.cc ('k') | components/gcm_driver/gcm_driver_desktop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698