OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/common/chrome_version_info.h" | 5 #include "chrome/common/chrome_version_info.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/thread_restrictions.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 | 12 |
12 namespace chrome { | 13 namespace chrome { |
13 | 14 |
14 #if defined(OS_WIN) || defined(OS_MACOSX) | 15 #if defined(OS_WIN) || defined(OS_MACOSX) |
15 // On Windows and Mac, we get the Chrome version info by querying | 16 // On Windows and Mac, we get the Chrome version info by querying |
16 // FileVersionInfo for the current module. | 17 // FileVersionInfo for the current module. |
17 | 18 |
18 VersionInfo::VersionInfo() { | 19 VersionInfo::VersionInfo() { |
| 20 // The current module is already loaded in memory, so this will be cheap. |
| 21 base::ThreadRestrictions::ScopedAllowIO allow_io; |
19 version_info_.reset(FileVersionInfo::CreateFileVersionInfoForCurrentModule()); | 22 version_info_.reset(FileVersionInfo::CreateFileVersionInfoForCurrentModule()); |
20 } | 23 } |
21 | 24 |
22 VersionInfo::~VersionInfo() { | 25 VersionInfo::~VersionInfo() { |
23 } | 26 } |
24 | 27 |
25 bool VersionInfo::is_valid() const { | 28 bool VersionInfo::is_valid() const { |
26 return version_info_.get() != NULL; | 29 return version_info_.get() != NULL; |
27 } | 30 } |
28 | 31 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return LAST_CHANGE; | 81 return LAST_CHANGE; |
79 } | 82 } |
80 | 83 |
81 bool VersionInfo::IsOfficialBuild() const { | 84 bool VersionInfo::IsOfficialBuild() const { |
82 return OFFICIAL_BUILD; | 85 return OFFICIAL_BUILD; |
83 } | 86 } |
84 | 87 |
85 #endif | 88 #endif |
86 | 89 |
87 } // namespace chrome | 90 } // namespace chrome |
OLD | NEW |