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

Issue 6713107: Make the windows_version.h functions threadsafe by using a singleton. (Closed)

Created:
9 years, 9 months ago by Peter Kasting
Modified:
9 years, 7 months ago
CC:
chromium-reviews, brettw-cc_chromium.org, tfarina
Visibility:
Public.

Description

Make the windows_version.h functions threadsafe by using a singleton. Add accessors to the singleton for more values that various code wants, then convert almost everyone using OSVERSIONINFO or SYSTEM_INFO structs to calling these accessors. Declare an AtExitManager in the out-of-process test runner since it didn't have one and that breaks singleton-using code in the test executable (as opposed to in chrome.dll). A few other minor cleanups along the way (binding of "*", shorter code, etc.). Because I ran into problems with it while modifying gcapi.cc, I cleaned up our usage of strsafe.h a bit, so that files that don't need it don't include it and files that do use STRSAFE_NO_DEPRECATE instead of a modified #include order. BUG=none TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=80819

Patch Set 1 #

Total comments: 4

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 2

Patch Set 4 : '' #

Patch Set 5 : '' #

Total comments: 5

Patch Set 6 : '' #

Patch Set 7 : '' #

Total comments: 10

Patch Set 8 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+282 lines, -331 lines) Patch
M base/file_version_info_win.cc View 1 2 3 4 5 6 2 chunks +1 line, -4 lines 0 comments Download
M base/process_util_win.cc View 1 2 3 4 5 6 2 chunks +6 lines, -6 lines 0 comments Download
M base/sys_info.h View 1 2 3 4 5 6 2 chunks +6 lines, -6 lines 0 comments Download
M base/sys_info_chromeos.cc View 1 2 3 4 5 6 2 chunks +6 lines, -6 lines 0 comments Download
M base/sys_info_mac.cc View 1 2 3 4 5 6 2 chunks +4 lines, -4 lines 0 comments Download
M base/sys_info_win.cc View 1 2 3 4 5 6 7 3 chunks +20 lines, -21 lines 0 comments Download
M base/win/windows_version.h View 1 2 3 4 5 6 7 1 chunk +76 lines, -39 lines 0 comments Download
M base/win/windows_version.cc View 1 2 3 4 5 6 7 2 chunks +36 lines, -64 lines 0 comments Download
M chrome/browser/bug_report_util.cc View 1 2 3 4 5 6 7 3 chunks +15 lines, -21 lines 0 comments Download
M chrome/browser/diagnostics/recon_diagnostics.cc View 1 2 3 4 5 6 7 1 chunk +7 lines, -14 lines 0 comments Download
M chrome/browser/importer/importer_unittest.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/memory_details_win.cc View 1 2 3 4 5 6 2 chunks +6 lines, -6 lines 0 comments Download
M chrome/browser/nacl_host/nacl_process_host.cc View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/views/about_chrome_view.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -3 lines 0 comments Download
M chrome/installer/gcapi/gcapi.cc View 1 2 3 4 5 6 6 chunks +30 lines, -28 lines 0 comments Download
M chrome/installer/setup/install_worker.cc View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M chrome/installer/util/google_chrome_distribution.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -8 lines 0 comments Download
M chrome/installer/util/install_util.cc View 1 2 3 4 5 6 7 2 chunks +6 lines, -7 lines 0 comments Download
M chrome/renderer/renderer_glue.cc View 1 2 3 4 5 6 1 chunk +1 line, -3 lines 0 comments Download
M chrome/test/out_of_proc_test_runner.cc View 1 2 3 4 5 6 7 1 chunk +12 lines, -0 lines 0 comments Download
MM media/tools/mfplayer/mf_playback_main.cc View 1 2 3 4 5 6 2 chunks +3 lines, -1 line 0 comments Download
MM media/tools/mfplayer/mfplayer.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M sandbox/src/Wow64.cc View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M sandbox/src/dep_test.cc View 1 2 3 4 5 6 3 chunks +2 lines, -28 lines 0 comments Download
M sandbox/src/integrity_level_test.cc View 1 2 3 4 5 6 4 chunks +4 lines, -4 lines 0 comments Download
M sandbox/src/interception.cc View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M sandbox/src/job.cc View 1 2 3 4 5 6 2 chunks +4 lines, -8 lines 0 comments Download
M sandbox/src/sandbox_utils.cc View 1 2 3 4 5 6 7 3 chunks +6 lines, -28 lines 0 comments Download
M sandbox/src/service_resolver_unittest.cc View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M sandbox/tests/common/controller.cc View 1 2 3 4 5 6 2 chunks +6 lines, -4 lines 0 comments Download
M webkit/glue/user_agent.cc View 1 2 3 4 5 6 2 chunks +7 lines, -6 lines 0 comments Download
M webkit/plugins/npapi/test/plugin_npobject_proxy_test.cc View 1 2 3 4 5 6 1 chunk +1 line, -5 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
Peter Kasting
9 years, 9 months ago (2011-03-24 18:53:10 UTC) #1
brettw
http://codereview.chromium.org/6713107/diff/1/base/sys_info_win.cc File base/sys_info_win.cc (right): http://codereview.chromium.org/6713107/diff/1/base/sys_info_win.cc#newcode103 base/sys_info_win.cc:103: if (!checked_version) { This makes this function no longer ...
9 years, 9 months ago (2011-03-24 20:19:02 UTC) #2
Peter Kasting
http://codereview.chromium.org/6713107/diff/1/base/sys_info_win.cc File base/sys_info_win.cc (right): http://codereview.chromium.org/6713107/diff/1/base/sys_info_win.cc#newcode103 base/sys_info_win.cc:103: if (!checked_version) { On 2011/03/24 20:19:03, brettw wrote: > ...
9 years, 9 months ago (2011-03-24 20:59:02 UTC) #3
brettw
http://codereview.chromium.org/6713107/diff/1/base/sys_info_win.cc File base/sys_info_win.cc (right): http://codereview.chromium.org/6713107/diff/1/base/sys_info_win.cc#newcode103 base/sys_info_win.cc:103: if (!checked_version) { You're more expert on the compilers ...
9 years, 9 months ago (2011-03-24 23:47:37 UTC) #4
Peter Kasting
http://codereview.chromium.org/6713107/diff/1/base/sys_info_win.cc File base/sys_info_win.cc (right): http://codereview.chromium.org/6713107/diff/1/base/sys_info_win.cc#newcode103 base/sys_info_win.cc:103: if (!checked_version) { On 2011/03/24 23:47:37, brettw wrote: > ...
9 years, 9 months ago (2011-03-25 00:39:19 UTC) #5
brettw
I found at least one case in the Geolocation code where the windows_version stuff is ...
9 years, 9 months ago (2011-03-26 18:28:13 UTC) #6
Peter Kasting
OK, I converted to using a singleton, which is threadsafe, caches all the appropriate data ...
9 years, 8 months ago (2011-04-05 21:11:52 UTC) #7
tfarina
http://codereview.chromium.org/6713107/diff/12005/chrome/browser/importer/importer_unittest.cc File chrome/browser/importer/importer_unittest.cc (right): http://codereview.chromium.org/6713107/diff/12005/chrome/browser/importer/importer_unittest.cc#newcode28 chrome/browser/importer/importer_unittest.cc:28: #include "base/win/windows_version.h" This is already included at line 42.
9 years, 8 months ago (2011-04-05 23:10:47 UTC) #8
Peter Kasting
http://codereview.chromium.org/6713107/diff/12005/chrome/browser/importer/importer_unittest.cc File chrome/browser/importer/importer_unittest.cc (right): http://codereview.chromium.org/6713107/diff/12005/chrome/browser/importer/importer_unittest.cc#newcode28 chrome/browser/importer/importer_unittest.cc:28: #include "base/win/windows_version.h" On 2011/04/05 23:10:47, tfarina wrote: > This ...
9 years, 8 months ago (2011-04-05 23:45:32 UTC) #9
Peter Kasting
New snap up that avoids adding a dependency from gcapi.cc onto base/, per some discussion ...
9 years, 8 months ago (2011-04-06 00:10:54 UTC) #10
Peter Kasting
Another new snap up, fixing several problems I noticed in a self-review. Random notes: * ...
9 years, 8 months ago (2011-04-06 01:34:37 UTC) #11
brettw
http://codereview.chromium.org/6713107/diff/17001/chrome/installer/gcapi/gcapi.cc File chrome/installer/gcapi/gcapi.cc (right): http://codereview.chromium.org/6713107/diff/17001/chrome/installer/gcapi/gcapi.cc#newcode175 chrome/installer/gcapi/gcapi.cc:175: return (version_info.dwMajorVersion < 5) || I can't follow this ...
9 years, 8 months ago (2011-04-06 04:27:47 UTC) #12
Peter Kasting
http://codereview.chromium.org/6713107/diff/17001/chrome/installer/gcapi/gcapi.cc File chrome/installer/gcapi/gcapi.cc (right): http://codereview.chromium.org/6713107/diff/17001/chrome/installer/gcapi/gcapi.cc#newcode175 chrome/installer/gcapi/gcapi.cc:175: return (version_info.dwMajorVersion < 5) || On 2011/04/06 04:27:47, brettw ...
9 years, 8 months ago (2011-04-06 04:52:43 UTC) #13
brettw
http://codereview.chromium.org/6713107/diff/17001/sandbox/src/sandbox_utils.cc File sandbox/src/sandbox_utils.cc (right): http://codereview.chromium.org/6713107/diff/17001/sandbox/src/sandbox_utils.cc#newcode60 sandbox/src/sandbox_utils.cc:60: base::win::Version version = base::win::GetVersion(); Okay, I don't actually care ...
9 years, 8 months ago (2011-04-06 05:14:35 UTC) #14
Peter Kasting
New snap up. I tried to make gcapi.cc more comprehensible. I also added a solution ...
9 years, 8 months ago (2011-04-06 18:27:13 UTC) #15
Paweł Hajdan Jr.
Drive-by with testing comments. Can we delay landing this change until we're reasonably sure what's ...
9 years, 8 months ago (2011-04-06 19:20:13 UTC) #16
Peter Kasting
On 2011/04/06 19:20:13, Paweł Hajdan Jr. wrote: > Drive-by with testing comments. > > Can ...
9 years, 8 months ago (2011-04-06 20:06:48 UTC) #17
Peter Kasting
On 2011/04/06 20:06:48, Peter Kasting wrote: > I've uploaded a new snap Well, actually, I ...
9 years, 8 months ago (2011-04-06 20:24:50 UTC) #18
cpu_(ooo_6.6-7.5)
I suggest to add rvargas for the wow64 sandbox changes even though they seem trivial. ...
9 years, 8 months ago (2011-04-06 21:11:42 UTC) #19
rvargas (doing something else)
Drive by. http://codereview.chromium.org/6713107/diff/20010/base/win/windows_version.h File base/win/windows_version.h (right): http://codereview.chromium.org/6713107/diff/20010/base/win/windows_version.h#newcode35 base/win/windows_version.h:35: // not be the same as the ...
9 years, 8 months ago (2011-04-06 23:28:05 UTC) #20
brettw
LGTM from my end, I like Ricardo's suggestion about structs.
9 years, 8 months ago (2011-04-06 23:38:26 UTC) #21
Peter Kasting
I intend to submit this once the trybots OK it. http://codereview.chromium.org/6713107/diff/20010/base/win/windows_version.h File base/win/windows_version.h (right): http://codereview.chromium.org/6713107/diff/20010/base/win/windows_version.h#newcode35 ...
9 years, 8 months ago (2011-04-07 00:29:19 UTC) #22
Paweł Hajdan Jr.
9 years, 8 months ago (2011-04-07 14:59:26 UTC) #23
Code I commented in the drive-by LGTM, thanks for additional tests and
explanations in the e-mail.

Powered by Google App Engine
This is Rietveld 408576698