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

Side by Side Diff: chrome/browser/metrics/metrics_service.cc

Issue 291843008: [Metrics] Fetch more embedder concepts via MetricsServiceClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 //------------------------------------------------------------------------------ 5 //------------------------------------------------------------------------------
6 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It is 10 // A MetricsService instance is typically created at application startup. It is
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 #include "base/values.h" 184 #include "base/values.h"
185 #include "chrome/browser/browser_process.h" 185 #include "chrome/browser/browser_process.h"
186 #include "chrome/browser/chrome_notification_types.h" 186 #include "chrome/browser/chrome_notification_types.h"
187 #include "chrome/browser/io_thread.h" 187 #include "chrome/browser/io_thread.h"
188 #include "chrome/browser/metrics/compression_utils.h" 188 #include "chrome/browser/metrics/compression_utils.h"
189 #include "chrome/browser/metrics/metrics_log.h" 189 #include "chrome/browser/metrics/metrics_log.h"
190 #include "chrome/browser/metrics/metrics_state_manager.h" 190 #include "chrome/browser/metrics/metrics_state_manager.h"
191 #include "chrome/browser/metrics/network_metrics_provider.h" 191 #include "chrome/browser/metrics/network_metrics_provider.h"
192 #include "chrome/browser/metrics/omnibox_metrics_provider.h" 192 #include "chrome/browser/metrics/omnibox_metrics_provider.h"
193 #include "chrome/browser/metrics/tracking_synchronizer.h" 193 #include "chrome/browser/metrics/tracking_synchronizer.h"
194 #include "chrome/browser/ui/browser_otr_state.h"
195 #include "chrome/common/chrome_constants.h" 194 #include "chrome/common/chrome_constants.h"
196 #include "chrome/common/crash_keys.h"
197 #include "chrome/common/pref_names.h" 195 #include "chrome/common/pref_names.h"
198 #include "chrome/common/variations/variations_util.h" 196 #include "chrome/common/variations/variations_util.h"
199 #include "components/metrics/metrics_log_base.h" 197 #include "components/metrics/metrics_log_base.h"
200 #include "components/metrics/metrics_log_manager.h" 198 #include "components/metrics/metrics_log_manager.h"
201 #include "components/metrics/metrics_pref_names.h" 199 #include "components/metrics/metrics_pref_names.h"
202 #include "components/metrics/metrics_reporting_scheduler.h" 200 #include "components/metrics/metrics_reporting_scheduler.h"
203 #include "components/metrics/metrics_service_client.h" 201 #include "components/metrics/metrics_service_client.h"
204 #include "components/variations/entropy_provider.h" 202 #include "components/variations/entropy_provider.h"
205 #include "components/variations/metrics_util.h" 203 #include "components/variations/metrics_util.h"
206 #include "content/public/browser/child_process_data.h" 204 #include "content/public/browser/child_process_data.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 } 539 }
542 540
543 void MetricsService::EnableRecording() { 541 void MetricsService::EnableRecording() {
544 DCHECK(IsSingleThreaded()); 542 DCHECK(IsSingleThreaded());
545 543
546 if (recording_active_) 544 if (recording_active_)
547 return; 545 return;
548 recording_active_ = true; 546 recording_active_ = true;
549 547
550 state_manager_->ForceClientIdCreation(); 548 state_manager_->ForceClientIdCreation();
551 crash_keys::SetClientID(state_manager_->client_id()); 549 client_->SetClientID(state_manager_->client_id());
552 if (!log_manager_.current_log()) 550 if (!log_manager_.current_log())
553 OpenNewLog(); 551 OpenNewLog();
554 552
555 for (size_t i = 0; i < metrics_providers_.size(); ++i) 553 for (size_t i = 0; i < metrics_providers_.size(); ++i)
556 metrics_providers_[i]->OnRecordingEnabled(); 554 metrics_providers_[i]->OnRecordingEnabled();
557 555
558 SetUpNotifications(&registrar_, this); 556 SetUpNotifications(&registrar_, this);
559 base::RemoveActionCallback(action_callback_); 557 base::RemoveActionCallback(action_callback_);
560 action_callback_ = base::Bind(&MetricsService::OnUserAction, 558 action_callback_ = base::Bind(&MetricsService::OnUserAction,
561 base::Unretained(this)); 559 base::Unretained(this));
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 stats.loading_errors); 1755 stats.loading_errors);
1758 plugins->Append(plugin_dict); 1756 plugins->Append(plugin_dict);
1759 } 1757 }
1760 child_process_stats_buffer_.clear(); 1758 child_process_stats_buffer_.clear();
1761 } 1759 }
1762 1760
1763 bool MetricsService::ShouldLogEvents() { 1761 bool MetricsService::ShouldLogEvents() {
1764 // We simply don't log events to UMA if there is a single incognito 1762 // We simply don't log events to UMA if there is a single incognito
1765 // session visible. The problem is that we always notify using the orginal 1763 // session visible. The problem is that we always notify using the orginal
1766 // profile in order to simplify notification processing. 1764 // profile in order to simplify notification processing.
1767 return !chrome::IsOffTheRecordSessionActive(); 1765 return !client_->IsOffTheRecordSessionActive();
1768 } 1766 }
1769 1767
1770 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { 1768 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) {
1771 DCHECK(IsSingleThreaded()); 1769 DCHECK(IsSingleThreaded());
1772 1770
1773 PrefService* pref = g_browser_process->local_state(); 1771 PrefService* pref = g_browser_process->local_state();
1774 DCHECK(pref); 1772 DCHECK(pref);
1775 1773
1776 pref->SetBoolean(path, value); 1774 pref->SetBoolean(path, value);
1777 RecordCurrentState(pref); 1775 RecordCurrentState(pref);
1778 } 1776 }
1779 1777
1780 void MetricsService::RecordCurrentState(PrefService* pref) { 1778 void MetricsService::RecordCurrentState(PrefService* pref) {
1781 pref->SetInt64(prefs::kStabilityLastTimestampSec, Time::Now().ToTimeT()); 1779 pref->SetInt64(prefs::kStabilityLastTimestampSec, Time::Now().ToTimeT());
1782 1780
1783 RecordPluginChanges(pref); 1781 RecordPluginChanges(pref);
1784 } 1782 }
1785 1783
1786 // static 1784 // static
1787 bool MetricsService::IsPluginProcess(int process_type) { 1785 bool MetricsService::IsPluginProcess(int process_type) {
1788 return (process_type == content::PROCESS_TYPE_PLUGIN || 1786 return (process_type == content::PROCESS_TYPE_PLUGIN ||
1789 process_type == content::PROCESS_TYPE_PPAPI_PLUGIN || 1787 process_type == content::PROCESS_TYPE_PPAPI_PLUGIN ||
1790 process_type == content::PROCESS_TYPE_PPAPI_BROKER); 1788 process_type == content::PROCESS_TYPE_PPAPI_BROKER);
1791 } 1789 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698