Commit 4f1fd6a0 authored by danakj's avatar danakj Committed by Commit bot

Avoid overriding methods from both blink and non-blink at once.

The WebMediaPlayerCast class is-a RendererMediaPlayerInterface, which
has methods that look like blink::WebMediaPlayer methods, but it is
a chromium-style class. The WebMediaPlayerAndroid is-a
blink::WebMediaPlayer and also a RendererMediaPlayerInterface so
its overrides end up overriding both at once. This is problematic
because, while also being difficult to follow where control flow
goes, when the blink names are renamed in the Great Blink Rename to
be chromium style, incorrectly-blink-styled names outside of blink
will not be renamed and the inheritance here will break.

The two methods here are hasVideo() and paused(). It turns out that
neither method is ever used as part of the
RendererMediaPlayerInterface. And only paused() is used as part of
the concrete WebMediaPlayerCast class. So I have removed them both
from the RendererMediaPlayerInterface and added IsPaused() as a
non-virtual method on WebMediaPlayerCast instead.

R=hubbe@chromium.org
BUG=578344

Review-Url: https://codereview.chromium.org/2619593002
Cr-Commit-Position: refs/heads/master@{#442052}
parent d6f9158f
...@@ -61,12 +61,6 @@ class RendererMediaPlayerInterface { ...@@ -61,12 +61,6 @@ class RendererMediaPlayerInterface {
virtual void OnRemoteRouteAvailabilityChanged( virtual void OnRemoteRouteAvailabilityChanged(
blink::WebRemotePlaybackAvailability availability) = 0; blink::WebRemotePlaybackAvailability availability) = 0;
// Getters of playback state.
virtual bool paused() const = 0;
// True if the loaded media has a playable video track.
virtual bool hasVideo() const = 0;
// This function is called by the RendererMediaPlayerManager to pause the // This function is called by the RendererMediaPlayerManager to pause the
// video and release the media player and surface texture when we switch tabs. // video and release the media player and surface texture when we switch tabs.
// However, the actual GlTexture is not released to keep the video screenshot. // However, the actual GlTexture is not released to keep the video screenshot.
......
...@@ -339,14 +339,6 @@ void WebMediaPlayerCast::OnRemoteRouteAvailabilityChanged( ...@@ -339,14 +339,6 @@ void WebMediaPlayerCast::OnRemoteRouteAvailabilityChanged(
void WebMediaPlayerCast::SuspendAndReleaseResources() {} void WebMediaPlayerCast::SuspendAndReleaseResources() {}
bool WebMediaPlayerCast::hasVideo() const {
return true;
}
bool WebMediaPlayerCast::paused() const {
return paused_;
}
void WebMediaPlayerCast::SetDeviceScaleFactor(float scale_factor) { void WebMediaPlayerCast::SetDeviceScaleFactor(float scale_factor) {
device_scale_factor_ = scale_factor; device_scale_factor_ = scale_factor;
} }
......
...@@ -45,6 +45,7 @@ class WebMediaPlayerCast : public RendererMediaPlayerInterface { ...@@ -45,6 +45,7 @@ class WebMediaPlayerCast : public RendererMediaPlayerInterface {
void SetMediaPlayerManager( void SetMediaPlayerManager(
RendererMediaPlayerManagerInterface* media_player_manager); RendererMediaPlayerManagerInterface* media_player_manager);
bool isRemote() const { return is_remote_; } bool isRemote() const { return is_remote_; }
bool IsPaused() const { return paused_; }
double currentTime() const; double currentTime() const;
void play(); void play();
...@@ -82,20 +83,11 @@ class WebMediaPlayerCast : public RendererMediaPlayerInterface { ...@@ -82,20 +83,11 @@ class WebMediaPlayerCast : public RendererMediaPlayerInterface {
void OnRemoteRouteAvailabilityChanged( void OnRemoteRouteAvailabilityChanged(
blink::WebRemotePlaybackAvailability availability) override; blink::WebRemotePlaybackAvailability availability) override;
// Getters of playback state.
// bool paused() const override;
// True if the loaded media has a playable video track.
// bool hasVideo() const override;
// This function is called by the RendererMediaPlayerManager to pause the // This function is called by the RendererMediaPlayerManager to pause the
// video and release the media player and surface texture when we switch tabs. // video and release the media player and surface texture when we switch tabs.
// However, the actual GlTexture is not released to keep the video screenshot. // However, the actual GlTexture is not released to keep the video screenshot.
void SuspendAndReleaseResources() override; void SuspendAndReleaseResources() override;
bool paused() const override;
bool hasVideo() const override;
void SetDeviceScaleFactor(float scale_factor); void SetDeviceScaleFactor(float scale_factor);
scoped_refptr<VideoFrame> GetCastingBanner(); scoped_refptr<VideoFrame> GetCastingBanner();
void setPoster(const blink::WebURL& poster); void setPoster(const blink::WebURL& poster);
......
...@@ -689,7 +689,7 @@ bool WebMediaPlayerImpl::paused() const { ...@@ -689,7 +689,7 @@ bool WebMediaPlayerImpl::paused() const {
#if defined(OS_ANDROID) // WMPI_CAST #if defined(OS_ANDROID) // WMPI_CAST
if (isRemote()) if (isRemote())
return cast_impl_.paused(); return cast_impl_.IsPaused();
#endif #endif
return pipeline_.GetPlaybackRate() == 0.0f; return pipeline_.GetPlaybackRate() == 0.0f;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment