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

Issue 2902253003: Refactor UniqueNameHelper to use an adapter pattern for code sharing. (Closed)

Created:
3 years, 6 months ago by dcheng
Modified:
3 years, 6 months ago
CC:
chromium-reviews, jam, nasko+codewatch_chromium.org, darin-cc_chromium.org, creis+watch_chromium.org, mlamouri+watch-content_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor UniqueNameHelper to use an adapter pattern for code sharing. This currently lives in //content/renderer and uses blink::WebFrame directly. However, ExplodedFrameState will also need to do unique name generation in the future when migrating unique name schemes. Since ExplodedFrameState is in //content/common and can't reference non-POD Blink types, this CL changes UniqueNameHelper to factor the blink::WebFrame* specific logic behind an adapter interface. The trickier part of this is that the adapter interface can't easily provide lower-level concepts like Parent(), FirstSibling(), etc to walk the frame tree: the adapter interface is virtual, so it can't simply manufacture on-the-fly by-value wrappers for the return values of these methods--the storage would need to be owned by each RenderFrameImpl *and* RenderFrameProxy. Instead, the adapter provides higher-level concepts. This will come in useful in followup patches where methods like GetFramePosition() can be extracted from ExplodedFrameState's generated unique name rather than walking ExplodedFrameState's and assuming the ordering matches DOM insertion order, etc. This also allows some internal cleanup in UniqueNameHelper to more cleanly handle the 'create new child frame' case. BUG=626202, 645123 Review-Url: https://codereview.chromium.org/2902253003 Cr-Commit-Position: refs/heads/master@{#474839} Committed: https://chromium.googlesource.com/chromium/src/+/61b2c92224f1bb6db51b0d7b9a84a08dd451f658

Patch Set 1 #

Patch Set 2 : Add comment. #

Total comments: 15

Patch Set 3 : Address comments. #

Patch Set 4 : really address comments #

Total comments: 4

Patch Set 5 : address more comments #

Patch Set 6 : Fix off by one bug #

Unified diffs Side-by-side diffs Delta from patch set Stats (+253 lines, -420 lines) Patch
M content/common/BUILD.gn View 1 chunk +2 lines, -0 lines 0 comments Download
A + content/common/unique_name_helper.h View 1 2 3 4 5 chunks +52 lines, -19 lines 0 comments Download
A + content/common/unique_name_helper.cc View 1 2 3 4 5 3 chunks +78 lines, -95 lines 0 comments Download
M content/renderer/BUILD.gn View 1 chunk +0 lines, -2 lines 0 comments Download
M content/renderer/render_frame_impl.h View 1 2 3 4 3 chunks +22 lines, -1 line 0 comments Download
M content/renderer/render_frame_impl.cc View 1 2 3 4 4 chunks +99 lines, -3 lines 0 comments Download
D content/renderer/unique_name_helper.h View 1 chunk +0 lines, -113 lines 0 comments Download
D content/renderer/unique_name_helper.cc View 1 chunk +0 lines, -187 lines 0 comments Download

Messages

Total messages: 30 (20 generated)
dcheng
This CL should be pretty straightforward; it's just pulling the logic that depends on blink::WebFrame ...
3 years, 6 months ago (2017-05-25 15:39:16 UTC) #8
Łukasz Anforowicz
Just some minor comments below... https://codereview.chromium.org/2902253003/diff/20001/content/common/unique_name_helper.h File content/common/unique_name_helper.h (right): https://codereview.chromium.org/2902253003/diff/20001/content/common/unique_name_helper.h#newcode126 content/common/unique_name_helper.h:126: // egg problem, this ...
3 years, 6 months ago (2017-05-25 16:48:50 UTC) #9
dcheng
https://codereview.chromium.org/2902253003/diff/20001/content/common/unique_name_helper.h File content/common/unique_name_helper.h (right): https://codereview.chromium.org/2902253003/diff/20001/content/common/unique_name_helper.h#newcode126 content/common/unique_name_helper.h:126: // egg problem, this method is designed to be ...
3 years, 6 months ago (2017-05-25 18:25:03 UTC) #11
Łukasz Anforowicz
https://codereview.chromium.org/2902253003/diff/20001/content/common/unique_name_helper.cc File content/common/unique_name_helper.cc (right): https://codereview.chromium.org/2902253003/diff/20001/content/common/unique_name_helper.cc#newcode159 content/common/unique_name_helper.cc:159: unique_name_.clear(); I thought you said (*) that we still ...
3 years, 6 months ago (2017-05-25 18:33:18 UTC) #13
dcheng
https://codereview.chromium.org/2902253003/diff/20001/content/common/unique_name_helper.cc File content/common/unique_name_helper.cc (right): https://codereview.chromium.org/2902253003/diff/20001/content/common/unique_name_helper.cc#newcode159 content/common/unique_name_helper.cc:159: unique_name_.clear(); On 2017/05/25 18:33:18, Łukasz A. wrote: > I ...
3 years, 6 months ago (2017-05-25 18:40:41 UTC) #14
Łukasz Anforowicz
Thanks - lgtm.
3 years, 6 months ago (2017-05-25 18:50:33 UTC) #15
Charlie Reis
LGTM! https://codereview.chromium.org/2902253003/diff/60001/content/common/unique_name_helper.cc File content/common/unique_name_helper.cc (right): https://codereview.chromium.org/2902253003/diff/60001/content/common/unique_name_helper.cc#newcode28 content/common/unique_name_helper.cc:28: int GetSiblingCount() const override { return parent_->GetChildCount(); } ...
3 years, 6 months ago (2017-05-25 20:34:25 UTC) #18
dcheng
https://codereview.chromium.org/2902253003/diff/60001/content/common/unique_name_helper.cc File content/common/unique_name_helper.cc (right): https://codereview.chromium.org/2902253003/diff/60001/content/common/unique_name_helper.cc#newcode28 content/common/unique_name_helper.cc:28: int GetSiblingCount() const override { return parent_->GetChildCount(); } On ...
3 years, 6 months ago (2017-05-25 21:11:16 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2902253003/100001
3 years, 6 months ago (2017-05-25 21:26:45 UTC) #27
commit-bot: I haz the power
3 years, 6 months ago (2017-05-25 23:10:28 UTC) #30
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as
https://chromium.googlesource.com/chromium/src/+/61b2c92224f1bb6db51b0d7b9a84...

Powered by Google App Engine
This is Rietveld 408576698