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

Issue 2439483003: Link MediaSessionTabHelper with native MediaSession [CL is going to be split] (Closed)

Created:
4 years, 2 months ago by Zhiqiang Zhang (Slow)
Modified:
4 years, 1 month ago
CC:
agrieve+watch_chromium.org, chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, derekjchow1, feature-media-reviews_chromium.org, jam, nasko+codewatch_chromium.org, Ted C
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Link MediaSessionTabHelper with native MediaSession This CL links MediaSessionTabHelper with the native MediaSession to avoid plumbing MediaSession messages through WebContents and WebContentsObserver. This will greatly reduce the effort of making changes on the interface that MediaSession and MediaSessionTabHelper communicate. Explaining doc: https://docs.google.com/a/google.com/document/d/1duLlKQ6Y8ogC9VUbDvdTz8-Rn45Mrove0uD5j089Le8/edit?usp=sharing BUG=654891

Patch Set 1 : Super rough, please give some initial feedbacks #

Total comments: 34

Patch Set 2 : working! #

Patch Set 3 : addressed nits #

Total comments: 24

Patch Set 4 : addressed comments #

Total comments: 9

Patch Set 5 : spliting session (still rough, only need general review) #

Patch Set 6 : now it's working #

Patch Set 7 : Don't review, this CL is getting huge and needs to be split #

Unified diffs Side-by-side diffs Delta from patch set Stats (+556 lines, -260 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java View 1 2 3 4 5 6 7 chunks +33 lines, -23 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTitleUpdatedTest.java View 1 2 3 4 5 6 4 chunks +5 lines, -12 lines 0 comments Download
M content/browser/BUILD.gn View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download
M content/browser/android/browser_jni_registrar.cc View 1 2 3 4 5 6 2 chunks +2 lines, -0 lines 0 comments Download
M content/browser/android/web_contents_observer_proxy.h View 1 2 3 1 chunk +0 lines, -4 lines 0 comments Download
M content/browser/android/web_contents_observer_proxy.cc View 1 2 3 2 chunks +0 lines, -26 lines 0 comments Download
M content/browser/media/session/media_session.h View 1 2 3 4 5 4 chunks +30 lines, -0 lines 0 comments Download
M content/browser/media/session/media_session.cc View 1 2 3 4 5 5 chunks +29 lines, -4 lines 0 comments Download
A content/browser/media/session/media_session_android.h View 1 2 3 4 5 6 1 chunk +53 lines, -0 lines 0 comments Download
A content/browser/media/session/media_session_android.cc View 1 2 3 4 5 6 1 chunk +100 lines, -0 lines 0 comments Download
M content/browser/media/session/media_session_browsertest.cc View 1 24 chunks +48 lines, -49 lines 0 comments Download
A content/browser/media/session/media_session_observer.h View 1 2 3 4 5 1 chunk +49 lines, -0 lines 0 comments Download
A content/browser/media/session/media_session_observer.cc View 1 2 3 4 5 1 chunk +21 lines, -0 lines 0 comments Download
M content/browser/web_contents/web_contents_android.h View 1 2 3 4 1 chunk +0 lines, -7 lines 0 comments Download
M content/browser/web_contents/web_contents_android.cc View 1 2 3 4 2 chunks +1 line, -15 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.h View 1 2 3 4 5 2 chunks +0 lines, -10 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 5 2 chunks +0 lines, -28 lines 0 comments Download
M content/public/android/BUILD.gn View 1 2 3 4 5 6 3 chunks +3 lines, -0 lines 0 comments Download
A content/public/android/java/src/org/chromium/content/browser/ChromeMediaSession.java View 1 2 3 4 5 6 1 chunk +128 lines, -0 lines 0 comments Download
A content/public/android/java/src/org/chromium/content/browser/MediaSessionObserver.java View 1 2 3 4 5 6 1 chunk +50 lines, -0 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java View 1 2 3 4 2 chunks +0 lines, -18 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsObserverProxy.java View 1 2 3 2 chunks +0 lines, -17 lines 0 comments Download
M content/public/android/java/src/org/chromium/content_public/browser/WebContents.java View 1 2 3 4 1 chunk +0 lines, -15 lines 0 comments Download
M content/public/android/java/src/org/chromium/content_public/browser/WebContentsObserver.java View 1 2 3 2 chunks +0 lines, -15 lines 0 comments Download
M content/public/browser/web_contents.h View 1 2 3 4 5 1 chunk +0 lines, -7 lines 0 comments Download
M content/public/browser/web_contents_observer.h View 2 chunks +0 lines, -10 lines 0 comments Download

Messages

Total messages: 36 (7 generated)
Zhiqiang Zhang (Slow)
PTAL This is the initial CL, which is partially working. The CL is still rough, ...
4 years, 2 months ago (2016-10-19 19:07:17 UTC) #2
boliu
https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session.h File content/browser/media/session/media_session.h (right): https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session.h#newcode250 content/browser/media/session/media_session.h:250: std::map<MediaSessionObserver*, std::unique_ptr<MediaSessionObserver>>; would scoped_vector be better? is there going ...
4 years, 2 months ago (2016-10-19 20:39:40 UTC) #3
whywhat
I haven't wrapped my head around the ownership scheme here completely yet, might come up ...
4 years, 2 months ago (2016-10-20 15:38:33 UTC) #4
Zhiqiang Zhang (Slow)
PTAL Addressed & replied comments from Anton and boliu@. Cleaned up the ownership and inter-reference ...
4 years, 2 months ago (2016-10-20 16:22:32 UTC) #6
boliu
https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session.h File content/browser/media/session/media_session.h (right): https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session.h#newcode250 content/browser/media/session/media_session.h:250: std::map<MediaSessionObserver*, std::unique_ptr<MediaSessionObserver>>; On 2016/10/20 16:22:32, Zhiqiang Zhang wrote: > ...
4 years, 2 months ago (2016-10-20 16:28:33 UTC) #7
Zhiqiang Zhang (Slow)
https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session.h File content/browser/media/session/media_session.h (right): https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session.h#newcode250 content/browser/media/session/media_session.h:250: std::map<MediaSessionObserver*, std::unique_ptr<MediaSessionObserver>>; On 2016/10/20 16:28:33, boliu wrote: > On ...
4 years, 2 months ago (2016-10-20 17:07:03 UTC) #8
boliu
https://codereview.chromium.org/2439483003/diff/1/content/public/android/java/src/org/chromium/content_public/browser/WebContents.java File content/public/android/java/src/org/chromium/content_public/browser/WebContents.java (right): https://codereview.chromium.org/2439483003/diff/1/content/public/android/java/src/org/chromium/content_public/browser/WebContents.java#newcode309 content/public/android/java/src/org/chromium/content_public/browser/WebContents.java:309: void addMediaSessionDelegate(MediaSessionDelegate delegate); On 2016/10/20 17:07:03, Zhiqiang Zhang wrote: ...
4 years, 2 months ago (2016-10-20 17:10:19 UTC) #9
Zhiqiang Zhang (Slow)
On 2016/10/20 17:10:19, boliu wrote: > Feels like that fact should live in the embedder ...
4 years, 2 months ago (2016-10-20 17:55:06 UTC) #10
whywhat
https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session_observer.cc File content/browser/media/session/media_session_observer.cc (right): https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session_observer.cc#newcode13 content/browser/media/session/media_session_observer.cc:13: Observe(session); On 2016/10/20 at 16:22:32, Zhiqiang Zhang wrote: > ...
4 years, 2 months ago (2016-10-20 18:18:50 UTC) #11
whywhat
https://codereview.chromium.org/2439483003/diff/1/content/browser/web_contents/web_contents_android.cc File content/browser/web_contents/web_contents_android.cc (right): https://codereview.chromium.org/2439483003/diff/1/content/browser/web_contents/web_contents_android.cc#newcode622 content/browser/web_contents/web_contents_android.cc:622: MediaSessionDelegateAndroid::CreateAndRegister( On 2016/10/20 at 16:22:32, Zhiqiang Zhang wrote: > ...
4 years, 2 months ago (2016-10-20 18:21:16 UTC) #12
Zhiqiang Zhang (Slow)
On 2016/10/20 18:21:16, whywhat wrote: > https://codereview.chromium.org/2439483003/diff/1/content/browser/web_contents/web_contents_android.cc > File content/browser/web_contents/web_contents_android.cc (right): > > https://codereview.chromium.org/2439483003/diff/1/content/browser/web_contents/web_contents_android.cc#newcode622 > ...
4 years, 2 months ago (2016-10-20 18:28:57 UTC) #13
Zhiqiang Zhang (Slow)
On 2016/10/20 18:28:57, Zhiqiang Zhang wrote: > On 2016/10/20 18:21:16, whywhat wrote: > > > ...
4 years, 2 months ago (2016-10-20 19:50:41 UTC) #14
whywhat
On 2016/10/20 at 19:50:41, zqzhang wrote: > On 2016/10/20 18:28:57, Zhiqiang Zhang wrote: > > ...
4 years, 2 months ago (2016-10-20 21:00:05 UTC) #15
whywhat
4 years, 2 months ago (2016-10-20 21:00:16 UTC) #16
whywhat
https://codereview.chromium.org/2439483003/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java File chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java (right): https://codereview.chromium.org/2439483003/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java#newcode61 chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java:61: private static HashMap<Tab, MediaSessionTabHelper> sTabToHelperMap = having an extra ...
4 years, 2 months ago (2016-10-20 22:56:54 UTC) #17
whywhat
I wonder if we could've: MediaSessionObserver + MediaSessionObserverProxy/MediaSessionObserverAndroid like WebContentsObserver - MSTH becomes MediaSessionObserver instead ...
4 years, 2 months ago (2016-10-20 23:05:51 UTC) #18
Zhiqiang Zhang (Slow)
PTAL Addressed Anton's comment. I see Anton's point is "MediaSessionDelegate" is not great. It's a ...
4 years, 2 months ago (2016-10-21 13:43:53 UTC) #19
boliu
https://codereview.chromium.org/2439483003/diff/60001/content/browser/media/session/media_session_delegate_android.cc File content/browser/media/session/media_session_delegate_android.cc (right): https://codereview.chromium.org/2439483003/diff/60001/content/browser/media/session/media_session_delegate_android.cc#newcode50 content/browser/media/session/media_session_delegate_android.cc:50: if (!j_delegate_.is_empty()) { this in theory is not safe ...
4 years, 2 months ago (2016-10-21 14:37:15 UTC) #20
Zhiqiang Zhang (Slow)
https://codereview.chromium.org/2439483003/diff/60001/content/browser/media/session/media_session_delegate_android.cc File content/browser/media/session/media_session_delegate_android.cc (right): https://codereview.chromium.org/2439483003/diff/60001/content/browser/media/session/media_session_delegate_android.cc#newcode50 content/browser/media/session/media_session_delegate_android.cc:50: if (!j_delegate_.is_empty()) { On 2016/10/21 14:37:15, boliu wrote: > ...
4 years, 2 months ago (2016-10-21 15:05:23 UTC) #21
whywhat
On 2016/10/21 at 13:43:53, zqzhang wrote: > PTAL > > Addressed Anton's comment. > > ...
4 years, 2 months ago (2016-10-21 15:46:05 UTC) #22
whywhat
https://codereview.chromium.org/2439483003/diff/60001/content/public/android/java/src/org/chromium/content_public/browser/MediaSessionDelegate.java File content/public/android/java/src/org/chromium/content_public/browser/MediaSessionDelegate.java (right): https://codereview.chromium.org/2439483003/diff/60001/content/public/android/java/src/org/chromium/content_public/browser/MediaSessionDelegate.java#newcode62 content/public/android/java/src/org/chromium/content_public/browser/MediaSessionDelegate.java:62: if (hasNativeMediaSession()) nativeResumeMediaSession(mNativeMediaSessionDelegateAndroid); On 2016/10/21 at 13:43:53, Zhiqiang Zhang ...
4 years, 2 months ago (2016-10-21 15:51:36 UTC) #23
whywhat
https://codereview.chromium.org/2439483003/diff/80001/content/browser/media/session/media_session.cc File content/browser/media/session/media_session.cc (right): https://codereview.chromium.org/2439483003/diff/80001/content/browser/media/session/media_session.cc#newcode61 content/browser/media/session/media_session.cc:61: owned_observers_.clear(); I think MediaSession should notify MediaSessionObservers it's about ...
4 years, 2 months ago (2016-10-21 18:28:15 UTC) #24
whywhat
https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session_delegate_android.h File content/browser/media/session/media_session_delegate_android.h (right): https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session_delegate_android.h#newcode42 content/browser/media/session/media_session_delegate_android.h:42: base::android::ScopedJavaGlobalRef<jobject> j_delegate_; On 2016/10/19 at 20:39:40, boliu wrote: > ...
4 years, 2 months ago (2016-10-21 18:31:02 UTC) #25
boliu
https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session_delegate_android.h File content/browser/media/session/media_session_delegate_android.h (right): https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session_delegate_android.h#newcode42 content/browser/media/session/media_session_delegate_android.h:42: base::android::ScopedJavaGlobalRef<jobject> j_delegate_; On 2016/10/21 18:31:02, whywhat wrote: > On ...
4 years, 2 months ago (2016-10-21 19:56:02 UTC) #26
derekjchow1
The Cast team uses the C++ content/public APIs to stop media playback. https://cs.chromium.org/chromium/src/chromecast/browser/cast_media_blocker.h Removing the ...
4 years, 2 months ago (2016-10-21 20:47:30 UTC) #28
whywhat
On 2016/10/21 at 19:56:02, boliu wrote: > https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session_delegate_android.h > File content/browser/media/session/media_session_delegate_android.h (right): > > https://codereview.chromium.org/2439483003/diff/1/content/browser/media/session/media_session_delegate_android.h#newcode42 ...
4 years, 2 months ago (2016-10-21 21:05:24 UTC) #29
whywhat
On 2016/10/21 at 20:47:30, derekjchow wrote: > The Cast team uses the C++ content/public APIs ...
4 years, 2 months ago (2016-10-21 21:08:19 UTC) #30
Zhiqiang Zhang (Slow)
PTAL I finally managed to split MediaSessionDelgate into MediaSessionObserver and ChromeMediaSession. Should be solving many ...
4 years, 2 months ago (2016-10-21 21:45:13 UTC) #32
Zhiqiang Zhang (Slow)
4 years, 2 months ago (2016-10-24 10:43:34 UTC) #35
Thanks for all reviewers.
I finally come with a better plan (updated the doc in the CL description).

However, this CL is getting huge and we better split it into several small CLs.
So please don't review this one at the moment.

The bug tracking this issue is https://crbug.com/658678. Go there for detailed
plans.

Powered by Google App Engine
This is Rietveld 408576698