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

Issue 2675033002: [Media Router] Add MediaSink subtypes (Closed)

Created:
3 years, 10 months ago by zhaobin
Modified:
3 years, 9 months ago
CC:
Aaron Boodman, abarth-chromium, chfremer+watch_chromium.org, chromium-apps-reviews_chromium.org, chromium-reviews, darin (slow to review), extensions-reviews_chromium.org, feature-media-reviews_chromium.org, mcasas+watch+vc_chromium.org, media-router+watch_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Media Router] Add MediaSink subtypes - Introduce subclasses of MediaSink (DialMediaSink and CastMediaSink) in C++ - Introduce Mojo struct definitions - Add typemap for MediaSink subclasses - Add unit tests for typemap conversion MediaSink typemap is based on https://codereview.chromium.org/2666873006/. Will merge when that lands. BUG=687365 Review-Url: https://codereview.chromium.org/2675033002 Cr-Commit-Position: refs/heads/master@{#457123} Committed: https://chromium.googlesource.com/chromium/src/+/88c63227018cd614c0eab270dbc2c6aea43a79ec

Patch Set 1 #

Total comments: 12

Patch Set 2 : resolve code review comments from dcheng #

Patch Set 3 : add url.mojom to media_router.mojoms JsResources #

Total comments: 46

Patch Set 4 : resolve code review comments from Derek #

Total comments: 1

Patch Set 5 : add TypedMediaSink class #

Total comments: 30

Patch Set 6 : resolve code review comments from Derek #

Patch Set 7 : merge with master #

Total comments: 12

Patch Set 8 : resolve code review comments from Mark #

Patch Set 9 : use base::Optional instead of union to store extra data #

Total comments: 52

Patch Set 10 : resolve code review comments from Derek and Mark #

Total comments: 25

Patch Set 11 : resolve code review comments from Mark #

Total comments: 8

Patch Set 12 : resolve code review comments from Mark #

Total comments: 10

Patch Set 13 : resolve code review comments from Derek #

Total comments: 17

Patch Set 14 : rebase #

Patch Set 15 : resolve code review comments from dcheng #

Patch Set 16 : fix android test failures #

Patch Set 17 : resolve code review comments from dcheng #

Total comments: 4

Patch Set 18 : resolve code review comments from dcheng #

Total comments: 6

Patch Set 19 : depend on net::IPAddress typemap patch #

Total comments: 24

Patch Set 20 : resolve code review comments from Derek and Mark #

Unified diffs Side-by-side diffs Delta from patch set Stats (+846 lines, -24 lines) Patch
M chrome/browser/media/router/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 4 chunks +16 lines, -0 lines 0 comments Download
A chrome/browser/media/router/discovery/media_sink_internal.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +128 lines, -0 lines 0 comments Download
A chrome/browser/media/router/discovery/media_sink_internal.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +175 lines, -0 lines 0 comments Download
A chrome/browser/media/router/discovery/media_sink_internal_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +128 lines, -0 lines 0 comments Download
M chrome/browser/media/router/media_sink.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +6 lines, -0 lines 0 comments Download
M chrome/browser/media/router/media_sink.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +10 lines, -0 lines 0 comments Download
M chrome/browser/media/router/mojo/media_router.mojom View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +41 lines, -0 lines 0 comments Download
M chrome/browser/media/router/mojo/media_router.typemap View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +4 lines, -2 lines 0 comments Download
M chrome/browser/media/router/mojo/media_router_mojo_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/media/router/mojo/media_router_mojo_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +8 lines, -1 line 0 comments Download
M chrome/browser/media/router/mojo/media_router_struct_traits.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +95 lines, -13 lines 0 comments Download
M chrome/browser/media/router/mojo/media_router_struct_traits.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +88 lines, -5 lines 0 comments Download
A chrome/browser/media/router/mojo/media_router_struct_traits_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +117 lines, -0 lines 0 comments Download
A chrome/browser/media/router/mojo/media_router_traits_test_service.mojom View 5 6 7 1 chunk +14 lines, -0 lines 0 comments Download
M chrome/test/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +2 lines, -0 lines 0 comments Download
M extensions/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +2 lines, -0 lines 0 comments Download
M extensions/renderer/dispatcher.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +3 lines, -1 line 0 comments Download
M extensions/renderer/resources/extensions_renderer_resources.grd View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 88 (38 generated)
zhaobin
3 years, 10 months ago (2017-02-03 23:58:34 UTC) #3
dcheng
https://codereview.chromium.org/2675033002/diff/20001/chrome/browser/media/router/mojo/media_router.mojom File chrome/browser/media/router/mojo/media_router.mojom (right): https://codereview.chromium.org/2675033002/diff/20001/chrome/browser/media/router/mojo/media_router.mojom#newcode39 chrome/browser/media/router/mojo/media_router.mojom:39: CastMediaSink? cast_media_sink; ? shouldn't be required on lines 38 ...
3 years, 10 months ago (2017-02-05 09:23:00 UTC) #4
zhaobin
https://codereview.chromium.org/2675033002/diff/20001/chrome/browser/media/router/mojo/media_router.mojom File chrome/browser/media/router/mojo/media_router.mojom (right): https://codereview.chromium.org/2675033002/diff/20001/chrome/browser/media/router/mojo/media_router.mojom#newcode39 chrome/browser/media/router/mojo/media_router.mojom:39: CastMediaSink? cast_media_sink; On 2017/02/05 09:23:00, dcheng wrote: > ? ...
3 years, 10 months ago (2017-02-06 19:37:11 UTC) #5
dcheng
mojo lg to me; I will stamp once someone who actually knows media router code ...
3 years, 10 months ago (2017-02-07 00:24:39 UTC) #6
imcheng
I have a number of comments but before addressing, I wanted to get Mark's take ...
3 years, 10 months ago (2017-02-08 01:28:09 UTC) #7
dcheng
https://codereview.chromium.org/2675033002/diff/60001/chrome/browser/media/router/media_sink.h File chrome/browser/media/router/media_sink.h (right): https://codereview.chromium.org/2675033002/diff/60001/chrome/browser/media/router/media_sink.h#newcode45 chrome/browser/media/router/media_sink.h:45: ~MediaSink(); On 2017/02/08 01:28:09, imcheng wrote: > This needs ...
3 years, 10 months ago (2017-02-08 03:01:05 UTC) #8
zhaobin
https://codereview.chromium.org/2675033002/diff/60001/chrome/browser/media/router/cast_media_sink.cc File chrome/browser/media/router/cast_media_sink.cc (right): https://codereview.chromium.org/2675033002/diff/60001/chrome/browser/media/router/cast_media_sink.cc#newcode17 chrome/browser/media/router/cast_media_sink.cc:17: type_ = SinkType::CAST; On 2017/02/08 01:28:08, imcheng wrote: > ...
3 years, 10 months ago (2017-02-09 00:13:53 UTC) #9
dcheng
https://codereview.chromium.org/2675033002/diff/60001/chrome/browser/media/router/media_sink.h File chrome/browser/media/router/media_sink.h (right): https://codereview.chromium.org/2675033002/diff/60001/chrome/browser/media/router/media_sink.h#newcode45 chrome/browser/media/router/media_sink.h:45: ~MediaSink(); On 2017/02/09 00:13:52, zhaobin wrote: > On 2017/02/08 ...
3 years, 10 months ago (2017-02-09 00:33:24 UTC) #10
imcheng
Thanks. I have a couple of comments following our discussion today. Additional comments will follow ...
3 years, 10 months ago (2017-02-09 02:19:57 UTC) #11
imcheng
Per yesterday's discussion with Bin, we are going with a slightly different approach. For pushing ...
3 years, 10 months ago (2017-02-09 18:11:59 UTC) #12
zhaobin
Added TypedMediaSink class to mojo. -dcheng@ for now till we finalize mojo API.
3 years, 10 months ago (2017-02-10 03:58:37 UTC) #15
imcheng
I think this is a good improvement over the original design. It isolates unrelated data ...
3 years, 10 months ago (2017-02-11 01:00:22 UTC) #16
zhaobin
https://codereview.chromium.org/2675033002/diff/120001/chrome/browser/media/router/media_sink.h File chrome/browser/media/router/media_sink.h (right): https://codereview.chromium.org/2675033002/diff/120001/chrome/browser/media/router/media_sink.h#newcode39 chrome/browser/media/router/media_sink.h:39: enum class SinkType { On 2017/02/11 01:00:21, imcheng wrote: ...
3 years, 10 months ago (2017-02-14 02:08:49 UTC) #17
mark a. foltz
https://codereview.chromium.org/2675033002/diff/160001/chrome/browser/media/router/mojo/media_router.mojom File chrome/browser/media/router/mojo/media_router.mojom (right): https://codereview.chromium.org/2675033002/diff/160001/chrome/browser/media/router/mojo/media_router.mojom#newcode36 chrome/browser/media/router/mojo/media_router.mojom:36: struct TypedMediaSink { Does this need to be distinct ...
3 years, 10 months ago (2017-02-17 02:22:32 UTC) #18
imcheng
https://codereview.chromium.org/2675033002/diff/160001/chrome/browser/media/router/mojo/media_router.mojom File chrome/browser/media/router/mojo/media_router.mojom (right): https://codereview.chromium.org/2675033002/diff/160001/chrome/browser/media/router/mojo/media_router.mojom#newcode36 chrome/browser/media/router/mojo/media_router.mojom:36: struct TypedMediaSink { On 2017/02/17 02:22:31, mark a. foltz ...
3 years, 10 months ago (2017-02-17 19:56:16 UTC) #19
mark a. foltz
https://codereview.chromium.org/2675033002/diff/160001/chrome/browser/media/router/mojo/media_router.mojom File chrome/browser/media/router/mojo/media_router.mojom (right): https://codereview.chromium.org/2675033002/diff/160001/chrome/browser/media/router/mojo/media_router.mojom#newcode13 chrome/browser/media/router/mojo/media_router.mojom:13: enum IconType { Does this generated a nested class ...
3 years, 10 months ago (2017-02-21 17:32:37 UTC) #20
imcheng
On 2017/02/21 17:32:37, mark a. foltz wrote: > https://codereview.chromium.org/2675033002/diff/160001/chrome/browser/media/router/mojo/media_router.mojom > File chrome/browser/media/router/mojo/media_router.mojom (right): > > ...
3 years, 10 months ago (2017-02-21 18:53:09 UTC) #21
mark a. foltz
On 2017/02/21 at 18:53:09, imcheng wrote: > On 2017/02/21 17:32:37, mark a. foltz wrote: > ...
3 years, 10 months ago (2017-02-21 19:03:21 UTC) #22
imcheng
On 2017/02/21 19:03:21, mark a. foltz wrote: > On 2017/02/21 at 18:53:09, imcheng wrote: > ...
3 years, 10 months ago (2017-02-21 19:21:56 UTC) #23
zhaobin
https://codereview.chromium.org/2675033002/diff/160001/chrome/browser/media/router/mojo/media_router.mojom File chrome/browser/media/router/mojo/media_router.mojom (right): https://codereview.chromium.org/2675033002/diff/160001/chrome/browser/media/router/mojo/media_router.mojom#newcode13 chrome/browser/media/router/mojo/media_router.mojom:13: enum IconType { On 2017/02/21 17:32:37, mark a. foltz ...
3 years, 10 months ago (2017-02-22 00:42:08 UTC) #24
zhaobin
PTAL
3 years, 10 months ago (2017-02-23 18:27:37 UTC) #25
zhaobin
https://codereview.chromium.org/2675033002/diff/200001/chrome/browser/media/router/media_sink_internal.h File chrome/browser/media/router/media_sink_internal.h (right): https://codereview.chromium.org/2675033002/diff/200001/chrome/browser/media/router/media_sink_internal.h#newcode82 chrome/browser/media/router/media_sink_internal.h:82: // Set this field if |type_| == DIAL. Tried ...
3 years, 10 months ago (2017-02-24 02:19:15 UTC) #26
imcheng
https://codereview.chromium.org/2675033002/diff/200001/chrome/browser/media/router/media_sink_internal.cc File chrome/browser/media/router/media_sink_internal.cc (right): https://codereview.chromium.org/2675033002/diff/200001/chrome/browser/media/router/media_sink_internal.cc#newcode29 chrome/browser/media/router/media_sink_internal.cc:29: type_ = SinkType::GENERIC; Hmm... so set_sink changes the type ...
3 years, 10 months ago (2017-02-24 23:54:21 UTC) #27
mark a. foltz
Overall looks really good!!! Mostly minor comments - didn't review unittest closely this round. The ...
3 years, 10 months ago (2017-02-25 01:10:24 UTC) #28
zhaobin
https://codereview.chromium.org/2675033002/diff/200001/chrome/browser/media/router/media_sink_internal.cc File chrome/browser/media/router/media_sink_internal.cc (right): https://codereview.chromium.org/2675033002/diff/200001/chrome/browser/media/router/media_sink_internal.cc#newcode29 chrome/browser/media/router/media_sink_internal.cc:29: type_ = SinkType::GENERIC; On 2017/02/24 23:54:20, imcheng wrote: > ...
3 years, 9 months ago (2017-02-27 21:45:16 UTC) #29
mark a. foltz
Getting close https://codereview.chromium.org/2675033002/diff/220001/chrome/browser/media/router/discovery/media_sink_internal.cc File chrome/browser/media/router/discovery/media_sink_internal.cc (right): https://codereview.chromium.org/2675033002/diff/220001/chrome/browser/media/router/discovery/media_sink_internal.cc#newcode12 chrome/browser/media/router/discovery/media_sink_internal.cc:12: bool IsValidSinkIdChar(char ch) { I would just ...
3 years, 9 months ago (2017-02-28 00:05:30 UTC) #30
zhaobin
https://codereview.chromium.org/2675033002/diff/220001/chrome/browser/media/router/discovery/media_sink_internal.cc File chrome/browser/media/router/discovery/media_sink_internal.cc (right): https://codereview.chromium.org/2675033002/diff/220001/chrome/browser/media/router/discovery/media_sink_internal.cc#newcode12 chrome/browser/media/router/discovery/media_sink_internal.cc:12: bool IsValidSinkIdChar(char ch) { On 2017/02/28 00:05:29, mark a. ...
3 years, 9 months ago (2017-02-28 18:46:29 UTC) #31
mark a. foltz
LGTM with a few remaining comments addressed. Thanks for unit testing the struct traits. https://codereview.chromium.org/2675033002/diff/240001/chrome/browser/media/router/discovery/media_sink_internal.cc ...
3 years, 9 months ago (2017-03-01 04:53:19 UTC) #32
zhaobin
+dcheng@ back for mojo related changes. +rdevlin.cronin@ for extensions related changes. extensions/BUILD.gn extensions/renderer/dispatcher.cc extensions/renderer/resources/extensions_renderer_resources.grd https://codereview.chromium.org/2675033002/diff/240001/chrome/browser/media/router/discovery/media_sink_internal.cc ...
3 years, 9 months ago (2017-03-01 19:05:56 UTC) #34
imcheng
lgtm https://codereview.chromium.org/2675033002/diff/260001/chrome/browser/media/router/discovery/media_sink_internal.h File chrome/browser/media/router/discovery/media_sink_internal.h (right): https://codereview.chromium.org/2675033002/diff/260001/chrome/browser/media/router/discovery/media_sink_internal.h#newcode18 chrome/browser/media/router/discovery/media_sink_internal.h:18: // Model name of the sink nit: add ...
3 years, 9 months ago (2017-03-01 22:54:18 UTC) #39
Devlin
extensions lgtm
3 years, 9 months ago (2017-03-01 23:57:20 UTC) #40
dcheng
https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/discovery/media_sink_internal.h File chrome/browser/media/router/discovery/media_sink_internal.h (right): https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/discovery/media_sink_internal.h#newcode93 chrome/browser/media/router/discovery/media_sink_internal.h:93: // Set if sink is DIAL sink. One option ...
3 years, 9 months ago (2017-03-03 10:37:10 UTC) #53
zhaobin
https://codereview.chromium.org/2675033002/diff/260001/chrome/browser/media/router/discovery/media_sink_internal.h File chrome/browser/media/router/discovery/media_sink_internal.h (right): https://codereview.chromium.org/2675033002/diff/260001/chrome/browser/media/router/discovery/media_sink_internal.h#newcode18 chrome/browser/media/router/discovery/media_sink_internal.h:18: // Model name of the sink On 2017/03/01 22:54:18, ...
3 years, 9 months ago (2017-03-03 23:56:42 UTC) #54
dcheng
https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/discovery/media_sink_internal.h File chrome/browser/media/router/discovery/media_sink_internal.h (right): https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/discovery/media_sink_internal.h#newcode93 chrome/browser/media/router/discovery/media_sink_internal.h:93: // Set if sink is DIAL sink. On 2017/03/03 ...
3 years, 9 months ago (2017-03-04 01:49:16 UTC) #61
imcheng
On 2017/03/04 01:49:16, dcheng wrote: > https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/discovery/media_sink_internal.h > File chrome/browser/media/router/discovery/media_sink_internal.h (right): > > https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/discovery/media_sink_internal.h#newcode93 > ...
3 years, 9 months ago (2017-03-04 03:07:14 UTC) #64
dcheng
On 2017/03/04 03:07:14, imcheng wrote: > On 2017/03/04 01:49:16, dcheng wrote: > > > https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/discovery/media_sink_internal.h ...
3 years, 9 months ago (2017-03-04 03:12:52 UTC) #65
zhaobin
https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/discovery/media_sink_internal.h File chrome/browser/media/router/discovery/media_sink_internal.h (right): https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/discovery/media_sink_internal.h#newcode93 chrome/browser/media/router/discovery/media_sink_internal.h:93: // Set if sink is DIAL sink. On 2017/03/04 ...
3 years, 9 months ago (2017-03-06 18:31:26 UTC) #66
dcheng
https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/mojo/media_router.mojom File chrome/browser/media/router/mojo/media_router.mojom (right): https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/mojo/media_router.mojom#newcode41 chrome/browser/media/router/mojo/media_router.mojom:41: string ip_address; On 2017/03/06 18:31:26, zhaobin wrote: > On ...
3 years, 9 months ago (2017-03-06 23:02:05 UTC) #67
zhaobin
https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/mojo/media_router.mojom File chrome/browser/media/router/mojo/media_router.mojom (right): https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/mojo/media_router.mojom#newcode41 chrome/browser/media/router/mojo/media_router.mojom:41: string ip_address; On 2017/03/06 23:02:05, dcheng wrote: > On ...
3 years, 9 months ago (2017-03-07 19:28:49 UTC) #68
dcheng
https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/mojo/media_router.mojom File chrome/browser/media/router/mojo/media_router.mojom (right): https://codereview.chromium.org/2675033002/diff/280001/chrome/browser/media/router/mojo/media_router.mojom#newcode41 chrome/browser/media/router/mojo/media_router.mojom:41: string ip_address; On 2017/03/07 19:28:49, zhaobin wrote: > On ...
3 years, 9 months ago (2017-03-07 19:54:33 UTC) #69
zhaobin
https://codereview.chromium.org/2675033002/diff/380001/chrome/browser/media/router/mojo/media_router.mojom File chrome/browser/media/router/mojo/media_router.mojom (right): https://codereview.chromium.org/2675033002/diff/380001/chrome/browser/media/router/mojo/media_router.mojom#newcode40 chrome/browser/media/router/mojo/media_router.mojom:40: // Mirror of net::IPAddress. On 2017/03/07 19:54:32, dcheng wrote: ...
3 years, 9 months ago (2017-03-10 01:42:28 UTC) #70
imcheng
Bin, could you please test with the MR extension to make sure the extension resources ...
3 years, 9 months ago (2017-03-11 00:33:08 UTC) #71
zhaobin
dcheng@, it seems that imcheng@ and mfoltz@ both prefer base::Optional over union for extra data. ...
3 years, 9 months ago (2017-03-11 00:41:09 UTC) #72
imcheng
Bin: since you've already made the change to use union, I am fine with it ...
3 years, 9 months ago (2017-03-11 01:11:34 UTC) #73
dcheng
lgtm I understand that union introduces some extra boilerplate, but for things that are serialized ...
3 years, 9 months ago (2017-03-11 07:24:23 UTC) #74
mark a. foltz
https://codereview.chromium.org/2675033002/diff/400001/chrome/browser/media/router/discovery/media_sink_internal.cc File chrome/browser/media/router/discovery/media_sink_internal.cc (right): https://codereview.chromium.org/2675033002/diff/400001/chrome/browser/media/router/discovery/media_sink_internal.cc#newcode39 chrome/browser/media/router/discovery/media_sink_internal.cc:39: if (this != &other) { The conversion to union ...
3 years, 9 months ago (2017-03-13 17:47:24 UTC) #75
zhaobin
Shall we change media_router.mojom to use optional field instead of union? So we can keep ...
3 years, 9 months ago (2017-03-14 01:23:24 UTC) #76
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/2675033002/420001
3 years, 9 months ago (2017-03-15 17:27:14 UTC) #83
commit-bot: I haz the power
Committed patchset #20 (id:420001) as https://chromium.googlesource.com/chromium/src/+/88c63227018cd614c0eab270dbc2c6aea43a79ec
3 years, 9 months ago (2017-03-15 17:40:04 UTC) #87
mark a. foltz
3 years, 9 months ago (2017-03-18 18:15:11 UTC) #88
Message was sent while issue was closed.
On 2017/03/14 at 01:23:24, zhaobin wrote:
> Shall we change media_router.mojom to use optional field instead of union? So
we can keep mojo consistent with c++ objects and remove extra code in
MediaSinkInternal.

No, I think a union is the right way to represent the data being exchanged in
the mojom.

>
https://codereview.chromium.org/2675033002/diff/400001/chrome/browser/media/r...
> File chrome/browser/media/router/discovery/media_sink_internal.cc (right):
> 
>
https://codereview.chromium.org/2675033002/diff/400001/chrome/browser/media/r...
> chrome/browser/media/router/discovery/media_sink_internal.cc:39: if (this !=
&other) {
> On 2017/03/13 17:47:24, mark a. foltz wrote:
> > The conversion to union seems to require all this extra code to do copy and
> > assignment.  What is the benefit?
> 
> dcheng@ suggests that .mojom should be consistent with c++ object (if we use
union in media_router.mojom, we need to use union in c++ object). Maybe we can
change extra data to optional instead of union in mojom?

I agree that by default the .mojom and c++ should be consistent, unless that
introduces unnecessary complexity as a side effect, as (IMO) is the case here.

In MediaSinkInternal, the representation in C++ is completely hidden behind the
C++ API, so the choice should be driven by the simplest implementation.

I didn't see a material difference in the complexity of the type maps themselves
going one way or the other.

There's maybe a small benefit in object size for having one
base::ManualConstructor vs. two base::Optional, probably offset by the
additional code size for the Internal() functions in the .cc.

It's not really worth going back and forth on this further, but if I see this
pattern suggested again I plan to raise the issue on chromium-mojo.

m.

Powered by Google App Engine
This is Rietveld 408576698