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

Issue 195993007: Factor out GamepadCommon base class from Gamepad and WebKitGamepad (Closed)

Created:
6 years, 9 months ago by Nils Barth (inactive)
Modified:
6 years, 9 months ago
CC:
blink-reviews, abarth-chromium, kouhei (in TOK)
Visibility:
Public.

Description

Factor out GamepadCommon base class from Gamepad and WebKitGamepad WebKitGamepad is a legacy interface for Gamepad, and hence there's a lot of duplicated code. This reduces the duplication by C++ inheritance from a base class. (Also cleanup for consistency and brevity.) There isn't much code duplication for WebKitGamepadList/GamepadList, so no benefit for a base class there, but tweaks. Notes: * Use C++ inheritance only; IDL files are unchanged (*implementation* is inherited, *interface* is not) * Inherit from an abstract GamepadCommon class (needed for ScriptWrappable::init in constructor, avoids duplicate members and virtual methods) Followup to: Added non-prefixed navigator.getGamepads() with updated API https://codereview.chromium.org/183313003/ BUG=344556 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=169194

Patch Set 1 #

Patch Set 2 : Cleaned up #

Total comments: 8

Patch Set 3 : Add ABC FIXME #

Total comments: 7

Patch Set 4 : Base class #

Patch Set 5 : Tweak #

Total comments: 10

Patch Set 6 : Revised #

Total comments: 18

Patch Set 7 : Ctors and dtors in impl #

Patch Set 8 : Other ctor/dtor #

Patch Set 9 : Remove excess header #

Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -135 lines) Patch
M Source/modules/gamepad/Gamepad.h View 1 2 3 4 5 6 3 chunks +2 lines, -29 lines 0 comments Download
M Source/modules/gamepad/Gamepad.cpp View 1 2 3 4 5 6 2 chunks +1 line, -10 lines 0 comments Download
A + Source/modules/gamepad/GamepadCommon.h View 1 2 3 4 5 6 2 chunks +7 lines, -22 lines 0 comments Download
A + Source/modules/gamepad/GamepadCommon.cpp View 1 2 3 4 5 6 2 chunks +16 lines, -6 lines 0 comments Download
M Source/modules/gamepad/GamepadList.h View 1 2 3 4 5 6 1 chunk +7 lines, -8 lines 0 comments Download
M Source/modules/gamepad/GamepadList.cpp View 1 2 3 4 5 6 2 chunks +5 lines, -5 lines 0 comments Download
M Source/modules/gamepad/WebKitGamepad.h View 1 2 3 4 5 6 7 2 chunks +3 lines, -28 lines 0 comments Download
M Source/modules/gamepad/WebKitGamepad.cpp View 1 2 3 4 5 6 7 2 chunks +1 line, -14 lines 0 comments Download
M Source/modules/gamepad/WebKitGamepadList.h View 1 2 3 4 5 6 7 8 1 chunk +7 lines, -8 lines 0 comments Download
M Source/modules/gamepad/WebKitGamepadList.cpp View 1 2 3 4 5 6 7 2 chunks +5 lines, -5 lines 0 comments Download
M Source/modules/modules.gypi View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (0 generated)
Nils Barth (inactive)
Here's a pure C++ proposal; how does it look? Relevant tests pass: gamepad/, specifically: gamepad/gamepad-api.html ...
6 years, 9 months ago (2014-03-13 06:10:42 UTC) #1
haraken
Overall, the approach looks good. https://codereview.chromium.org/195993007/diff/20001/Source/modules/gamepad/WebKitGamepad.h File Source/modules/gamepad/WebKitGamepad.h (right): https://codereview.chromium.org/195993007/diff/20001/Source/modules/gamepad/WebKitGamepad.h#newcode32 Source/modules/gamepad/WebKitGamepad.h:32: ScriptWrappable::init(this); As discussed offline, ...
6 years, 9 months ago (2014-03-13 06:29:39 UTC) #2
Nils Barth (inactive)
Thanks! (A question about trace().) https://codereview.chromium.org/195993007/diff/20001/Source/modules/gamepad/WebKitGamepad.h File Source/modules/gamepad/WebKitGamepad.h (right): https://codereview.chromium.org/195993007/diff/20001/Source/modules/gamepad/WebKitGamepad.h#newcode32 Source/modules/gamepad/WebKitGamepad.h:32: ScriptWrappable::init(this); On 2014/03/13 06:29:39, ...
6 years, 9 months ago (2014-03-13 06:42:20 UTC) #3
kouhei (in TOK)
https://codereview.chromium.org/195993007/diff/20001/Source/modules/gamepad/WebKitGamepadList.h File Source/modules/gamepad/WebKitGamepadList.h (left): https://codereview.chromium.org/195993007/diff/20001/Source/modules/gamepad/WebKitGamepadList.h#oldcode27 Source/modules/gamepad/WebKitGamepadList.h:27: void trace(Visitor*); On 2014/03/13 06:42:21, Nils Barth wrote: > ...
6 years, 9 months ago (2014-03-13 06:47:09 UTC) #4
Nils Barth (inactive)
Thanks for comments! https://codereview.chromium.org/195993007/diff/20001/Source/modules/gamepad/WebKitGamepadList.h File Source/modules/gamepad/WebKitGamepadList.h (left): https://codereview.chromium.org/195993007/diff/20001/Source/modules/gamepad/WebKitGamepadList.h#oldcode27 Source/modules/gamepad/WebKitGamepadList.h:27: void trace(Visitor*); On 2014/03/13 06:47:09, kouhei ...
6 years, 9 months ago (2014-03-13 06:58:42 UTC) #5
haraken
https://codereview.chromium.org/195993007/diff/40001/Source/modules/gamepad/GamepadList.h File Source/modules/gamepad/GamepadList.h (right): https://codereview.chromium.org/195993007/diff/40001/Source/modules/gamepad/GamepadList.h#newcode58 Source/modules/gamepad/GamepadList.h:58: // WebKitGamepadList items are of type WebKitGamepad, not Gamepad ...
6 years, 9 months ago (2014-03-13 07:08:49 UTC) #6
Nils Barth (inactive)
https://codereview.chromium.org/195993007/diff/40001/Source/modules/gamepad/WebKitGamepad.h File Source/modules/gamepad/WebKitGamepad.h (right): https://codereview.chromium.org/195993007/diff/40001/Source/modules/gamepad/WebKitGamepad.h#newcode27 Source/modules/gamepad/WebKitGamepad.h:27: void trace(Visitor*) { }; On 2014/03/13 07:08:50, haraken wrote: ...
6 years, 9 months ago (2014-03-13 07:36:14 UTC) #7
Nils Barth (inactive)
PTAL WebKitGamepad and Gamepad inherit from GamepadCommon, but WebKitGamepadList/GamepadList do not.
6 years, 9 months ago (2014-03-13 08:49:52 UTC) #8
kouhei (in TOK)
https://codereview.chromium.org/195993007/diff/80001/Source/modules/gamepad/Gamepad.h File Source/modules/gamepad/Gamepad.h (right): https://codereview.chromium.org/195993007/diff/80001/Source/modules/gamepad/Gamepad.h#newcode38 Source/modules/gamepad/Gamepad.h:38: class Gamepad FINAL : public GamepadCommon, public RefCountedWillBeGarbageCollectedFinalized<Gamepad>, public ...
6 years, 9 months ago (2014-03-13 09:05:10 UTC) #9
Nils Barth (inactive)
Thanks for review Kouhei, revised! https://codereview.chromium.org/195993007/diff/80001/Source/modules/gamepad/Gamepad.h File Source/modules/gamepad/Gamepad.h (right): https://codereview.chromium.org/195993007/diff/80001/Source/modules/gamepad/Gamepad.h#newcode38 Source/modules/gamepad/Gamepad.h:38: class Gamepad FINAL : ...
6 years, 9 months ago (2014-03-13 09:15:14 UTC) #10
kouhei (in TOK)
https://codereview.chromium.org/195993007/diff/80001/Source/modules/gamepad/Gamepad.h File Source/modules/gamepad/Gamepad.h (right): https://codereview.chromium.org/195993007/diff/80001/Source/modules/gamepad/Gamepad.h#newcode49 Source/modules/gamepad/Gamepad.h:49: void trace(Visitor* visitor) { visitor->trace(m_buttons); } On 2014/03/13 09:15:14, ...
6 years, 9 months ago (2014-03-13 09:17:10 UTC) #11
Nils Barth (inactive)
https://codereview.chromium.org/195993007/diff/80001/Source/modules/gamepad/Gamepad.h File Source/modules/gamepad/Gamepad.h (right): https://codereview.chromium.org/195993007/diff/80001/Source/modules/gamepad/Gamepad.h#newcode49 Source/modules/gamepad/Gamepad.h:49: void trace(Visitor* visitor) { visitor->trace(m_buttons); } On 2014/03/13 09:17:10, ...
6 years, 9 months ago (2014-03-13 09:19:51 UTC) #12
haraken
I'm curious why you add GamepadCommon but you don't add GamepadListCommon. https://codereview.chromium.org/195993007/diff/100001/Source/modules/gamepad/Gamepad.h File Source/modules/gamepad/Gamepad.h (right): ...
6 years, 9 months ago (2014-03-13 09:33:50 UTC) #13
zerny-chromium
DBCs https://codereview.chromium.org/195993007/diff/100001/Source/modules/gamepad/Gamepad.h File Source/modules/gamepad/Gamepad.h (right): https://codereview.chromium.org/195993007/diff/100001/Source/modules/gamepad/Gamepad.h#newcode44 Source/modules/gamepad/Gamepad.h:44: ~Gamepad() { } Nit: keep the impl in ...
6 years, 9 months ago (2014-03-13 09:48:00 UTC) #14
haraken
https://codereview.chromium.org/195993007/diff/100001/Source/modules/gamepad/Gamepad.h File Source/modules/gamepad/Gamepad.h (right): https://codereview.chromium.org/195993007/diff/100001/Source/modules/gamepad/Gamepad.h#newcode49 Source/modules/gamepad/Gamepad.h:49: void trace(Visitor*); On 2014/03/13 09:48:00, zerny-chromium wrote: > On ...
6 years, 9 months ago (2014-03-13 10:22:35 UTC) #15
Nils Barth (inactive)
On 2014/03/13 09:33:50, haraken wrote: > I'm curious why you add GamepadCommon but you don't ...
6 years, 9 months ago (2014-03-13 10:31:09 UTC) #16
haraken
LGTM if you apply comments in #13 and #14 (except for the comments about trace() ...
6 years, 9 months ago (2014-03-13 10:41:16 UTC) #17
Nils Barth (inactive)
Thanks for the comments, revised! https://codereview.chromium.org/195993007/diff/100001/Source/modules/gamepad/Gamepad.h File Source/modules/gamepad/Gamepad.h (right): https://codereview.chromium.org/195993007/diff/100001/Source/modules/gamepad/Gamepad.h#newcode44 Source/modules/gamepad/Gamepad.h:44: ~Gamepad() { } On ...
6 years, 9 months ago (2014-03-13 12:51:14 UTC) #18
Nils Barth (inactive)
On 2014/03/13 10:41:16, haraken wrote: > LGTM if you apply comments in #13 and #14 ...
6 years, 9 months ago (2014-03-13 12:59:06 UTC) #19
haraken
LGTM.
6 years, 9 months ago (2014-03-13 14:33:14 UTC) #20
bajones
On 2014/03/13 14:33:14, haraken wrote: > LGTM. LGTM too, FWIW.
6 years, 9 months ago (2014-03-13 17:26:53 UTC) #21
Nils Barth (inactive)
The CQ bit was checked by nbarth@chromium.org
6 years, 9 months ago (2014-03-14 01:41:06 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nbarth@chromium.org/195993007/160001
6 years, 9 months ago (2014-03-14 01:41:19 UTC) #23
commit-bot: I haz the power
6 years, 9 months ago (2014-03-14 02:33:32 UTC) #24
Message was sent while issue was closed.
Change committed as 169194

Powered by Google App Engine
This is Rietveld 408576698