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

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

Issue 156703006: Cleanup: Remove unneeded browser_thread.h includes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | Annotate | Revision Log
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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/rand_util.h" 13 #include "base/rand_util.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/threading/sequenced_worker_pool.h" 15 #include "base/threading/sequenced_worker_pool.h"
16 #include "chrome/browser/metrics/perf_provider_chromeos.h" 16 #include "chrome/browser/metrics/perf_provider_chromeos.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_list.h" 19 #include "chrome/browser/ui/browser_list.h"
20 #include "chrome/browser/ui/browser_list_observer.h" 20 #include "chrome/browser/ui/browser_list_observer.h"
21 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
22 #include "chromeos/dbus/dbus_thread_manager.h" 22 #include "chromeos/dbus/dbus_thread_manager.h"
23 #include "chromeos/dbus/debug_daemon_client.h" 23 #include "chromeos/dbus/debug_daemon_client.h"
24 #include "content/public/browser/browser_thread.h"
25 24
26 namespace { 25 namespace {
27 26
28 // Default time in seconds between invocations of perf. 27 // Default time in seconds between invocations of perf.
29 // This period is roughly 6.5 hours. 28 // This period is roughly 6.5 hours.
30 // This is chosen to be relatively prime with the number of seconds in: 29 // This is chosen to be relatively prime with the number of seconds in:
31 // - one minute (60) 30 // - one minute (60)
32 // - one hour (3600) 31 // - one hour (3600)
33 // - one day (86400) 32 // - one day (86400)
34 const size_t kPerfCommandIntervalDefaultSeconds = 23093; 33 const size_t kPerfCommandIntervalDefaultSeconds = 23093;
(...skipping 29 matching lines...) Expand all
64 // Name of the histogram that represents the success and various failure modes 63 // Name of the histogram that represents the success and various failure modes
65 // for collecting and sending perf data. 64 // for collecting and sending perf data.
66 const char kGetPerfDataOutcomeHistogram[] = "UMA.Perf.GetData"; 65 const char kGetPerfDataOutcomeHistogram[] = "UMA.Perf.GetData";
67 66
68 void AddToPerfHistogram(GetPerfDataOutcome outcome) { 67 void AddToPerfHistogram(GetPerfDataOutcome outcome) {
69 UMA_HISTOGRAM_ENUMERATION(kGetPerfDataOutcomeHistogram, 68 UMA_HISTOGRAM_ENUMERATION(kGetPerfDataOutcomeHistogram,
70 outcome, 69 outcome,
71 NUM_OUTCOMES); 70 NUM_OUTCOMES);
72 } 71 }
73 72
74 } // namespace 73 } // namespace
75 74
76 75
77 namespace metrics { 76 namespace metrics {
78 77
79 // This class must be created and used on the UI thread. It watches for any 78 // This class must be created and used on the UI thread. It watches for any
80 // incognito window being opened from the time it is instantiated to the time it 79 // incognito window being opened from the time it is instantiated to the time it
81 // is destroyed. 80 // is destroyed.
82 class WindowedIncognitoObserver : public chrome::BrowserListObserver { 81 class WindowedIncognitoObserver : public chrome::BrowserListObserver {
83 public: 82 public:
84 WindowedIncognitoObserver() : incognito_launched_(false) { 83 WindowedIncognitoObserver() : incognito_launched_(false) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 184 }
186 185
187 if (!perf_data_proto_.ParseFromArray(data.data(), data.size())) { 186 if (!perf_data_proto_.ParseFromArray(data.data(), data.size())) {
188 AddToPerfHistogram(PROTOBUF_NOT_PARSED); 187 AddToPerfHistogram(PROTOBUF_NOT_PARSED);
189 perf_data_proto_.Clear(); 188 perf_data_proto_.Clear();
190 return; 189 return;
191 } 190 }
192 191
193 state_ = READY_TO_UPLOAD; 192 state_ = READY_TO_UPLOAD;
194 } 193 }
195 } // namespace metrics 194
195 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698