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

Side by Side Diff: chromeos/system/statistics_provider.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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 | « chromeos/settings/timezone_settings.cc ('k') | components/app_modal/app_modal_dialog_queue.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chromeos/system/statistics_provider.h" 5 #include "chromeos/system/statistics_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 std::string* result) override; 106 std::string* result) override;
107 bool HasMachineStatistic(const std::string& name) override; 107 bool HasMachineStatistic(const std::string& name) override;
108 bool GetMachineFlag(const std::string& name, bool* result) override; 108 bool GetMachineFlag(const std::string& name, bool* result) override;
109 bool HasMachineFlag(const std::string& name) override; 109 bool HasMachineFlag(const std::string& name) override;
110 void Shutdown() override; 110 void Shutdown() override;
111 111
112 static StatisticsProviderImpl* GetInstance(); 112 static StatisticsProviderImpl* GetInstance();
113 113
114 protected: 114 protected:
115 typedef std::map<std::string, bool> MachineFlags; 115 typedef std::map<std::string, bool> MachineFlags;
116 friend struct DefaultSingletonTraits<StatisticsProviderImpl>; 116 friend struct base::DefaultSingletonTraits<StatisticsProviderImpl>;
117 117
118 StatisticsProviderImpl(); 118 StatisticsProviderImpl();
119 ~StatisticsProviderImpl() override; 119 ~StatisticsProviderImpl() override;
120 120
121 // Waits up to |kTimeoutSecs| for statistics to be loaded. Returns true if 121 // Waits up to |kTimeoutSecs| for statistics to be loaded. Returns true if
122 // they were loaded successfully. 122 // they were loaded successfully.
123 bool WaitForStatisticsLoaded(); 123 bool WaitForStatisticsLoaded();
124 124
125 // Loads the machine statistics off of disk. Runs on the file thread. 125 // Loads the machine statistics off of disk. Runs on the file thread.
126 void LoadMachineStatistics(bool load_oem_manifest); 126 void LoadMachineStatistics(bool load_oem_manifest);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 machine_flags_[kOemCanExitEnterpriseEnrollmentKey] = 335 machine_flags_[kOemCanExitEnterpriseEnrollmentKey] =
336 oem_manifest.can_exit_enrollment; 336 oem_manifest.can_exit_enrollment;
337 machine_flags_[kOemKeyboardDrivenOobeKey] = 337 machine_flags_[kOemKeyboardDrivenOobeKey] =
338 oem_manifest.keyboard_driven_oobe; 338 oem_manifest.keyboard_driven_oobe;
339 339
340 oem_manifest_loaded_ = true; 340 oem_manifest_loaded_ = true;
341 VLOG(1) << "Loaded OEM Manifest statistics from " << file.value(); 341 VLOG(1) << "Loaded OEM Manifest statistics from " << file.value();
342 } 342 }
343 343
344 StatisticsProviderImpl* StatisticsProviderImpl::GetInstance() { 344 StatisticsProviderImpl* StatisticsProviderImpl::GetInstance() {
345 return Singleton<StatisticsProviderImpl, 345 return base::Singleton<
346 DefaultSingletonTraits<StatisticsProviderImpl> >::get(); 346 StatisticsProviderImpl,
347 base::DefaultSingletonTraits<StatisticsProviderImpl>>::get();
347 } 348 }
348 349
349 static StatisticsProvider* g_test_statistics_provider = NULL; 350 static StatisticsProvider* g_test_statistics_provider = NULL;
350 351
351 // static 352 // static
352 StatisticsProvider* StatisticsProvider::GetInstance() { 353 StatisticsProvider* StatisticsProvider::GetInstance() {
353 if (g_test_statistics_provider) 354 if (g_test_statistics_provider)
354 return g_test_statistics_provider; 355 return g_test_statistics_provider;
355 return StatisticsProviderImpl::GetInstance(); 356 return StatisticsProviderImpl::GetInstance();
356 } 357 }
357 358
358 // static 359 // static
359 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) { 360 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) {
360 g_test_statistics_provider = test_provider; 361 g_test_statistics_provider = test_provider;
361 } 362 }
362 363
363 } // namespace system 364 } // namespace system
364 } // namespace chromeos 365 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/settings/timezone_settings.cc ('k') | components/app_modal/app_modal_dialog_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698