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

Side by Side Diff: chrome/browser/metrics/variations/chrome_variations_service_client.cc

Issue 2919963002: Clean Read/SetExperimentLabels to remove check for Chrome build. (Closed)
Patch Set: Created 3 years, 6 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/installer/util/google_update_settings.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/variations/chrome_variations_service_client.h" 5 #include "chrome/browser/metrics/variations/chrome_variations_service_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/threading/sequenced_worker_pool.h" 8 #include "base/threading/sequenced_worker_pool.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/common/channel_info.h" 11 #include "chrome/common/channel_info.h"
12 #include "components/version_info/version_info.h" 12 #include "components/version_info/version_info.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 14
15 #if defined(OS_WIN) 15 #if defined(OS_WIN)
16 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
17 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
18 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
19 #include "chrome/installer/util/google_update_settings.h" 19 #include "chrome/installer/util/google_update_settings.h"
20 #include "chrome/installer/util/install_modes.h"
grt (UTC plus 2) 2017/06/02 13:29:28 installer/util -> install_static and move into pro
nikunjb 2017/06/02 21:31:43 Acknowledged. (No longer needed)
20 #include "chrome/installer/util/install_util.h" 21 #include "chrome/installer/util/install_util.h"
21 #include "components/variations/experiment_labels.h" 22 #include "components/variations/experiment_labels.h"
22 #endif 23 #endif
23 24
24 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 25 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
25 #include "chrome/browser/upgrade_detector_impl.h" 26 #include "chrome/browser/upgrade_detector_impl.h"
26 #endif 27 #endif
27 28
28 #if defined(OS_CHROMEOS) 29 #if defined(OS_CHROMEOS)
29 #include "chrome/browser/chromeos/settings/cros_settings.h" 30 #include "chrome/browser/chromeos/settings/cros_settings.h"
(...skipping 12 matching lines...) Expand all
42 #endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 43 #endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
43 44
44 // TODO(asvitkine): Get the version that will be used on restart instead of 45 // TODO(asvitkine): Get the version that will be used on restart instead of
45 // the current version on Android, iOS and ChromeOS. 46 // the current version on Android, iOS and ChromeOS.
46 return base::Version(version_info::GetVersionNumber()); 47 return base::Version(version_info::GetVersionNumber());
47 } 48 }
48 49
49 #if defined(OS_WIN) 50 #if defined(OS_WIN)
50 // Clear all Variations experiment labels from Google Update Registry Labels. 51 // Clear all Variations experiment labels from Google Update Registry Labels.
51 // TODO(jwd): Remove this once we're confident most clients no longer have these 52 // TODO(jwd): Remove this once we're confident most clients no longer have these
52 // labels (M57-M58 timeframe). 53 // labels (M57-M58 timeframe).
Alexei Svitkine (slow) 2017/06/02 15:11:41 We have a TODO here to remove this code entirely.
grt (UTC plus 2) 2017/06/02 15:16:52 SGTM to delete the code in metrics. We're keeping
53 void ClearGoogleUpdateRegistryLabels() { 54 void ClearGoogleUpdateRegistryLabels() {
54 base::ThreadRestrictions::AssertIOAllowed(); 55 base::ThreadRestrictions::AssertIOAllowed();
55 56 // There is nothing to do if this brand does not support integration with
57 // Google Update.
58 if (!install_static::kUseGoogleUpdateIntegration)
59 return;
56 // Note that all registry operations are done here on the UI thread as there 60 // Note that all registry operations are done here on the UI thread as there
57 // are no threading restrictions on them. 61 // are no threading restrictions on them.
58 const bool is_system_install = !InstallUtil::IsPerUserInstall(); 62 const bool is_system_install = !InstallUtil::IsPerUserInstall();
59 63
60 // Read the current bits from the registry. 64 // Read the current bits from the registry.
61 base::string16 registry_labels; 65 base::string16 registry_labels;
62 bool success = GoogleUpdateSettings::ReadExperimentLabels(is_system_install, 66 bool success = GoogleUpdateSettings::ReadExperimentLabels(is_system_install,
63 &registry_labels); 67 &registry_labels);
64 68
65 if (!success) { 69 if (!success) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 #if defined(OS_WIN) 138 #if defined(OS_WIN)
135 // TODO(jwd): Remove this once we're confident most clients no longer have 139 // TODO(jwd): Remove this once we're confident most clients no longer have
136 // these labels (M57-M58 timeframe). 140 // these labels (M57-M58 timeframe).
137 // Do the work on a blocking pool thread, as chrome://profiler has shown that 141 // Do the work on a blocking pool thread, as chrome://profiler has shown that
138 // it can cause jank if done on the UI thrread. 142 // it can cause jank if done on the UI thrread.
139 content::BrowserThread::GetBlockingPool()->PostDelayedTask( 143 content::BrowserThread::GetBlockingPool()->PostDelayedTask(
140 FROM_HERE, base::Bind(&ClearGoogleUpdateRegistryLabels), 144 FROM_HERE, base::Bind(&ClearGoogleUpdateRegistryLabels),
141 base::TimeDelta::FromSeconds(5)); 145 base::TimeDelta::FromSeconds(5));
142 #endif 146 #endif
143 } 147 }
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/util/google_update_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698