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

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

Issue 273753005: Revert of 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: 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;
150 149
151 // Called on IO thread. 150 // Called on IO thread.
152 void Initialize(scoped_ptr<GCMClientFactory> gcm_client_factory, 151 void Initialize(scoped_ptr<GCMClientFactory> gcm_client_factory,
153 const base::FilePath& store_path, 152 const base::FilePath& store_path,
154 const std::vector<std::string>& account_ids, 153 const std::vector<std::string>& account_ids,
155 const scoped_refptr<net::URLRequestContextGetter>& 154 const scoped_refptr<net::URLRequestContextGetter>&
156 url_request_context_getter); 155 url_request_context_getter);
157 void Load(const base::WeakPtr<GCMService>& service); 156 void Load(const base::WeakPtr<GCMService>& service);
158 void Stop(); 157 void Stop();
159 void CheckOut(); 158 void CheckOut();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 send_error_details)); 289 send_error_details));
291 } 290 }
292 291
293 void GCMService::IOWorker::OnGCMReady() { 292 void GCMService::IOWorker::OnGCMReady() {
294 content::BrowserThread::PostTask(content::BrowserThread::UI, 293 content::BrowserThread::PostTask(content::BrowserThread::UI,
295 FROM_HERE, 294 FROM_HERE,
296 base::Bind(&GCMService::GCMClientReady, 295 base::Bind(&GCMService::GCMClientReady,
297 service_)); 296 service_));
298 } 297 }
299 298
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
307 void GCMService::IOWorker::Load(const base::WeakPtr<GCMService>& service) { 299 void GCMService::IOWorker::Load(const base::WeakPtr<GCMService>& service) {
308 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 300 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
309 301
310 service_ = service; 302 service_ = service;
311 gcm_client_->Load(); 303 gcm_client_->Load();
312 } 304 }
313 305
314 void GCMService::IOWorker::Stop() { 306 void GCMService::IOWorker::Stop() {
315 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 307 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
316 308
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 return iter == app_handlers_.end() ? &default_app_handler_ : iter->second; 841 return iter == app_handlers_.end() ? &default_app_handler_ : iter->second;
850 } 842 }
851 843
852 void GCMService::GetGCMStatisticsFinished( 844 void GCMService::GetGCMStatisticsFinished(
853 GCMClient::GCMStatistics stats) { 845 GCMClient::GCMStatistics stats) {
854 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 846 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
855 request_gcm_statistics_callback_.Run(stats); 847 request_gcm_statistics_callback_.Run(stats);
856 } 848 }
857 849
858 } // namespace gcm 850 } // 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