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

Unified Diff: content/common/gpu/stream_texture_android.h

Issue 1417853006: gpu: introduce glSetStreamTextureSizeCHROMIUM(GLuint texture, GLint stream_id, GLsizei width, GLsiz… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android_webview.test failure Created 5 years, 1 month 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/common/gpu/stream_texture_android.h
diff --git a/content/common/gpu/stream_texture_android.h b/content/common/gpu/stream_texture_android.h
index a761206b2ac297fd24b43d1a70822422b8c3148a..7021ba90cbdaf77d53b17734ddfd50ca7d825ba6 100644
--- a/content/common/gpu/stream_texture_android.h
+++ b/content/common/gpu/stream_texture_android.h
@@ -7,85 +7,35 @@
#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "content/common/gpu/gpu_command_buffer_stub.h"
-#include "ipc/ipc_listener.h"
-#include "ui/gl/android/surface_texture.h"
-#include "ui/gl/gl_image.h"
-
-namespace gfx {
-class Size;
-}
namespace content {
-class StreamTexture : public gl::GLImage,
- public IPC::Listener,
- public GpuCommandBufferStub::DestructionObserver {
+class StreamTexture;
+
+class StreamTextureManager : public base::NonThreadSafe {
public:
- static bool Create(GpuCommandBufferStub* owner_stub,
- uint32 client_texture_id,
- int stream_id);
+ StreamTextureManager();
+ ~StreamTextureManager();
+
+ bool CreateStreamTexture(GpuCommandBufferStub* owner_stub,
+ uint32 client_texture_id,
+ int32 stream_id);
+ void SetStreamTextureSize(GpuCommandBufferStub* owner_stub,
+ uint32 client_texture_id,
+ int32 stream_id,
+ size_t width,
+ size_t height);
private:
- StreamTexture(GpuCommandBufferStub* owner_stub,
- int32 route_id,
- uint32 texture_id);
- ~StreamTexture() override;
-
- // gl::GLImage implementation:
- void Destroy(bool have_context) override;
- gfx::Size GetSize() override;
- unsigned GetInternalFormat() override;
- bool BindTexImage(unsigned target) override;
- void ReleaseTexImage(unsigned target) override;
- bool CopyTexImage(unsigned target) override;
- bool CopyTexSubImage(unsigned target,
- const gfx::Point& offset,
- const gfx::Rect& rect) override;
- bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
- int z_order,
- gfx::OverlayTransform transform,
- const gfx::Rect& bounds_rect,
- const gfx::RectF& crop_rect) override;
- void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
- uint64_t process_tracing_id,
- const std::string& dump_name) override;
-
- // GpuCommandBufferStub::DestructionObserver implementation.
- void OnWillDestroyStub() override;
-
- // Called when a new frame is available for the SurfaceTexture.
- void OnFrameAvailable();
-
- // IPC::Listener implementation:
- bool OnMessageReceived(const IPC::Message& message) override;
-
- // IPC message handlers:
- void OnStartListening();
- void OnEstablishPeer(int32 primary_id, int32 secondary_id);
- void OnSetSize(const gfx::Size& size) { size_ = size; }
dshwang 2015/11/07 15:53:03 Current SetSize hack doesn't update the size of te
-
- scoped_refptr<gfx::SurfaceTexture> surface_texture_;
-
- // Current transform matrix of the surface texture.
- float current_matrix_[16];
-
- // Current size of the surface texture.
- gfx::Size size_;
-
- // Whether we ever bound a valid frame.
- bool has_valid_frame_;
-
- // Whether a new frame is available that we should update to.
- bool has_pending_frame_;
+ void OnReleaseStreamTexture(int32 stream_id);
- GpuCommandBufferStub* owner_stub_;
- int32 route_id_;
- bool has_listener_;
- uint32 texture_id_;
+ typedef std::map<int32, StreamTexture*> StreamTextureMap;
+ StreamTextureMap stream_textures_;
- base::WeakPtrFactory<StreamTexture> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(StreamTexture);
+ base::WeakPtrFactory<StreamTextureManager> weak_factory_;
+ DISALLOW_COPY_AND_ASSIGN(StreamTextureManager);
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698