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

Issue 1535403002: Cleanup return values in DOM Range. (Closed)

Created:
5 years ago by JakeYoon
Modified:
4 years, 11 months ago
CC:
blink-reviews, blink-reviews-dom_chromium.org, chromium-reviews, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Cleanup return values in DOM Range. This CL turns const by value return values into const by ref. Replacing const value by a const ref when a member variable is safe, because the member variable will live at least as long as the temporary object returned now. It can also be more efficient, because returning a ref can spare copying. BUG=568959

Patch Set 1 #

Total comments: 1

Patch Set 2 : Separate AUTHORS modify #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -2 lines) Patch
M third_party/WebKit/Source/core/dom/Range.h View 1 chunk +2 lines, -2 lines 3 comments Download

Messages

Total messages: 20 (3 generated)
JakeYoon
Hello Haraken, Can you please take a look at this small cleanup? Cheers, Jaeseok Yoon.
5 years ago (2015-12-20 14:57:41 UTC) #3
haraken
https://codereview.chromium.org/1535403002/diff/1/AUTHORS File AUTHORS (right): https://codereview.chromium.org/1535403002/diff/1/AUTHORS#newcode247 AUTHORS:247: Jaeseok Yoon <yjaeseok@gmail.com> Please make this change separately before ...
5 years ago (2015-12-20 17:23:19 UTC) #4
JakeYoon
Hello, Separate AUTHORS! And I already have signed up a CLA. Thanks Haraken. :)
5 years ago (2015-12-20 21:02:57 UTC) #5
haraken
On 2015/12/20 21:02:57, JakeYoon wrote: > Hello, > > Separate AUTHORS! > And I already ...
5 years ago (2015-12-21 01:03:27 UTC) #6
JakeYoon
On 2015/12/21 01:03:27, haraken wrote: > On 2015/12/20 21:02:57, JakeYoon wrote: > > Hello, > ...
5 years ago (2015-12-21 14:44:55 UTC) #7
JakeYoon
On 2015/12/21 14:44:55, JakeYoon wrote: > On 2015/12/21 01:03:27, haraken wrote: > > On 2015/12/20 ...
5 years ago (2015-12-22 05:32:03 UTC) #8
haraken
This change needs to be reviewed by yosin@ or yoichio@. https://codereview.chromium.org/1535403002/diff/20001/third_party/WebKit/Source/core/dom/Range.h File third_party/WebKit/Source/core/dom/Range.h (right): https://codereview.chromium.org/1535403002/diff/20001/third_party/WebKit/Source/core/dom/Range.h#newcode117 ...
5 years ago (2015-12-22 06:45:38 UTC) #10
JakeYoon
Hi yosin and yoichio!! Why don't you review my first commit?! Maybe it is your ...
4 years, 11 months ago (2015-12-30 14:25:08 UTC) #11
JakeYoon
Hi yosin and yoichio!! Why don't you review my first commit?! Maybe it is your ...
4 years, 11 months ago (2015-12-30 14:25:09 UTC) #12
tfarina
On Sun, Dec 20, 2015 at 11:03 PM, <haraken@chromium.org> wrote: > On 2015/12/20 21:02:57, JakeYoon ...
4 years, 11 months ago (2015-12-30 14:39:38 UTC) #13
tfarina
On Sun, Dec 20, 2015 at 11:03 PM, <haraken@chromium.org> wrote: > On 2015/12/20 21:02:57, JakeYoon ...
4 years, 11 months ago (2015-12-30 14:39:38 UTC) #14
haraken
On 2015/12/30 14:39:38, tfarina wrote: > On Sun, Dec 20, 2015 at 11:03 PM, <mailto:haraken@chromium.org> ...
4 years, 11 months ago (2015-12-30 15:58:17 UTC) #15
tfarina
On Wednesday, December 30, 2015, <haraken@chromium.org> wrote: > On 2015/12/30 14:39:38, tfarina wrote: > >> ...
4 years, 11 months ago (2015-12-30 18:04:35 UTC) #16
tfarina
On Wednesday, December 30, 2015, <haraken@chromium.org> wrote: > On 2015/12/30 14:39:38, tfarina wrote: > >> ...
4 years, 11 months ago (2015-12-30 18:04:36 UTC) #17
yosin_UTC9
Sorry for late response. I was on vacation during last December. https://codereview.chromium.org/1535403002/diff/20001/third_party/WebKit/Source/core/dom/Range.h File third_party/WebKit/Source/core/dom/Range.h (right): ...
4 years, 11 months ago (2016-01-05 04:32:31 UTC) #18
JakeYoon
https://codereview.chromium.org/1535403002/diff/20001/third_party/WebKit/Source/core/dom/Range.h File third_party/WebKit/Source/core/dom/Range.h (right): https://codereview.chromium.org/1535403002/diff/20001/third_party/WebKit/Source/core/dom/Range.h#newcode116 third_party/WebKit/Source/core/dom/Range.h:116: const Position& startPosition() const { return m_start.toPosition(); } On ...
4 years, 11 months ago (2016-01-05 13:12:46 UTC) #19
yosin_UTC9
4 years, 11 months ago (2016-01-06 01:25:12 UTC) #20
On 2016/01/05 at 13:12:46, yjaeseok wrote:
>
https://codereview.chromium.org/1535403002/diff/20001/third_party/WebKit/Sour...
> File third_party/WebKit/Source/core/dom/Range.h (right):
> 
>
https://codereview.chromium.org/1535403002/diff/20001/third_party/WebKit/Sour...
> third_party/WebKit/Source/core/dom/Range.h:116: const Position&
startPosition() const { return m_start.toPosition(); }
> On 2016/01/05 04:32:31, Yosi_UTC9 wrote:
> > We can't return const ref here at least VS2013 and VS2015. I got following
error
> > message:
> > 
> > d:\src\w\cr\src\third_party\webkit\source\core\dom\range.h(116) : warning
C4172:
> > returning address of local variable or temporary
> > d:\src\w\cr\src\third_party\webkit\source\core\dom\range.h(117) : warning
C4172:
> > returning address of local variable or temporary
> > 
> > Can clang/gcc compile this change w/o warnings/errors?
> > 
> 
> In fact, This patch is for replacing const value 
> by a const ref when a member.
> 
> But startPosition function doesn't return
> a member variable, So it looks like incorrect.
> How do you think Yoshi@ ??

start and end positions are calculated from RangeBoundaryPoint which holds
before
node, container node and "cached" offset for ease of relocation and avoiding
offset computation. We don't want to change it to Position object.

Returning |const Position| is for note that Position object immutable. There are
no member functions for mutating member variables in Position.

Powered by Google App Engine
This is Rietveld 408576698