Chromium Code Reviews| Index: chrome/browser/services/gcm/gcm_service.cc |
| diff --git a/chrome/browser/services/gcm/gcm_service.cc b/chrome/browser/services/gcm/gcm_service.cc |
| index 0b5c74dc601e0143b80e6e65927317069ebc740f..32e78b796cfca50428eb182729d0c78974b56b4c 100644 |
| --- a/chrome/browser/services/gcm/gcm_service.cc |
| +++ b/chrome/browser/services/gcm/gcm_service.cc |
| @@ -146,6 +146,7 @@ class GCMService::IOWorker : public GCMClient::Delegate { |
| const std::string& app_id, |
| const GCMClient::SendErrorDetails& send_error_details) OVERRIDE; |
| virtual void OnGCMReady() OVERRIDE; |
| + virtual void OnActivityRecorded() OVERRIDE; |
| // Called on IO thread. |
| void Initialize(scoped_ptr<GCMClientFactory> gcm_client_factory, |
| @@ -296,6 +297,13 @@ void GCMService::IOWorker::OnGCMReady() { |
| service_)); |
| } |
| +void GCMService::IOWorker::OnActivityRecorded() { |
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| + // When an activity is recorded, get all the stats and refresh the UI of |
| + // gcm-internals page. |
| + GetGCMStatistics(false); |
| +} |
| + |
| void GCMService::IOWorker::Load(const base::WeakPtr<GCMService>& service) { |
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| @@ -844,7 +852,8 @@ GCMAppHandler* GCMService::GetAppHandler(const std::string& app_id) { |
| void GCMService::GetGCMStatisticsFinished( |
| GCMClient::GCMStatistics stats) { |
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| - request_gcm_statistics_callback_.Run(stats); |
| + if (!request_gcm_statistics_callback_.is_null()) |
|
jianli
2014/05/09 17:26:27
Please comment on why the callback could be NULL.
juyik
2014/05/09 18:40:04
Normally it would not be NULL, unless it is trigge
|
| + request_gcm_statistics_callback_.Run(stats); |
| } |
| } // namespace gcm |