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

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

Issue 10151017: Remove the hash fields from FieldTrials. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: MAD comments. Reshuffled test methods. Created 8 years, 8 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 (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/metrics/metrics_log.h" 5 #include "chrome/browser/metrics/metrics_log.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/perftimer.h" 14 #include "base/perftimer.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/sys_info.h" 17 #include "base/sys_info.h"
18 #include "base/third_party/nspr/prtime.h" 18 #include "base/third_party/nspr/prtime.h"
19 #include "base/time.h" 19 #include "base/time.h"
20 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
21 #include "chrome/browser/autocomplete/autocomplete.h" 21 #include "chrome/browser/autocomplete/autocomplete.h"
22 #include "chrome/browser/autocomplete/autocomplete_match.h" 22 #include "chrome/browser/autocomplete/autocomplete_match.h"
23 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/plugin_prefs.h" 24 #include "chrome/browser/plugin_prefs.h"
25 #include "chrome/browser/prefs/pref_service.h" 25 #include "chrome/browser/prefs/pref_service.h"
26 #include "chrome/browser/profiles/profile_manager.h" 26 #include "chrome/browser/profiles/profile_manager.h"
27 #include "chrome/common/chrome_version_info.h" 27 #include "chrome/common/chrome_version_info.h"
28 #include "chrome/common/logging_chrome.h" 28 #include "chrome/common/logging_chrome.h"
29 #include "chrome/common/metrics/experiments_helper.h"
29 #include "chrome/common/metrics/proto/omnibox_event.pb.h" 30 #include "chrome/common/metrics/proto/omnibox_event.pb.h"
30 #include "chrome/common/metrics/proto/system_profile.pb.h" 31 #include "chrome/common/metrics/proto/system_profile.pb.h"
31 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
32 #include "content/public/browser/content_browser_client.h" 33 #include "content/public/browser/content_browser_client.h"
33 #include "content/public/browser/gpu_data_manager.h" 34 #include "content/public/browser/gpu_data_manager.h"
34 #include "content/public/common/gpu_info.h" 35 #include "content/public/common/gpu_info.h"
35 #include "content/public/common/content_client.h" 36 #include "content/public/common/content_client.h"
36 #include "googleurl/src/gurl.h" 37 #include "googleurl/src/gurl.h"
37 #include "ui/gfx/screen.h" 38 #include "ui/gfx/screen.h"
38 #include "webkit/plugins/webplugininfo.h" 39 #include "webkit/plugins/webplugininfo.h"
39 40
40 #define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name) 41 #define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name)
41 42
42 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx 43 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
43 #if defined(OS_WIN) 44 #if defined(OS_WIN)
44 extern "C" IMAGE_DOS_HEADER __ImageBase; 45 extern "C" IMAGE_DOS_HEADER __ImageBase;
45 #endif 46 #endif
46 47
47 using content::GpuDataManager; 48 using content::GpuDataManager;
48 using metrics::OmniboxEventProto; 49 using metrics::OmniboxEventProto;
49 using metrics::SystemProfileProto; 50 using metrics::SystemProfileProto;
50 typedef base::FieldTrial::NameGroupId NameGroupId; 51 typedef experiments_helper::NameGroupId NameGroupId;
51 52
52 namespace { 53 namespace {
53 54
54 // Returns the date at which the current metrics client ID was created as 55 // Returns the date at which the current metrics client ID was created as
55 // a string containing milliseconds since the epoch, or "0" if none was found. 56 // a string containing milliseconds since the epoch, or "0" if none was found.
56 std::string GetInstallDate(PrefService* pref) { 57 std::string GetInstallDate(PrefService* pref) {
57 if (!pref) { 58 if (!pref) {
58 NOTREACHED(); 59 NOTREACHED();
59 return "0"; 60 return "0";
60 } 61 }
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 return gfx::Screen::GetPrimaryMonitorSize(); 268 return gfx::Screen::GetPrimaryMonitorSize();
268 } 269 }
269 270
270 int MetricsLog::GetScreenCount() const { 271 int MetricsLog::GetScreenCount() const {
271 return gfx::Screen::GetNumMonitors(); 272 return gfx::Screen::GetNumMonitors();
272 } 273 }
273 274
274 275
275 void MetricsLog::GetFieldTrialIds( 276 void MetricsLog::GetFieldTrialIds(
276 std::vector<NameGroupId>* field_trial_ids) const { 277 std::vector<NameGroupId>* field_trial_ids) const {
277 base::FieldTrialList::GetFieldTrialNameGroupIds(field_trial_ids); 278 experiments_helper::GetFieldTrialNameGroupIds(field_trial_ids);
278 } 279 }
279 280
280 void MetricsLog::WriteStabilityElement( 281 void MetricsLog::WriteStabilityElement(
281 const std::vector<webkit::WebPluginInfo>& plugin_list, 282 const std::vector<webkit::WebPluginInfo>& plugin_list,
282 PrefService* pref) { 283 PrefService* pref) {
283 DCHECK(!locked()); 284 DCHECK(!locked());
284 285
285 // Get stability attributes out of Local State, zeroing out stored values. 286 // Get stability attributes out of Local State, zeroing out stored values.
286 // NOTE: This could lead to some data loss if this report isn't successfully 287 // NOTE: This could lead to some data loss if this report isn't successfully
287 // sent, but that's true for all the metrics. 288 // sent, but that's true for all the metrics.
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 i != log.result.end(); ++i) { 840 i != log.result.end(); ++i) {
840 OmniboxEventProto::Suggestion* suggestion = omnibox_event->add_suggestion(); 841 OmniboxEventProto::Suggestion* suggestion = omnibox_event->add_suggestion();
841 suggestion->set_provider(AsOmniboxEventProviderType(i->provider)); 842 suggestion->set_provider(AsOmniboxEventProviderType(i->provider));
842 suggestion->set_result_type(AsOmniboxEventResultType(i->type)); 843 suggestion->set_result_type(AsOmniboxEventResultType(i->type));
843 suggestion->set_relevance(i->relevance); 844 suggestion->set_relevance(i->relevance);
844 suggestion->set_is_starred(i->starred); 845 suggestion->set_is_starred(i->starred);
845 } 846 }
846 847
847 ++num_events_; 848 ++num_events_;
848 } 849 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698