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

Issue 1320673016: Get GenericScopedHandle::Set to preserve LastError code (Closed)

Created:
5 years, 3 months ago by brucedawson
Modified:
5 years, 3 months ago
CC:
chromium-reviews, grt+watch_chromium.org, wfh+watch_chromium.org, Nico
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Get GenericScopedHandle::Set to preserve LastError code Code like this is elegant and clean and common in Chrome: event_.Set(CreateEvent(NULL, FALSE, FALSE, wname.c_str())); if (event_.Get() && GetLastError() != ERROR_ALREADY_EXISTS) { However it will behave incorrectly if event_.Set() zeroes out the Windows LastError code, which VC++ 2015 frequently does. This change avoids that. R=rvargas@chromium.org BUG=528394, 529981, 440500 Committed: https://crrev.com/84f30fe06877193d39bb2cb9fe345c2e12e695b3 Cr-Commit-Position: refs/heads/master@{#348324}

Patch Set 1 #

Total comments: 10

Patch Set 2 : Added unit tests #

Patch Set 3 : Moved implementation, updated tests. #

Patch Set 4 : Comment change. #

Total comments: 6

Patch Set 5 : Remove namespaces #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+42 lines, -1 line) Patch
M base/BUILD.gn View 1 1 chunk +1 line, -0 lines 0 comments Download
M base/base.gyp View 1 1 chunk +1 line, -0 lines 0 comments Download
M base/win/scoped_handle.h View 1 2 3 4 3 chunks +8 lines, -1 line 0 comments Download
A base/win/scoped_handle_unittest.cc View 1 2 3 4 1 chunk +32 lines, -0 lines 3 comments Download

Messages

Total messages: 21 (4 generated)
brucedawson
I think we have to go with this fix - the evidence seems to require ...
5 years, 3 months ago (2015-09-10 00:40:48 UTC) #1
Will Harris
On 2015/09/10 00:40:48, brucedawson wrote: > I think we have to go with this fix ...
5 years, 3 months ago (2015-09-10 00:52:09 UTC) #2
brucedawson
Good point. I'll add.
5 years, 3 months ago (2015-09-10 01:01:55 UTC) #3
grt (UTC plus 2)
wow. nice find! comments below. https://codereview.chromium.org/1320673016/diff/1/base/win/scoped_handle.cc File base/win/scoped_handle.cc (right): https://codereview.chromium.org/1320673016/diff/1/base/win/scoped_handle.cc#newcode231 base/win/scoped_handle.cc:231: // A common pattern ...
5 years, 3 months ago (2015-09-10 01:36:49 UTC) #5
rvargas (doing something else)
If you land this then the other change should not land. https://codereview.chromium.org/1320673016/diff/1/base/win/scoped_handle.cc File base/win/scoped_handle.cc (right): ...
5 years, 3 months ago (2015-09-10 01:39:35 UTC) #6
brucedawson
Basic unit test added. I'll make changes tomorrow. https://codereview.chromium.org/1320673016/diff/1/base/win/scoped_handle.cc File base/win/scoped_handle.cc (right): https://codereview.chromium.org/1320673016/diff/1/base/win/scoped_handle.cc#newcode249 base/win/scoped_handle.cc:249: PreserveLastError ...
5 years, 3 months ago (2015-09-10 01:46:28 UTC) #7
brucedawson
Updated code, comments, and title, and added unit tests. The tests pass always with VS ...
5 years, 3 months ago (2015-09-10 21:52:49 UTC) #8
rvargas (doing something else)
lgtm, Thanks! https://codereview.chromium.org/1320673016/diff/60001/base/win/scoped_handle.h File base/win/scoped_handle.h (right): https://codereview.chromium.org/1320673016/diff/60001/base/win/scoped_handle.h#newcode74 base/win/scoped_handle.h:74: auto last_error = GetLastError(); nit: use ::GetLastError() ...
5 years, 3 months ago (2015-09-10 22:42:02 UTC) #9
brucedawson
Take one last look if you want. https://codereview.chromium.org/1320673016/diff/60001/base/win/scoped_handle.h File base/win/scoped_handle.h (right): https://codereview.chromium.org/1320673016/diff/60001/base/win/scoped_handle.h#newcode74 base/win/scoped_handle.h:74: auto last_error ...
5 years, 3 months ago (2015-09-10 23:21:46 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1320673016/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1320673016/80001
5 years, 3 months ago (2015-09-11 00:17:23 UTC) #13
commit-bot: I haz the power
Committed patchset #5 (id:80001)
5 years, 3 months ago (2015-09-11 03:08:36 UTC) #14
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/84f30fe06877193d39bb2cb9fe345c2e12e695b3 Cr-Commit-Position: refs/heads/master@{#348324}
5 years, 3 months ago (2015-09-11 03:09:57 UTC) #15
grt (UTC plus 2)
lgtm
5 years, 3 months ago (2015-09-11 14:51:30 UTC) #16
dcheng
https://codereview.chromium.org/1320673016/diff/80001/base/win/scoped_handle_unittest.cc File base/win/scoped_handle_unittest.cc (right): https://codereview.chromium.org/1320673016/diff/80001/base/win/scoped_handle_unittest.cc#newcode30 base/win/scoped_handle_unittest.cc:30: handle_holder = std::move(handle_source); Shouldn't this be Pass() rather than ...
5 years, 3 months ago (2015-09-18 21:22:19 UTC) #18
rvargas (doing something else)
https://codereview.chromium.org/1320673016/diff/80001/base/win/scoped_handle_unittest.cc File base/win/scoped_handle_unittest.cc (right): https://codereview.chromium.org/1320673016/diff/80001/base/win/scoped_handle_unittest.cc#newcode30 base/win/scoped_handle_unittest.cc:30: handle_holder = std::move(handle_source); On 2015/09/18 21:22:19, dcheng wrote: > ...
5 years, 3 months ago (2015-09-18 22:00:48 UTC) #19
brucedawson
https://codereview.chromium.org/1320673016/diff/80001/base/win/scoped_handle_unittest.cc File base/win/scoped_handle_unittest.cc (right): https://codereview.chromium.org/1320673016/diff/80001/base/win/scoped_handle_unittest.cc#newcode30 base/win/scoped_handle_unittest.cc:30: handle_holder = std::move(handle_source); On 2015/09/18 21:22:19, dcheng wrote: > ...
5 years, 3 months ago (2015-09-18 22:01:21 UTC) #20
commit-bot: I haz the power
5 years, 3 months ago (2015-09-23 12:18:18 UTC) #21
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/84f30fe06877193d39bb2cb9fe345c2e12e695b3
Cr-Commit-Position: refs/heads/master@{#348324}

Powered by Google App Engine
This is Rietveld 408576698