New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 708209 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task



Sign in to add a comment

[Media Router] Refactor PresentationRequest and CreatePresentationConnectionRequest

Project Member Reported by taku...@chromium.org, Apr 4 2017

Issue description

PresentationRequest::MediaSources() is the only part in it that depends on Media-Router-specific classes, and it could be moved to media_source.h to avoid a circular dependency between components/ and content/.

 

Comment 1 by sko...@chromium.org, Apr 19 2017

Status: Availa (was: Untriaged)
Status: Available (was: Availa)

Comment 3 by mfo...@chromium.org, May 10 2017

Labels: Hotlist-Fixit-PE2017

Comment 4 by mfo...@chromium.org, May 10 2017

Labels: Hotlist-CodeHealth

Comment 5 by mfo...@chromium.org, May 30 2017

Owner: mfo...@chromium.org
Status: Assigned (was: Available)
Summary: [Media Router] Refactor PresentationRequest and CreatePresentationConnectionRequest (was: Move media_router::PresentationRequest to content/browser/)
Expanding the scope of this to cover two related code cleanups, including the TODO I added here.

https://cs.chromium.org/chromium/src/chrome/browser/media/router/create_presentation_connection_request.h?l=35

After looking through the code, here are the full list of steps that look necessary.

1. Move PresentationRequest to content/browser as suggested in the original post.

2. Refactor PresentationServiceDelegateImpl/MediaRouterDialogController to pass PresentationRequest instead of CPCR.  At this point CPCR is only used by MediaRouterUI to track calls to Media Router.

3. Create a simpler nested struct (implementation detail) of MediaRouterUI to keep track of pending callbacks for calls to the Media Router.  The existing CPCR can be deleted as part of this change.

I won't have time to start in earnest on this now, but it will be in my fixit queue.

Owner: imch...@chromium.org
Status: Started (was: Assigned)
Project Member

Comment 7 by bugdroid1@chromium.org, Jul 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/008d9944bd493e04153cd1812d52b6709d036d5d

commit 008d9944bd493e04153cd1812d52b6709d036d5d
Author: Derek Cheng <imcheng@chromium.org>
Date: Mon Jul 24 20:21:49 2017

[Media Router] PresentationRequest cleanup round 1.

Move PresentationRequest to content/browser and use it in
PresentationServiceDelegate where applicable.
- Replace GetMediaSources() method with helper function in c/b/m/r.
- Replace Equals() method with a helper function in PSDImpl.
- PresentationRequest is now a struct.


Other things to consider after this patch:
- Move PresentationRequest out of CPCR, maybe make
  ShowMediaRouterDialogForPresentation take a PR and 2 callbacks?
-- the callbacks can be wrapped in a struct internal to MRDC.
- Remove the PR equality checking - we don't need this if we know
the PresentationRequest has not been reset.
- Support moves for PresentationRequest. Right now it's effective in
only one place but further cleanups may find it useful.


Bug:  664326 ,  708209 
Change-Id: I0ead3d0c2a8cc73849a6d007369e2ab13f1467d2
Reviewed-on: https://chromium-review.googlesource.com/578528
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: mark a. foltz <mfoltz@chromium.org>
Commit-Queue: Derek Cheng <imcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489064}
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/media/android/router/media_router_dialog_controller_android.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/media/router/BUILD.gn
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/media/router/create_presentation_connection_request.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/media/router/create_presentation_connection_request.h
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/media/router/create_presentation_connection_request_unittest.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/media/router/media_router_dialog_controller_unittest.cc
[delete] https://crrev.com/b6326dbba2a5b7e2b1ce7979031149dd8013ad20/chrome/browser/media/router/presentation_request.cc
[delete] https://crrev.com/b6326dbba2a5b7e2b1ce7979031149dd8013ad20/chrome/browser/media/router/presentation_request.h
[delete] https://crrev.com/b6326dbba2a5b7e2b1ce7979031149dd8013ad20/chrome/browser/media/router/presentation_request_unittest.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/media/router/presentation_service_delegate_impl.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/media/router/presentation_service_delegate_impl.h
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl_unittest.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/ui/webui/media_router/media_router_ui.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/ui/webui/media_router/media_router_ui.h
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/browser/ui/webui/media_router/media_router_ui_unittest.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/common/media_router/media_source_helper.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/common/media_router/media_source_helper.h
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/chrome/test/BUILD.gn
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/content/browser/presentation/presentation_service_impl.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/content/browser/presentation/presentation_service_impl.h
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/content/browser/presentation/presentation_service_impl_unittest.cc
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/content/public/browser/BUILD.gn
[add] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/content/public/browser/presentation_request.cc
[add] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/content/public/browser/presentation_request.h
[modify] https://crrev.com/008d9944bd493e04153cd1812d52b6709d036d5d/content/public/browser/presentation_service_delegate.h

Project Member

Comment 8 by bugdroid1@chromium.org, Jul 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/66d441e7c4fc2e6a41be8a10f6974d026388138e

commit 66d441e7c4fc2e6a41be8a10f6974d026388138e
Author: Fady Samuel <fsamuel@chromium.org>
Date: Mon Jul 24 21:07:10 2017

Revert "[Media Router] PresentationRequest cleanup round 1."

This reverts commit 008d9944bd493e04153cd1812d52b6709d036d5d.

Reason for revert:

This seems to have broken the build on Chrome for Chrome OS.

../../chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc:417:57: error: chosen constructor is explicit in copy-initialization
      {main_frame_process_id_, main_frame_routing_id_}, {}, frame_origin_);
                                                        ^~
../../build/linux/debian_jessie_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/debug/vector:79:7: note: explicit constructor declared here
      vector(const _Allocator& __a = _Allocator())
      ^
../../content/public/browser/presentation_request.h:23:48: note: passing argument to parameter 'presentation_urls' here
                      const std::vector<GURL>& presentation_urls,
                                               ^



Original change's description:
> [Media Router] PresentationRequest cleanup round 1.
> 
> Move PresentationRequest to content/browser and use it in
> PresentationServiceDelegate where applicable.
> - Replace GetMediaSources() method with helper function in c/b/m/r.
> - Replace Equals() method with a helper function in PSDImpl.
> - PresentationRequest is now a struct.
> 
> 
> Other things to consider after this patch:
> - Move PresentationRequest out of CPCR, maybe make
>   ShowMediaRouterDialogForPresentation take a PR and 2 callbacks?
> -- the callbacks can be wrapped in a struct internal to MRDC.
> - Remove the PR equality checking - we don't need this if we know
> the PresentationRequest has not been reset.
> - Support moves for PresentationRequest. Right now it's effective in
> only one place but further cleanups may find it useful.
> 
> 
> Bug:  664326 ,  708209 
> Change-Id: I0ead3d0c2a8cc73849a6d007369e2ab13f1467d2
> Reviewed-on: https://chromium-review.googlesource.com/578528
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Reviewed-by: mark a. foltz <mfoltz@chromium.org>
> Commit-Queue: Derek Cheng <imcheng@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#489064}

TBR=avi@chromium.org,mfoltz@chromium.org,imcheng@chromium.org

Change-Id: I5f4dde8982386104081caba7cbac91339e930129
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  664326 ,  708209 
Reviewed-on: https://chromium-review.googlesource.com/583908
Reviewed-by: Fady Samuel <fsamuel@chromium.org>
Commit-Queue: Fady Samuel <fsamuel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489073}
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/android/router/media_router_dialog_controller_android.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/router/BUILD.gn
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/router/create_presentation_connection_request.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/router/create_presentation_connection_request.h
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/router/create_presentation_connection_request_unittest.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/router/media_router_dialog_controller_unittest.cc
[add] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/router/presentation_request.cc
[add] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/router/presentation_request.h
[add] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/router/presentation_request_unittest.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/router/presentation_service_delegate_impl.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/router/presentation_service_delegate_impl.h
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl_unittest.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/ui/webui/media_router/media_router_ui.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/ui/webui/media_router/media_router_ui.h
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/browser/ui/webui/media_router/media_router_ui_unittest.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/common/media_router/media_source_helper.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/common/media_router/media_source_helper.h
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/chrome/test/BUILD.gn
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/content/browser/presentation/presentation_service_impl.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/content/browser/presentation/presentation_service_impl.h
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/content/browser/presentation/presentation_service_impl_unittest.cc
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/content/public/browser/BUILD.gn
[delete] https://crrev.com/f54c590ab470764e7051f910eb743c9668754528/content/public/browser/presentation_request.cc
[delete] https://crrev.com/f54c590ab470764e7051f910eb743c9668754528/content/public/browser/presentation_request.h
[modify] https://crrev.com/66d441e7c4fc2e6a41be8a10f6974d026388138e/content/public/browser/presentation_service_delegate.h

Project Member

Comment 9 by bugdroid1@chromium.org, Jul 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1071a2399769677b68b43ec1289efca24fb53979

commit 1071a2399769677b68b43ec1289efca24fb53979
Author: Derek Cheng <imcheng@chromium.org>
Date: Tue Jul 25 22:23:56 2017

[Reland] [Media Router] PresentationRequest cleanup round 1.

In C++11, STL containers cannot be initialized with {} due to
http://cplusplus.github.io/LWG/lwg-defects.html#2193. This was fixed in
C++14, but for now we will spell out the constructor.

Original patch: https://chromium-review.googlesource.com/c/578528/

Original description:

[Media Router] PresentationRequest cleanup round 1.

Move PresentationRequest to content/browser and use it in
PresentationServiceDelegate where applicable.
- Replace GetMediaSources() method with helper function in c/b/m/r.
- Replace Equals() method with a helper function in PSDImpl.
- PresentationRequest is now a struct.


Other things to consider after this patch:
- Move PresentationRequest out of CPCR, maybe make
  ShowMediaRouterDialogForPresentation take a PR and 2 callbacks?
-- the callbacks can be wrapped in a struct internal to MRDC.
- Remove the PR equality checking - we don't need this if we know
the PresentationRequest has not been reset.
- Support moves for PresentationRequest. Right now it's effective in
only one place but further cleanups may find it useful.


Bug:  664326 ,  708209 
Change-Id: I2afb8f3946f5b5fb1832e5789bb9dc987d57f135
Reviewed-on: https://chromium-review.googlesource.com/583870
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: mark a. foltz <mfoltz@chromium.org>
Commit-Queue: Derek Cheng <imcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489463}
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/media/android/router/media_router_dialog_controller_android.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/media/router/BUILD.gn
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/media/router/create_presentation_connection_request.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/media/router/create_presentation_connection_request.h
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/media/router/create_presentation_connection_request_unittest.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/media/router/media_router_dialog_controller_unittest.cc
[delete] https://crrev.com/f71b90f3e2816bd84bd35bf02d918995c99ddad2/chrome/browser/media/router/presentation_request.cc
[delete] https://crrev.com/f71b90f3e2816bd84bd35bf02d918995c99ddad2/chrome/browser/media/router/presentation_request.h
[delete] https://crrev.com/f71b90f3e2816bd84bd35bf02d918995c99ddad2/chrome/browser/media/router/presentation_request_unittest.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/media/router/presentation_service_delegate_impl.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/media/router/presentation_service_delegate_impl.h
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl_unittest.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/ui/webui/media_router/media_router_ui.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/ui/webui/media_router/media_router_ui.h
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/browser/ui/webui/media_router/media_router_ui_unittest.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/common/media_router/media_source_helper.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/common/media_router/media_source_helper.h
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/chrome/test/BUILD.gn
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/content/browser/presentation/presentation_service_impl.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/content/browser/presentation/presentation_service_impl.h
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/content/browser/presentation/presentation_service_impl_unittest.cc
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/content/public/browser/BUILD.gn
[add] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/content/public/browser/presentation_request.cc
[add] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/content/public/browser/presentation_request.h
[modify] https://crrev.com/1071a2399769677b68b43ec1289efca24fb53979/content/public/browser/presentation_service_delegate.h

Project Member

Comment 10 by bugdroid1@chromium.org, Aug 29 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/84d100a1fbf2bbc65207ae73d7622f2b50610a6f

commit 84d100a1fbf2bbc65207ae73d7622f2b50610a6f
Author: Derek Cheng <imcheng@chromium.org>
Date: Tue Aug 29 18:48:16 2017

[Media Router] Part 2 of PresentationRequest cleanups.

- Move CreatePresentationConnectionRequest into a nested class in MRDC,
and rename it StartPresentationContext.
- fixed a bug where the error callback doesn't get called if MRDC
failed to create dialog.
- Changed the behavior so that we don't try to focus on existing dialog
in ShowMediaRouterDialogForPresentation(). Since start requires user
gesture, it implies the user is already looking at that tab. Thus no
need to focus.

Bug:  708209 
Change-Id: Ia64724d8a7705a1de48876cb6b568b3c51ec061f
Reviewed-on: https://chromium-review.googlesource.com/625509
Commit-Queue: Derek Cheng <imcheng@chromium.org>
Reviewed-by: mark a. foltz <mfoltz@chromium.org>
Reviewed-by: Takumi Fujimoto <takumif@chromium.org>
Cr-Commit-Position: refs/heads/master@{#498182}
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/browser/media/android/router/media_router_dialog_controller_android.cc
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/browser/media/router/BUILD.gn
[delete] https://crrev.com/3188095d10caf5a6572548cedd60baecc3c28685/chrome/browser/media/router/create_presentation_connection_request.cc
[delete] https://crrev.com/3188095d10caf5a6572548cedd60baecc3c28685/chrome/browser/media/router/create_presentation_connection_request.h
[delete] https://crrev.com/3188095d10caf5a6572548cedd60baecc3c28685/chrome/browser/media/router/create_presentation_connection_request_unittest.cc
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/browser/media/router/media_router_dialog_controller.cc
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/browser/media/router/media_router_dialog_controller.h
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/browser/media/router/media_router_dialog_controller_unittest.cc
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/browser/media/router/presentation_service_delegate_impl.cc
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.cc
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl_unittest.cc
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/browser/ui/webui/media_router/media_router_ui.cc
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/browser/ui/webui/media_router/media_router_ui.h
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/browser/ui/webui/media_router/media_router_ui_unittest.cc
[modify] https://crrev.com/84d100a1fbf2bbc65207ae73d7622f2b50610a6f/chrome/test/BUILD.gn

Status: Fixed (was: Started)

Sign in to add a comment