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

Issue 159800: Add short circuit case for self assignment... (Closed)

Created:
11 years, 4 months ago by jar (doing other things)
Modified:
9 years, 3 months ago
Reviewers:
cpu_(ooo_6.6-7.5), wtc
CC:
brettw, chromium-reviews
Visibility:
Public.

Description

Add short circuit case for self assignment, and add virtual destructor Pickle is a base class of Message, which has a virtual destructor, so it is better to have Pickle have a virtual destructor as well. Add more defensive code in the case of self assignment. **IF** self assignment was used, and the target was read-only, then the existing code would have a memory fault. I don't think this is currently possible in use cases, but the defensize code is much better. (per suggestion from CPU on last CL). BUG=17027 BUG=17088 r=cpu Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=22826

Patch Set 1 #

Total comments: 1

Patch Set 2 : '' #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -3 lines) Patch
M base/pickle.h View 1 chunk +1 line, -1 line 1 comment Download
M base/pickle.cc View 1 2 chunks +7 lines, -2 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
jar (doing other things)
11 years, 4 months ago (2009-08-03 20:18:11 UTC) #1
cpu_(ooo_6.6-7.5)
LGTM http://codereview.chromium.org/159800/diff/1/2 File base/pickle.cc (right): http://codereview.chromium.org/159800/diff/1/2#newcode69 Line 69: return *this; I would not mind if ...
11 years, 4 months ago (2009-08-03 20:35:13 UTC) #2
jar (doing other things)
11 years, 4 months ago (2009-08-07 22:56:00 UTC) #3
wtc
9 years, 3 months ago (2011-09-21 23:37:04 UTC) #4
http://codereview.chromium.org/159800/diff/2001/base/pickle.h
File base/pickle.h (right):

http://codereview.chromium.org/159800/diff/2001/base/pickle.h#newcode34
base/pickle.h:34: virtual ~Pickle();
jar: I was wondering why the Pickle class has a virtual
destructor, and I tracked it down to this CL.

The Pickle class does not have any virtual method, so it
is strange for it to have a virtual destructor.

I am not convinced that the reason you gave is correct.
In any case, I suggest you add a comment to the source code
to explain why.  This will save the next person a few minutes
to answer this question.  Thanks.

Powered by Google App Engine
This is Rietveld 408576698