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

Issue 658678 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Android MediaRouter only (left Chro...
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug

Blocking:
issue 656563



Sign in to add a comment

Decouple MediaSession messages with WebContents

Project Member Reported by zqzh...@chromium.org, Oct 24 2016

Issue description

Currently MediaSession messages is dispatched through WebContents/WebContentsObsever. We need to make tons of plumbing (especially through JNI) when making any change to these messages.

We need to decouple MediaSession messages from WebContents.

The proposed layout changes is:
https://docs.google.com/a/chromium.org/document/d/1PfiCtOidmNrwsXcnpN7tCa_IkeHb5SJ73d5nwzxZYV8/edit?usp=sharing
 
We need the break the task into the following steps:

1. Have the new MediaSessionObserver side-by-side with the old WebContentsObserver. Make MediaSessionObserver and MediaSession in content/public/browser, and MediaSessionImpl in content/browser.

2. Let chromecast/ CastMediaBlocker use the new pipeline.

3. Change on the Java side and remove the old pipeline (maybe possible to split into two CLs).
Description: Show this description
Have you reflected the ownership issue in the doc? I think that was the main issue with your original refactoring CL.
Ah, yes. Done!

The new layout should have cleaner ownership, since Java observers are now owned by Java ChromeMediaSession, and don't have native counterparts anymore.

Comment 5 by boliu@chromium.org, Oct 24 2016

Cc: boliu@chromium.org
the doc doesn't have a content api boundary

fwiw, content java code doesn't really have a public API similar to how native content/public works, but there really should be one. don't abuse that fact too much..
> the doc doesn't have a content api boundary
> 
> fwiw, content java code doesn't really have a public API similar to how native content/public works, but there really should be one. don't abuse that fact too much..

Thanks. Just updated the doc. I've already seen this issue with chromecast/ (https://codereview.chromium.org/2450433002/),
so I'm splitting MediaSession interface & MediaSessionObserver into content/public.

Comment 7 by boliu@chromium.org, Oct 24 2016

I didn't see how the doc changed. And still don't see where the content api boundary lies in the diagram. Or is everything in the diagram supposed to live in content?
Just updated that. I made the document public with the chromium account. The old one is no longer updated. Sorry for the trouble.

https://docs.google.com/a/chromium.org/document/d/1PfiCtOidmNrwsXcnpN7tCa_IkeHb5SJ73d5nwzxZYV8/edit?usp=sharing

Comment 9 by boliu@chromium.org, Oct 24 2016

next step to improve doc: show in the diagram which classes are in content/ and which are in chrome/
Done. Does it looks good to you in general?
Blocking: 656563
Cc: zqzh...@chromium.org
 Issue 654891  has been merged into this issue.
Project Member

Comment 13 by bugdroid1@chromium.org, Oct 31 2016

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

commit bfe32da7ffd850ddfdd58f6c775f0dc1a92eed78
Author: zqzhang <zqzhang@chromium.org>
Date: Mon Oct 31 11:04:12 2016

Remove DEPS restriction content_public/ to content/ (Java)

The DEPS rules for Java content_public/ is wrong. It should be able to
import classes from content/. This CL removes the restriction.

BUG= 658678 ,335690

Review-Url: https://codereview.chromium.org/2461853002
Cr-Commit-Position: refs/heads/master@{#428684}

[delete] https://crrev.com/a1a345d3d77742531fb89e5a9c5aaf85d2a9c5d5/content/public/android/java/src/org/chromium/content_public/DEPS

Project Member

Comment 14 by bugdroid1@chromium.org, Nov 1 2016

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

commit 1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4
Author: zqzhang <zqzhang@chromium.org>
Date: Tue Nov 01 11:26:45 2016

Decouple MediaSession messages from WebContents

This CL separates MediaSession messages from WebContents. It includes
the following changes:

* Abstract MediaSession interface and put it into
  content/public/browser.
  * Move WebContents.[Resume|Suspend|Stop]MediaSession to the
    MediaSession interface.
* Add MediaSessionObserver to content/public/browser.
  * Move WebContentsObserver.MediaSession* to the MediaSessionObserver
    interface.
* Add MediaSession content/public API in Java.
  * Move MediaSession* in the Java WebContent API to MediaSession.
* Let clients use the new MediaSession content API.

The overall structral change is described in:
https://docs.google.com/a/chromium.org/document/d/1PfiCtOidmNrwsXcnpN7tCa_IkeHb5SJ73d5nwzxZYV8/edit?usp=sharing

BUG= 658678 

Review-Url: https://codereview.chromium.org/2453623003
Cr-Commit-Position: refs/heads/master@{#428976}

[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTitleUpdatedTest.java
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/chromecast/browser/cast_media_blocker.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/chromecast/browser/cast_media_blocker.h
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/chromecast/browser/test/cast_media_blocker_test.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/chromecast/browser/test/chromecast_browser_test_helper_default.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/BUILD.gn
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/android/browser_jni_registrar.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/android/web_contents_observer_proxy.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/android/web_contents_observer_proxy.h
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/audio_focus_delegate.h
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/audio_focus_delegate_android.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/audio_focus_delegate_android.h
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/audio_focus_delegate_android_browsertest.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/audio_focus_delegate_default.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/audio_focus_delegate_default_browsertest.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/audio_focus_manager.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/audio_focus_manager.h
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/audio_focus_manager_unittest.cc
[add] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/media_session_android.cc
[add] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/media_session_android.h
[delete] https://crrev.com/0ea81d7d3ea571b173fb462f2b0eeed4144000a0/content/browser/media/session/media_session_browsertest.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/media_session_controller.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/media_session_controller.h
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/media_session_controller_unittest.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/media_session_controllers_manager.cc
[rename] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/media_session_impl.cc
[rename] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/media_session_impl.h
[add] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/media_session_impl_browsertest.cc
[rename] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/media_session_impl_visibility_browsertest.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/media_session_service_impl.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/media/session/pepper_playback_observer.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/web_contents/web_contents_android.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/web_contents/web_contents_android.h
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/web_contents/web_contents_impl.cc
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/browser/web_contents/web_contents_impl.h
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/android/BUILD.gn
[add] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/android/java/src/org/chromium/content/browser/MediaSessionImpl.java
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsObserverProxy.java
[add] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/android/java/src/org/chromium/content_public/browser/MediaSession.java
[add] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/android/java/src/org/chromium/content_public/browser/MediaSessionObserver.java
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/android/java/src/org/chromium/content_public/browser/WebContents.java
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/android/java/src/org/chromium/content_public/browser/WebContentsObserver.java
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/browser/BUILD.gn
[add] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/browser/media_session.h
[add] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/browser/media_session_observer.cc
[add] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/browser/media_session_observer.h
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/browser/web_contents.h
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/public/browser/web_contents_observer.h
[modify] https://crrev.com/1adf3cb5c81b84968f4e541edc97f6cd6f2a96b4/content/test/BUILD.gn

Project Member

Comment 15 by bugdroid1@chromium.org, Nov 1 2016

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

commit 59cad301881152cdc22382923cb2ccbc8b56bbbc
Author: zqzhang <zqzhang@chromium.org>
Date: Tue Nov 01 17:37:07 2016

Fox for MediaSessionObserver.stopObserving

MediaSessionObserver should remove the reference to MediaSessionImpl
when it stops observing. This CL fixes this issue.

BUG= 658678 

Review-Url: https://codereview.chromium.org/2471453002
Cr-Commit-Position: refs/heads/master@{#429037}

[modify] https://crrev.com/59cad301881152cdc22382923cb2ccbc8b56bbbc/content/public/android/java/src/org/chromium/content_public/browser/MediaSessionObserver.java

Status: Fixed (was: Assigned)

Sign in to add a comment