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

Side by Side Diff: base/sys_info_chromeos.cc

Issue 2167493004: Make ChromeOSVersionInfo singleton leaky to avoid startup thread restriction DCHECK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | no next file » | 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 "base/sys_info.h" 5 #include "base/sys_info.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 157
158 Time lsb_release_time_; 158 Time lsb_release_time_;
159 SysInfo::LsbReleaseMap lsb_release_map_; 159 SysInfo::LsbReleaseMap lsb_release_map_;
160 int32_t major_version_; 160 int32_t major_version_;
161 int32_t minor_version_; 161 int32_t minor_version_;
162 int32_t bugfix_version_; 162 int32_t bugfix_version_;
163 bool is_running_on_chromeos_; 163 bool is_running_on_chromeos_;
164 }; 164 };
165 165
166 static LazyInstance<ChromeOSVersionInfo> 166 static LazyInstance<ChromeOSVersionInfo>::Leaky
167 g_chrome_os_version_info = LAZY_INSTANCE_INITIALIZER; 167 g_chrome_os_version_info = LAZY_INSTANCE_INITIALIZER;
168 168
169 ChromeOSVersionInfo& GetChromeOSVersionInfo() { 169 ChromeOSVersionInfo& GetChromeOSVersionInfo() {
170 return g_chrome_os_version_info.Get(); 170 return g_chrome_os_version_info.Get();
171 } 171 }
172 172
173 } // namespace 173 } // namespace
174 174
175 // static 175 // static
176 void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version, 176 void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 void SysInfo::SetChromeOSVersionInfoForTest(const std::string& lsb_release, 213 void SysInfo::SetChromeOSVersionInfoForTest(const std::string& lsb_release,
214 const Time& lsb_release_time) { 214 const Time& lsb_release_time) {
215 std::unique_ptr<Environment> env(Environment::Create()); 215 std::unique_ptr<Environment> env(Environment::Create());
216 env->SetVar(kLsbReleaseKey, lsb_release); 216 env->SetVar(kLsbReleaseKey, lsb_release);
217 env->SetVar(kLsbReleaseTimeKey, 217 env->SetVar(kLsbReleaseTimeKey,
218 DoubleToString(lsb_release_time.ToDoubleT())); 218 DoubleToString(lsb_release_time.ToDoubleT()));
219 g_chrome_os_version_info.Get().Parse(); 219 g_chrome_os_version_info.Get().Parse();
220 } 220 }
221 221
222 } // namespace base 222 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698