Chromium Code Reviews| Index: content/common/gpu/stream_texture_manager_android.h |
| diff --git a/content/common/gpu/stream_texture_manager_android.h b/content/common/gpu/stream_texture_manager_android.h |
| index 3be10ac7fd6821fee6310011d9c2bc2d7055f266..a2651e1c17ac685eb351ac2ef4c885ee637dd18e 100644 |
| --- a/content/common/gpu/stream_texture_manager_android.h |
| +++ b/content/common/gpu/stream_texture_manager_android.h |
| @@ -4,14 +4,22 @@ |
| #ifndef CONTENT_COMMON_GPU_STREAM_TEXTURE_MANAGER_ANDROID_H_ |
| #define CONTENT_COMMON_GPU_STREAM_TEXTURE_MANAGER_ANDROID_H_ |
| +#pragma once |
| +#include "base/callback.h" |
| #include "base/id_map.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "content/common/android/surface_texture_peer.h" |
| #include "gpu/command_buffer/service/stream_texture.h" |
| #include "gpu/command_buffer/service/stream_texture_manager.h" |
| class GpuChannel; |
| +struct GpuStreamTextureMsg_MatrixChanged_Params; |
| + |
| +namespace gfx { |
| +class Size; |
| +} |
| namespace content { |
| @@ -24,10 +32,21 @@ class StreamTextureManagerAndroid : public gpu::StreamTextureManager { |
| virtual ~StreamTextureManagerAndroid(); |
| // implement gpu::StreamTextureManager: |
| - GLuint CreateStreamTexture(uint32 service_id, |
| + virtual GLuint CreateStreamTexture(uint32 service_id, |
| uint32 client_id) OVERRIDE; |
| - void DestroyStreamTexture(uint32 service_id) OVERRIDE; |
| - gpu::StreamTexture* LookupStreamTexture(uint32 service_id) OVERRIDE; |
| + virtual void DestroyStreamTexture(uint32 service_id) OVERRIDE; |
| + virtual gpu::StreamTexture* LookupStreamTexture(uint32 service_id) OVERRIDE; |
| + |
| + // Methods invoked from GpuChannel. |
| + void RegisterStreamTextureProxy( |
| + int32 stream_id, const gfx::Size& initial_size, int32 route_id); |
| + void EstablishStreamTexture( |
| + int32 stream_id, content::SurfaceTexturePeer::SurfaceTextureTarget type, |
| + int32 primary_id, int32 secondary_id); |
| + |
| + // Send new transform matrix. |
| + void SendMatrixChanged(int route_id, |
| + const GpuStreamTextureMsg_MatrixChanged_Params& params); |
| private: |
| // The stream texture class for android. |
| @@ -38,14 +57,34 @@ class StreamTextureManagerAndroid : public gpu::StreamTextureManager { |
| StreamTextureAndroid(GpuChannel* channel, int service_id); |
| virtual ~StreamTextureAndroid(); |
| - void Update() OVERRIDE; |
| + virtual void Update() OVERRIDE; |
| SurfaceTextureBridge* bridge() { return surface_texture_.get(); } |
| + // Called when a new frame is available. |
| + void OnFrameAvailable(int route_id); |
| + |
| + // Callback function when transform matrix of the surface texture |
| + // has changed. |
| + typedef base::Callback< |
| + void(const GpuStreamTextureMsg_MatrixChanged_Params&)> |
| + MatrixChangedCB; |
| + |
| + void set_matrix_changed_callback(const MatrixChangedCB& callback) |
| + { matrix_callback_ = callback; } |
|
apatrick_chromium
2012/07/12 23:51:31
nit: google style
qinmin
2012/07/13 00:41:33
Done.
|
| + |
| private: |
| scoped_ptr<SurfaceTextureBridge> surface_texture_; |
| - GpuChannel* channel_; |
| + // Current transform matrix of the surface texture. |
| + float current_matrix_[16]; |
| + |
| + // Whether the surface texture has been updated. |
| + bool has_updated_; |
| + |
| + MatrixChangedCB matrix_callback_; |
| + |
| + GpuChannel* channel_; |
| DISALLOW_COPY_AND_ASSIGN(StreamTextureAndroid); |
| }; |
| @@ -54,6 +93,10 @@ class StreamTextureManagerAndroid : public gpu::StreamTextureManager { |
| typedef IDMap<StreamTextureAndroid, IDMapOwnPointer> TextureMap; |
| TextureMap textures_; |
| + // Map for more convenient lookup. |
| + typedef IDMap<gpu::StreamTexture, IDMapExternalPointer> TextureServiceIdMap; |
| + TextureServiceIdMap textures_from_service_id_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(StreamTextureManagerAndroid); |
| }; |