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

Side by Side Diff: components/gcm_driver/gcm_driver_desktop.cc

Issue 1707513002: Add various UMA histograms for measuring GCM crypto performance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcm-remove-info
Patch Set: android fix Created 4 years, 10 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
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 "components/gcm_driver/gcm_driver_desktop.h" 5 #include "components/gcm_driver/gcm_driver_desktop.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 void GetInstanceIDData(const std::string& app_id); 101 void GetInstanceIDData(const std::string& app_id);
102 void GetToken(const std::string& app_id, 102 void GetToken(const std::string& app_id,
103 const std::string& authorized_entity, 103 const std::string& authorized_entity,
104 const std::string& scope, 104 const std::string& scope,
105 const std::map<std::string, std::string>& options); 105 const std::map<std::string, std::string>& options);
106 void DeleteToken(const std::string& app_id, 106 void DeleteToken(const std::string& app_id,
107 const std::string& authorized_entity, 107 const std::string& authorized_entity,
108 const std::string& scope); 108 const std::string& scope);
109 109
110 void RecordDecryptionFailure(const std::string& app_id, 110 void RecordDecryptionFailure(const std::string& app_id,
111 GCMEncryptionProvider::DecryptionFailure reason); 111 GCMEncryptionProvider::DecryptionResult result);
112 112
113 // For testing purpose. Can be called from UI thread. Use with care. 113 // For testing purpose. Can be called from UI thread. Use with care.
114 GCMClient* gcm_client_for_testing() const { return gcm_client_.get(); } 114 GCMClient* gcm_client_for_testing() const { return gcm_client_.get(); }
115 115
116 private: 116 private:
117 scoped_refptr<base::SequencedTaskRunner> ui_thread_; 117 scoped_refptr<base::SequencedTaskRunner> ui_thread_;
118 scoped_refptr<base::SequencedTaskRunner> io_thread_; 118 scoped_refptr<base::SequencedTaskRunner> io_thread_;
119 119
120 base::WeakPtr<GCMDriverDesktop> service_; 120 base::WeakPtr<GCMDriverDesktop> service_;
121 121
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 } 494 }
495 495
496 void GCMDriverDesktop::IOWorker::RemoveHeartbeatInterval( 496 void GCMDriverDesktop::IOWorker::RemoveHeartbeatInterval(
497 const std::string& scope) { 497 const std::string& scope) {
498 DCHECK(io_thread_->RunsTasksOnCurrentThread()); 498 DCHECK(io_thread_->RunsTasksOnCurrentThread());
499 gcm_client_->RemoveHeartbeatInterval(scope); 499 gcm_client_->RemoveHeartbeatInterval(scope);
500 } 500 }
501 501
502 void GCMDriverDesktop::IOWorker::RecordDecryptionFailure( 502 void GCMDriverDesktop::IOWorker::RecordDecryptionFailure(
503 const std::string& app_id, 503 const std::string& app_id,
504 GCMEncryptionProvider::DecryptionFailure reason) { 504 GCMEncryptionProvider::DecryptionResult result) {
505 DCHECK(io_thread_->RunsTasksOnCurrentThread()); 505 DCHECK(io_thread_->RunsTasksOnCurrentThread());
506 gcm_client_->RecordDecryptionFailure(app_id, reason); 506 gcm_client_->RecordDecryptionFailure(app_id, result);
507 } 507 }
508 508
509 GCMDriverDesktop::GCMDriverDesktop( 509 GCMDriverDesktop::GCMDriverDesktop(
510 scoped_ptr<GCMClientFactory> gcm_client_factory, 510 scoped_ptr<GCMClientFactory> gcm_client_factory,
511 const GCMClient::ChromeBuildInfo& chrome_build_info, 511 const GCMClient::ChromeBuildInfo& chrome_build_info,
512 const std::string& channel_status_request_url, 512 const std::string& channel_status_request_url,
513 const std::string& user_agent, 513 const std::string& user_agent,
514 PrefService* prefs, 514 PrefService* prefs,
515 const base::FilePath& store_path, 515 const base::FilePath& store_path,
516 const scoped_refptr<net::URLRequestContextGetter>& request_context, 516 const scoped_refptr<net::URLRequestContextGetter>& request_context,
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 FROM_HERE, 727 FROM_HERE,
728 base::Bind(&GCMDriverDesktop::IOWorker::Send, 728 base::Bind(&GCMDriverDesktop::IOWorker::Send,
729 base::Unretained(io_worker_.get()), 729 base::Unretained(io_worker_.get()),
730 app_id, 730 app_id,
731 receiver_id, 731 receiver_id,
732 message)); 732 message));
733 } 733 }
734 734
735 void GCMDriverDesktop::RecordDecryptionFailure( 735 void GCMDriverDesktop::RecordDecryptionFailure(
736 const std::string& app_id, 736 const std::string& app_id,
737 GCMEncryptionProvider::DecryptionFailure reason) { 737 GCMEncryptionProvider::DecryptionResult result) {
738 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); 738 DCHECK(ui_thread_->RunsTasksOnCurrentThread());
739 io_thread_->PostTask( 739 io_thread_->PostTask(
740 FROM_HERE, 740 FROM_HERE,
741 base::Bind(&GCMDriverDesktop::IOWorker::RecordDecryptionFailure, 741 base::Bind(&GCMDriverDesktop::IOWorker::RecordDecryptionFailure,
742 base::Unretained(io_worker_.get()), 742 base::Unretained(io_worker_.get()),
743 app_id, reason)); 743 app_id, result));
744 } 744 }
745 745
746 GCMClient* GCMDriverDesktop::GetGCMClientForTesting() const { 746 GCMClient* GCMDriverDesktop::GetGCMClientForTesting() const {
747 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); 747 DCHECK(ui_thread_->RunsTasksOnCurrentThread());
748 return io_worker_ ? io_worker_->gcm_client_for_testing() : NULL; 748 return io_worker_ ? io_worker_->gcm_client_for_testing() : NULL;
749 } 749 }
750 750
751 bool GCMDriverDesktop::IsStarted() const { 751 bool GCMDriverDesktop::IsStarted() const {
752 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); 752 DCHECK(ui_thread_->RunsTasksOnCurrentThread());
753 return gcm_started_; 753 return gcm_started_;
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 1322
1323 if (base::get<1>(a) < base::get<1>(b)) 1323 if (base::get<1>(a) < base::get<1>(b))
1324 return true; 1324 return true;
1325 if (base::get<1>(a) > base::get<1>(b)) 1325 if (base::get<1>(a) > base::get<1>(b))
1326 return false; 1326 return false;
1327 1327
1328 return base::get<2>(a) < base::get<2>(b); 1328 return base::get<2>(a) < base::get<2>(b);
1329 } 1329 }
1330 1330
1331 } // namespace gcm 1331 } // namespace gcm
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop.h ('k') | components/gcm_driver/gcm_stats_recorder_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698