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

Side by Side Diff: chrome/browser/services/gcm/gcm_service.cc

Issue 266913015: Enable auto-refreshing of the gcm-internals page whenever a GCM activity is recorded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing nicolas's comments and merge changes. Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | google_apis/gcm/gcm_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/services/gcm/gcm_service.h" 5 #include "chrome/browser/services/gcm/gcm_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 const std::string& message_id, 139 const std::string& message_id,
140 GCMClient::Result result) OVERRIDE; 140 GCMClient::Result result) OVERRIDE;
141 virtual void OnMessageReceived( 141 virtual void OnMessageReceived(
142 const std::string& app_id, 142 const std::string& app_id,
143 const GCMClient::IncomingMessage& message) OVERRIDE; 143 const GCMClient::IncomingMessage& message) OVERRIDE;
144 virtual void OnMessagesDeleted(const std::string& app_id) OVERRIDE; 144 virtual void OnMessagesDeleted(const std::string& app_id) OVERRIDE;
145 virtual void OnMessageSendError( 145 virtual void OnMessageSendError(
146 const std::string& app_id, 146 const std::string& app_id,
147 const GCMClient::SendErrorDetails& send_error_details) OVERRIDE; 147 const GCMClient::SendErrorDetails& send_error_details) OVERRIDE;
148 virtual void OnGCMReady() OVERRIDE; 148 virtual void OnGCMReady() OVERRIDE;
149 virtual void OnActivityRecorded() OVERRIDE;
149 150
150 // Called on IO thread. 151 // Called on IO thread.
151 void Initialize(scoped_ptr<GCMClientFactory> gcm_client_factory, 152 void Initialize(scoped_ptr<GCMClientFactory> gcm_client_factory,
152 const base::FilePath& store_path, 153 const base::FilePath& store_path,
153 const std::vector<std::string>& account_ids, 154 const std::vector<std::string>& account_ids,
154 const scoped_refptr<net::URLRequestContextGetter>& 155 const scoped_refptr<net::URLRequestContextGetter>&
155 url_request_context_getter); 156 url_request_context_getter);
156 void Load(const base::WeakPtr<GCMService>& service); 157 void Load(const base::WeakPtr<GCMService>& service);
157 void Stop(); 158 void Stop();
158 void CheckOut(); 159 void CheckOut();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 send_error_details)); 290 send_error_details));
290 } 291 }
291 292
292 void GCMService::IOWorker::OnGCMReady() { 293 void GCMService::IOWorker::OnGCMReady() {
293 content::BrowserThread::PostTask(content::BrowserThread::UI, 294 content::BrowserThread::PostTask(content::BrowserThread::UI,
294 FROM_HERE, 295 FROM_HERE,
295 base::Bind(&GCMService::GCMClientReady, 296 base::Bind(&GCMService::GCMClientReady,
296 service_)); 297 service_));
297 } 298 }
298 299
300 void GCMService::IOWorker::OnActivityRecorded() {
301 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
302 // When an activity is recorded, get all the stats and refresh the UI of
303 // gcm-internals page.
304 GetGCMStatistics(false);
305 }
306
299 void GCMService::IOWorker::Load(const base::WeakPtr<GCMService>& service) { 307 void GCMService::IOWorker::Load(const base::WeakPtr<GCMService>& service) {
300 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 308 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
301 309
302 service_ = service; 310 service_ = service;
303 gcm_client_->Load(); 311 gcm_client_->Load();
304 } 312 }
305 313
306 void GCMService::IOWorker::Stop() { 314 void GCMService::IOWorker::Stop() {
307 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 315 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
308 316
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 return iter == app_handlers_.end() ? &default_app_handler_ : iter->second; 849 return iter == app_handlers_.end() ? &default_app_handler_ : iter->second;
842 } 850 }
843 851
844 void GCMService::GetGCMStatisticsFinished( 852 void GCMService::GetGCMStatisticsFinished(
845 GCMClient::GCMStatistics stats) { 853 GCMClient::GCMStatistics stats) {
846 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 854 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
847 request_gcm_statistics_callback_.Run(stats); 855 request_gcm_statistics_callback_.Run(stats);
848 } 856 }
849 857
850 } // namespace gcm 858 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | google_apis/gcm/gcm_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698