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

Unified Diff: content/renderer/media/android/stream_texture_factory_android_impl.cc

Issue 22766004: Fullscreen video in Android WebView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address nits Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/android/stream_texture_factory_android_impl.cc
diff --git a/content/renderer/media/android/stream_texture_factory_android.cc b/content/renderer/media/android/stream_texture_factory_android_impl.cc
similarity index 56%
rename from content/renderer/media/android/stream_texture_factory_android.cc
rename to content/renderer/media/android/stream_texture_factory_android_impl.cc
index a2e2c5f6bad90c9fabaf0cff9ccbada9e3bcc377..721b680fb14699a5d04d8f3698fac5cb63299ec9 100644
--- a/content/renderer/media/android/stream_texture_factory_android.cc
+++ b/content/renderer/media/android/stream_texture_factory_android_impl.cc
@@ -2,23 +2,52 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/renderer/media/android/stream_texture_factory_android.h"
+#include "content/renderer/media/android/stream_texture_factory_android_impl.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/gpu_messages.h"
+#include "content/renderer/gpu/stream_texture_host_android.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "ui/gfx/size.h"
namespace content {
-StreamTextureProxy::StreamTextureProxy(StreamTextureHost* host)
+namespace {
+
+class StreamTextureProxyImpl : public StreamTextureProxy,
+ public StreamTextureHost::Listener {
+ public:
+ explicit StreamTextureProxyImpl(StreamTextureHost* host);
+ virtual ~StreamTextureProxyImpl();
+
+ // StreamTextureProxy implementation:
+ virtual void BindToCurrentThread(int32 stream_id) OVERRIDE;
+ virtual bool IsBoundToThread() OVERRIDE { return loop_.get() != NULL; }
+ virtual void SetClient(cc::VideoFrameProvider::Client* client) OVERRIDE;
+ virtual void Release() OVERRIDE;
+
+ // StreamTextureHost::Listener implementation:
+ virtual void OnFrameAvailable() OVERRIDE;
+ virtual void OnMatrixChanged(const float matrix[16]) OVERRIDE;
+
+ private:
+ scoped_ptr<StreamTextureHost> host_;
+ scoped_refptr<base::MessageLoopProxy> loop_;
+
+ base::Lock client_lock_;
+ cc::VideoFrameProvider::Client* client_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureProxyImpl);
+};
+
+StreamTextureProxyImpl::StreamTextureProxyImpl(StreamTextureHost* host)
: host_(host), client_(NULL) {
host->SetListener(this);
}
-StreamTextureProxy::~StreamTextureProxy() {}
+StreamTextureProxyImpl::~StreamTextureProxyImpl() {}
-void StreamTextureProxy::Release() {
+void StreamTextureProxyImpl::Release() {
SetClient(NULL);
if (loop_.get() && loop_.get() != base::MessageLoopProxy::current())
loop_->DeleteSoon(FROM_HERE, this);
@@ -26,29 +55,31 @@ void StreamTextureProxy::Release() {
delete this;
}
-void StreamTextureProxy::SetClient(cc::VideoFrameProvider::Client* client) {
+void StreamTextureProxyImpl::SetClient(cc::VideoFrameProvider::Client* client) {
base::AutoLock lock(client_lock_);
client_ = client;
}
-void StreamTextureProxy::BindToCurrentThread(int stream_id) {
+void StreamTextureProxyImpl::BindToCurrentThread(int stream_id) {
loop_ = base::MessageLoopProxy::current();
host_->Initialize(stream_id);
}
-void StreamTextureProxy::OnFrameAvailable() {
+void StreamTextureProxyImpl::OnFrameAvailable() {
base::AutoLock lock(client_lock_);
if (client_)
client_->DidReceiveFrame();
}
-void StreamTextureProxy::OnMatrixChanged(const float matrix[16]) {
+void StreamTextureProxyImpl::OnMatrixChanged(const float matrix[16]) {
base::AutoLock lock(client_lock_);
if (client_)
client_->DidUpdateMatrix(matrix);
}
-StreamTextureFactory::StreamTextureFactory(
+} // namespace
+
+StreamTextureFactoryImpl::StreamTextureFactoryImpl(
WebKit::WebGraphicsContext3D* context,
GpuChannelHost* channel,
int view_id)
@@ -57,21 +88,21 @@ StreamTextureFactory::StreamTextureFactory(
DCHECK(channel);
}
-StreamTextureFactory::~StreamTextureFactory() {}
+StreamTextureFactoryImpl::~StreamTextureFactoryImpl() {}
-StreamTextureProxy* StreamTextureFactory::CreateProxy() {
+StreamTextureProxy* StreamTextureFactoryImpl::CreateProxy() {
DCHECK(channel_.get());
StreamTextureHost* host = new StreamTextureHost(channel_.get());
- return new StreamTextureProxy(host);
+ return new StreamTextureProxyImpl(host);
}
-void StreamTextureFactory::EstablishPeer(int32 stream_id, int player_id) {
+void StreamTextureFactoryImpl::EstablishPeer(int32 stream_id, int player_id) {
DCHECK(channel_.get());
channel_->Send(
new GpuChannelMsg_EstablishStreamTexture(stream_id, view_id_, player_id));
}
-unsigned StreamTextureFactory::CreateStreamTexture(
+unsigned StreamTextureFactoryImpl::CreateStreamTexture(
unsigned texture_target,
unsigned* texture_id,
gpu::Mailbox* texture_mailbox,
@@ -91,7 +122,7 @@ unsigned StreamTextureFactory::CreateStreamTexture(
return stream_id;
}
-void StreamTextureFactory::DestroyStreamTexture(unsigned texture_id) {
+void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) {
if (context_->makeContextCurrent()) {
// TODO(sievers): Make the destroyStreamTexture implicit when the last
// texture referencing it is lost.
@@ -101,7 +132,7 @@ void StreamTextureFactory::DestroyStreamTexture(unsigned texture_id) {
}
}
-void StreamTextureFactory::SetStreamTextureSize(
+void StreamTextureFactoryImpl::SetStreamTextureSize(
int32 stream_id, const gfx::Size& size) {
channel_->Send(new GpuChannelMsg_SetStreamTextureSize(stream_id, size));
}

Powered by Google App Engine
This is Rietveld 408576698