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

Side by Side Diff: chrome/browser/chromeos/external_metrics.cc

Issue 292433015: Refactor MetricsLogChromeOS to ChromeOSMetricsProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fixes 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 | chrome/browser/metrics/chromeos_metrics_provider.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 (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 #include "chrome/browser/chromeos/external_metrics.h" 5 #include "chrome/browser/chromeos/external_metrics.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
11 #include <sys/file.h> 11 #include <sys/file.h>
12 #include <sys/stat.h> 12 #include <sys/stat.h>
13 #include <sys/types.h> 13 #include <sys/types.h>
14 #include <unistd.h> 14 #include <unistd.h>
15 15
16 #include <map> 16 #include <map>
17 #include <string> 17 #include <string>
18 18
19 #include "base/basictypes.h" 19 #include "base/basictypes.h"
20 #include "base/bind.h" 20 #include "base/bind.h"
21 #include "base/file_util.h" 21 #include "base/file_util.h"
22 #include "base/files/file_path.h" 22 #include "base/files/file_path.h"
23 #include "base/metrics/field_trial.h"
23 #include "base/metrics/histogram.h" 24 #include "base/metrics/histogram.h"
24 #include "base/metrics/sparse_histogram.h" 25 #include "base/metrics/sparse_histogram.h"
25 #include "base/metrics/statistics_recorder.h" 26 #include "base/metrics/statistics_recorder.h"
26 #include "base/posix/eintr_wrapper.h" 27 #include "base/posix/eintr_wrapper.h"
27 #include "base/sys_info.h" 28 #include "base/sys_info.h"
28 #include "base/time/time.h" 29 #include "base/time/time.h"
29 #include "base/timer/elapsed_timer.h" 30 #include "base/timer/elapsed_timer.h"
30 #include "chrome/browser/browser_process.h" 31 #include "chrome/browser/browser_process.h"
31 #include "chrome/browser/metrics/metrics_service.h" 32 #include "chrome/browser/metrics/chromeos_metrics_provider.h"
32 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
33 #include "content/public/browser/user_metrics.h" 34 #include "content/public/browser/user_metrics.h"
34 35
35 using base::UserMetricsAction; 36 using base::UserMetricsAction;
36 using content::BrowserThread; 37 using content::BrowserThread;
37 38
38 namespace chromeos { 39 namespace chromeos {
39 40
40 namespace { 41 namespace {
41 42
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 143 }
143 144
144 void ExternalMetrics::RecordAction(const char* action) { 145 void ExternalMetrics::RecordAction(const char* action) {
145 std::string action_string(action); 146 std::string action_string(action);
146 BrowserThread::PostTask( 147 BrowserThread::PostTask(
147 BrowserThread::UI, FROM_HERE, 148 BrowserThread::UI, FROM_HERE,
148 base::Bind(&ExternalMetrics::RecordActionUI, this, action_string)); 149 base::Bind(&ExternalMetrics::RecordActionUI, this, action_string));
149 } 150 }
150 151
151 void ExternalMetrics::RecordCrashUI(const std::string& crash_kind) { 152 void ExternalMetrics::RecordCrashUI(const std::string& crash_kind) {
152 if (g_browser_process && g_browser_process->metrics_service()) { 153 ChromeOSMetricsProvider::LogCrash(crash_kind);
153 g_browser_process->metrics_service()->LogChromeOSCrash(crash_kind);
154 }
155 } 154 }
156 155
157 void ExternalMetrics::RecordCrash(const std::string& crash_kind) { 156 void ExternalMetrics::RecordCrash(const std::string& crash_kind) {
158 BrowserThread::PostTask( 157 BrowserThread::PostTask(
159 BrowserThread::UI, FROM_HERE, 158 BrowserThread::UI, FROM_HERE,
160 base::Bind(&ExternalMetrics::RecordCrashUI, this, crash_kind)); 159 base::Bind(&ExternalMetrics::RecordCrashUI, this, crash_kind));
161 } 160 }
162 161
163 void ExternalMetrics::RecordHistogram(const char* histogram_data) { 162 void ExternalMetrics::RecordHistogram(const char* histogram_data) {
164 int sample, min, max, nbuckets; 163 int sample, min, max, nbuckets;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 void ExternalMetrics::SetupFieldTrialsOnFileThread() { 351 void ExternalMetrics::SetupFieldTrialsOnFileThread() {
353 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 352 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
354 // Field trials that do not read from files can be initialized in 353 // Field trials that do not read from files can be initialized in
355 // ExternalMetrics::Start() above. 354 // ExternalMetrics::Start() above.
356 SetupProgressiveScanFieldTrial(); 355 SetupProgressiveScanFieldTrial();
357 356
358 ScheduleCollector(); 357 ScheduleCollector();
359 } 358 }
360 359
361 } // namespace chromeos 360 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/chromeos_metrics_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698