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

Issue 610533003: Allow custom deleters to opt out of self reset checks for scoped_ptr. (Closed)

Created:
6 years, 2 months ago by dcheng
Modified:
6 years, 2 months ago
CC:
chromium-reviews, davidben, erikwright+watch_chromium.org, gavinp+memory_chromium.org, mattm, pneubeck (no reviews), Nico
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Allow custom deleters to opt out of self reset checks for scoped_ptr. The self-reset check makes sense for the default deleters, because it would otherwise leave a dangling pointer stored in the scoped_ptr. However, a custom deleter might actually decrement a reference count under the hood. This self-reset check can make assignment operators implementation a lot uglier. One example is net's KeyPair: because there might be a self-assignment, the original code needed to proxy the incoming scoped_ptrs via a stack temporary before moving them into their final location. BUG=418347 Committed: https://crrev.com/9961abd411eab6ec1cf9421078dfdaa001a7e2b5 Cr-Commit-Position: refs/heads/master@{#299571}

Patch Set 1 #

Patch Set 2 : Example usage #

Total comments: 3

Patch Set 3 : incorporate feedback #

Patch Set 4 : Add some comments #

Patch Set 5 : Reword comment #

Patch Set 6 : Cargo culting #

Patch Set 7 : Moar Android cargo culting #

Patch Set 8 : Wild guess again? #

Patch Set 9 : Add a header + guard #

Total comments: 4

Patch Set 10 : Address review comments #

Total comments: 2

Patch Set 11 : Trim this-> #

Patch Set 12 : With assert #

Patch Set 13 : Sigh android #

Unified diffs Side-by-side diffs Delta from patch set Stats (+67 lines, -13 lines) Patch
M base/memory/scoped_ptr.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +14 lines, -3 lines 0 comments Download
M base/memory/scoped_ptr_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +38 lines, -0 lines 0 comments Download
M crypto/scoped_nss_types.h View 1 2 2 chunks +2 lines, -0 lines 0 comments Download
M crypto/scoped_openssl_types.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M net/ssl/openssl_client_key_store.h View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -1 line 0 comments Download
M net/ssl/openssl_client_key_store.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +9 lines, -9 lines 0 comments Download

Messages

Total messages: 62 (14 generated)
dcheng
Allow custom deleters to opt out of self reset checks for scoped_ptr. The self-reset check ...
6 years, 2 months ago (2014-09-29 16:29:11 UTC) #2
awong
On 2014/09/29 16:29:11, dcheng wrote: > Allow custom deleters to opt out of self reset ...
6 years, 2 months ago (2014-09-29 17:00:33 UTC) #3
Ryan Sleevi
LGTM, but since you're here, can you also add it to the ScopedNSSTypes? Mattm@ and ...
6 years, 2 months ago (2014-09-29 17:04:41 UTC) #4
Jeffrey Yasskin
-1. "my_scoped_ptr.reset(a);" is a claim that the calling code owns 'a', which is incompatible with ...
6 years, 2 months ago (2014-09-29 17:23:19 UTC) #5
Ryan Sleevi
On 2014/09/29 17:23:19, Jeffrey Yasskin wrote: > -1. > > "my_scoped_ptr.reset(a);" is a claim that ...
6 years, 2 months ago (2014-09-29 17:32:48 UTC) #6
Ryan Sleevi
On 2014/09/29 17:23:19, Jeffrey Yasskin wrote: > -1. > > "my_scoped_ptr.reset(a);" is a claim that ...
6 years, 2 months ago (2014-09-29 17:32:51 UTC) #7
Jeffrey Yasskin
On Mon, Sep 29, 2014 at 10:32 AM, <rsleevi@chromium.org> wrote: > On 2014/09/29 17:23:19, Jeffrey ...
6 years, 2 months ago (2014-09-29 17:47:50 UTC) #8
dcheng
On 2014/09/29 at 17:47:50, jyasskin wrote: > On Mon, Sep 29, 2014 at 10:32 AM, ...
6 years, 2 months ago (2014-09-29 18:50:06 UTC) #9
Ryan Sleevi
https://codereview.chromium.org/610533003/diff/20001/net/ssl/openssl_client_key_store.cc File net/ssl/openssl_client_key_store.cc (right): https://codereview.chromium.org/610533003/diff/20001/net/ssl/openssl_client_key_store.cc#newcode53 net/ssl/openssl_client_key_store.cc:53: void OpenSSLClientKeyStore::KeyPair::operator=(const KeyPair& other) { On 2014/09/29 17:23:19, Jeffrey ...
6 years, 2 months ago (2014-09-29 18:57:08 UTC) #10
Jeffrey Yasskin
https://codereview.chromium.org/610533003/diff/20001/net/ssl/openssl_client_key_store.cc File net/ssl/openssl_client_key_store.cc (right): https://codereview.chromium.org/610533003/diff/20001/net/ssl/openssl_client_key_store.cc#newcode53 net/ssl/openssl_client_key_store.cc:53: void OpenSSLClientKeyStore::KeyPair::operator=(const KeyPair& other) { On 2014/09/29 18:57:08, Ryan ...
6 years, 2 months ago (2014-09-29 19:20:53 UTC) #11
Ryan Sleevi
On 2014/09/29 19:20:53, Jeffrey Yasskin wrote: > https://codereview.chromium.org/610533003/diff/20001/net/ssl/openssl_client_key_store.cc > File net/ssl/openssl_client_key_store.cc (right): > > https://codereview.chromium.org/610533003/diff/20001/net/ssl/openssl_client_key_store.cc#newcode53 ...
6 years, 2 months ago (2014-09-29 19:24:51 UTC) #12
dcheng
So just to make sure I understand this (I just learned about the copy and ...
6 years, 2 months ago (2014-09-29 22:31:21 UTC) #14
Ryan Sleevi
On 2014/09/29 22:31:21, dcheng wrote: > So just to make sure I understand this (I ...
6 years, 2 months ago (2014-09-29 22:36:33 UTC) #15
Jeffrey Yasskin
On Mon, Sep 29, 2014 at 3:31 PM, <dcheng@chromium.org> wrote: > So just to make ...
6 years, 2 months ago (2014-09-29 22:39:30 UTC) #16
dcheng
+pneubeck, +mattm as FYI I've changed the KeyPair assignment operator to use the copy and ...
6 years, 2 months ago (2014-09-29 23:23:16 UTC) #17
Ryan Sleevi
//net LGTM
6 years, 2 months ago (2014-09-29 23:27:40 UTC) #18
dcheng
Added a reference to the copy-and-swap idiom in KeyPair's assignment operator, so people don't think ...
6 years, 2 months ago (2014-09-30 00:24:11 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/610533003/80001
6 years, 2 months ago (2014-09-30 00:25:58 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: android_dbg_tests_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tests_recipe/builds/13668)
6 years, 2 months ago (2014-09-30 06:17:26 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/610533003/100001
6 years, 2 months ago (2014-09-30 17:59:06 UTC) #25
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_gn_dbg on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_gn_dbg/builds/3700)
6 years, 2 months ago (2014-09-30 18:42:09 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/610533003/100001
6 years, 2 months ago (2014-09-30 19:04:48 UTC) #29
commit-bot: I haz the power
Try jobs failed on following builders: android_dbg_tests_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tests_recipe/builds/13976)
6 years, 2 months ago (2014-09-30 22:05:46 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/610533003/120001
6 years, 2 months ago (2014-09-30 23:01:55 UTC) #33
dcheng
PTAL. I had to make some adjustments to base/memory/scoped_ptr.h to make the death tests work ...
6 years, 2 months ago (2014-10-01 17:45:16 UTC) #34
dcheng
Ping. Do any reviewers have an opinion on changing the abort() to _exit()? Originally, I ...
6 years, 2 months ago (2014-10-02 18:54:00 UTC) #35
Ryan Sleevi
On 2014/10/02 18:54:00, dcheng wrote: > Ping. Do any reviewers have an opinion on changing ...
6 years, 2 months ago (2014-10-02 19:31:03 UTC) #36
Jeffrey Yasskin
On 2014/10/02 19:31:03, Ryan Sleevi wrote: > On 2014/10/02 18:54:00, dcheng wrote: > > Ping. ...
6 years, 2 months ago (2014-10-02 19:34:32 UTC) #37
dcheng
On 2014/10/02 at 19:31:03, rsleevi wrote: > On 2014/10/02 18:54:00, dcheng wrote: > > Ping. ...
6 years, 2 months ago (2014-10-02 19:37:09 UTC) #38
dcheng
+danakj as a new base owner to weigh in on the abort()/_exit() business (since brettw ...
6 years, 2 months ago (2014-10-02 23:47:35 UTC) #40
dcheng
On 2014/10/02 23:47:35, dcheng wrote: > +danakj as a new base owner to weigh in ...
6 years, 2 months ago (2014-10-03 00:02:50 UTC) #41
dcheng
Ping. Absent any opinions, my plan is to: 1. Restore the original behavior and just ...
6 years, 2 months ago (2014-10-06 20:35:40 UTC) #42
Ryan Sleevi
On 2014/10/06 20:35:40, dcheng wrote: > Ping. Absent any opinions, my plan is to: > ...
6 years, 2 months ago (2014-10-07 00:37:14 UTC) #43
pneubeck (no reviews)
looks good to me. https://codereview.chromium.org/610533003/diff/160001/base/memory/scoped_ptr_unittest.cc File base/memory/scoped_ptr_unittest.cc (right): https://codereview.chromium.org/610533003/diff/160001/base/memory/scoped_ptr_unittest.cc#newcode671 base/memory/scoped_ptr_unittest.cc:671: TEST(ScopedPtrTest, SelfResetAbortsWithDefaultFreeDeleter) { It's a ...
6 years, 2 months ago (2014-10-07 09:30:09 UTC) #45
danakj
On 2014/10/07 00:37:14, Ryan Sleevi wrote: > On 2014/10/06 20:35:40, dcheng wrote: > > Ping. ...
6 years, 2 months ago (2014-10-07 18:49:38 UTC) #46
danakj
On Tue, Oct 7, 2014 at 2:49 PM, <danakj@chromium.org> wrote: > On 2014/10/07 00:37:14, Ryan ...
6 years, 2 months ago (2014-10-07 19:34:32 UTC) #47
dcheng
On 2014/10/07 at 19:34:32, danakj wrote: > On Tue, Oct 7, 2014 at 2:49 PM, ...
6 years, 2 months ago (2014-10-07 22:40:09 UTC) #48
dcheng
https://codereview.chromium.org/610533003/diff/160001/base/memory/scoped_ptr_unittest.cc File base/memory/scoped_ptr_unittest.cc (right): https://codereview.chromium.org/610533003/diff/160001/base/memory/scoped_ptr_unittest.cc#newcode671 base/memory/scoped_ptr_unittest.cc:671: TEST(ScopedPtrTest, SelfResetAbortsWithDefaultFreeDeleter) { On 2014/10/07 at 09:30:08, pneubeck wrote: ...
6 years, 2 months ago (2014-10-07 22:40:37 UTC) #49
pneubeck (no reviews)
https://codereview.chromium.org/610533003/diff/180001/net/ssl/openssl_client_key_store.cc File net/ssl/openssl_client_key_store.cc (right): https://codereview.chromium.org/610533003/diff/180001/net/ssl/openssl_client_key_store.cc#newcode55 net/ssl/openssl_client_key_store.cc:55: this->swap(other); nit: could 'this->' be dropped? maybe there was ...
6 years, 2 months ago (2014-10-08 06:47:58 UTC) #50
dcheng
https://codereview.chromium.org/610533003/diff/180001/net/ssl/openssl_client_key_store.cc File net/ssl/openssl_client_key_store.cc (right): https://codereview.chromium.org/610533003/diff/180001/net/ssl/openssl_client_key_store.cc#newcode55 net/ssl/openssl_client_key_store.cc:55: this->swap(other); On 2014/10/08 at 06:47:57, pneubeck wrote: > nit: ...
6 years, 2 months ago (2014-10-08 18:40:22 UTC) #51
danakj
On 2014/10/07 22:40:09, dcheng wrote: > On 2014/10/07 at 19:34:32, danakj wrote: > > On ...
6 years, 2 months ago (2014-10-08 19:01:20 UTC) #52
dcheng
On 2014/10/08 at 19:01:20, danakj wrote: > On 2014/10/07 22:40:09, dcheng wrote: > > On ...
6 years, 2 months ago (2014-10-13 16:20:06 UTC) #53
danakj
That LGTM
6 years, 2 months ago (2014-10-14 17:24:53 UTC) #54
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/610533003/220001
6 years, 2 months ago (2014-10-14 17:30:06 UTC) #56
commit-bot: I haz the power
Try jobs failed on following builders: android_dbg_tests_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tests_recipe/builds/18206)
6 years, 2 months ago (2014-10-14 20:09:28 UTC) #58
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/610533003/330001
6 years, 2 months ago (2014-10-14 20:28:47 UTC) #60
commit-bot: I haz the power
Committed patchset #13 (id:330001)
6 years, 2 months ago (2014-10-14 22:42:17 UTC) #61
commit-bot: I haz the power
6 years, 2 months ago (2014-10-14 22:43:42 UTC) #62
Message was sent while issue was closed.
Patchset 13 (id:??) landed as
https://crrev.com/9961abd411eab6ec1cf9421078dfdaa001a7e2b5
Cr-Commit-Position: refs/heads/master@{#299571}

Powered by Google App Engine
This is Rietveld 408576698