OLD | NEW |
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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 int32* bugfix_version) { | 47 int32* bugfix_version) { |
48 if (!g_chrome_os_version_numbers.Get().parsed) { | 48 if (!g_chrome_os_version_numbers.Get().parsed) { |
49 // The other implementations of SysInfo don't block on the disk. | 49 // The other implementations of SysInfo don't block on the disk. |
50 // See http://code.google.com/p/chromium/issues/detail?id=60394 | 50 // See http://code.google.com/p/chromium/issues/detail?id=60394 |
51 // Perhaps the caller ought to cache this? | 51 // Perhaps the caller ought to cache this? |
52 // Temporary allowing while we work the bug out. | 52 // Temporary allowing while we work the bug out. |
53 ThreadRestrictions::ScopedAllowIO allow_io; | 53 ThreadRestrictions::ScopedAllowIO allow_io; |
54 | 54 |
55 FilePath path(kLinuxStandardBaseReleaseFile); | 55 FilePath path(kLinuxStandardBaseReleaseFile); |
56 std::string contents; | 56 std::string contents; |
57 if (file_util::ReadFileToString(path, &contents)) { | 57 if (ReadFileToString(path, &contents)) { |
58 g_chrome_os_version_numbers.Get().parsed = true; | 58 g_chrome_os_version_numbers.Get().parsed = true; |
59 ParseLsbRelease(contents, | 59 ParseLsbRelease(contents, |
60 &(g_chrome_os_version_numbers.Get().major_version), | 60 &(g_chrome_os_version_numbers.Get().major_version), |
61 &(g_chrome_os_version_numbers.Get().minor_version), | 61 &(g_chrome_os_version_numbers.Get().minor_version), |
62 &(g_chrome_os_version_numbers.Get().bugfix_version)); | 62 &(g_chrome_os_version_numbers.Get().bugfix_version)); |
63 } | 63 } |
64 } | 64 } |
65 *major_version = g_chrome_os_version_numbers.Get().major_version; | 65 *major_version = g_chrome_os_version_numbers.Get().major_version; |
66 *minor_version = g_chrome_os_version_numbers.Get().minor_version; | 66 *minor_version = g_chrome_os_version_numbers.Get().minor_version; |
67 *bugfix_version = g_chrome_os_version_numbers.Get().bugfix_version; | 67 *bugfix_version = g_chrome_os_version_numbers.Get().bugfix_version; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 110 } |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 // static | 114 // static |
115 FilePath SysInfo::GetLsbReleaseFilePath() { | 115 FilePath SysInfo::GetLsbReleaseFilePath() { |
116 return FilePath(kLinuxStandardBaseReleaseFile); | 116 return FilePath(kLinuxStandardBaseReleaseFile); |
117 } | 117 } |
118 | 118 |
119 } // namespace base | 119 } // namespace base |
OLD | NEW |