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

Side by Side Diff: content/common/gpu/stream_texture_manager_android.h

Issue 10695181: [Android] Upstream all the IPC communications/handlings for stream texture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove #pragma once Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/common/gpu/stream_texture_manager_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_GPU_STREAM_TEXTURE_MANAGER_ANDROID_H_ 5 #ifndef CONTENT_COMMON_GPU_STREAM_TEXTURE_MANAGER_ANDROID_H_
6 #define CONTENT_COMMON_GPU_STREAM_TEXTURE_MANAGER_ANDROID_H_ 6 #define CONTENT_COMMON_GPU_STREAM_TEXTURE_MANAGER_ANDROID_H_
7 7
8 #include "base/callback.h"
8 #include "base/id_map.h" 9 #include "base/id_map.h"
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "content/common/android/surface_texture_peer.h"
11 #include "gpu/command_buffer/service/stream_texture.h" 13 #include "gpu/command_buffer/service/stream_texture.h"
12 #include "gpu/command_buffer/service/stream_texture_manager.h" 14 #include "gpu/command_buffer/service/stream_texture_manager.h"
13 15
14 class GpuChannel; 16 class GpuChannel;
17 struct GpuStreamTextureMsg_MatrixChanged_Params;
18
19 namespace gfx {
20 class Size;
21 }
15 22
16 namespace content { 23 namespace content {
17 24
18 class SurfaceTextureBridge; 25 class SurfaceTextureBridge;
19 26
20 // Class for managing the stream texture. 27 // Class for managing the stream texture.
21 class StreamTextureManagerAndroid : public gpu::StreamTextureManager { 28 class StreamTextureManagerAndroid : public gpu::StreamTextureManager {
22 public: 29 public:
23 StreamTextureManagerAndroid(GpuChannel* channel); 30 StreamTextureManagerAndroid(GpuChannel* channel);
24 virtual ~StreamTextureManagerAndroid(); 31 virtual ~StreamTextureManagerAndroid();
25 32
26 // implement gpu::StreamTextureManager: 33 // implement gpu::StreamTextureManager:
27 GLuint CreateStreamTexture(uint32 service_id, 34 virtual GLuint CreateStreamTexture(uint32 service_id,
28 uint32 client_id) OVERRIDE; 35 uint32 client_id) OVERRIDE;
29 void DestroyStreamTexture(uint32 service_id) OVERRIDE; 36 virtual void DestroyStreamTexture(uint32 service_id) OVERRIDE;
30 gpu::StreamTexture* LookupStreamTexture(uint32 service_id) OVERRIDE; 37 virtual gpu::StreamTexture* LookupStreamTexture(uint32 service_id) OVERRIDE;
38
39 // Methods invoked from GpuChannel.
40 void RegisterStreamTextureProxy(
41 int32 stream_id, const gfx::Size& initial_size, int32 route_id);
42 void EstablishStreamTexture(
43 int32 stream_id, content::SurfaceTexturePeer::SurfaceTextureTarget type,
44 int32 primary_id, int32 secondary_id);
45
46 // Send new transform matrix.
47 void SendMatrixChanged(int route_id,
48 const GpuStreamTextureMsg_MatrixChanged_Params& params);
31 49
32 private: 50 private:
33 // The stream texture class for android. 51 // The stream texture class for android.
34 class StreamTextureAndroid 52 class StreamTextureAndroid
35 : public gpu::StreamTexture, 53 : public gpu::StreamTexture,
36 public base::SupportsWeakPtr<StreamTextureAndroid> { 54 public base::SupportsWeakPtr<StreamTextureAndroid> {
37 public: 55 public:
38 StreamTextureAndroid(GpuChannel* channel, int service_id); 56 StreamTextureAndroid(GpuChannel* channel, int service_id);
39 virtual ~StreamTextureAndroid(); 57 virtual ~StreamTextureAndroid();
40 58
41 void Update() OVERRIDE; 59 virtual void Update() OVERRIDE;
42 60
43 SurfaceTextureBridge* bridge() { return surface_texture_.get(); } 61 SurfaceTextureBridge* bridge() { return surface_texture_.get(); }
44 62
63 // Called when a new frame is available.
64 void OnFrameAvailable(int route_id);
65
66 // Callback function when transform matrix of the surface texture
67 // has changed.
68 typedef base::Callback<
69 void(const GpuStreamTextureMsg_MatrixChanged_Params&)>
70 MatrixChangedCB;
71
72 void set_matrix_changed_callback(const MatrixChangedCB& callback) {
73 matrix_callback_ = callback;
74 }
75
45 private: 76 private:
46 scoped_ptr<SurfaceTextureBridge> surface_texture_; 77 scoped_ptr<SurfaceTextureBridge> surface_texture_;
78
79 // Current transform matrix of the surface texture.
80 float current_matrix_[16];
81
82 // Whether the surface texture has been updated.
83 bool has_updated_;
84
85 MatrixChangedCB matrix_callback_;
86
47 GpuChannel* channel_; 87 GpuChannel* channel_;
48
49 DISALLOW_COPY_AND_ASSIGN(StreamTextureAndroid); 88 DISALLOW_COPY_AND_ASSIGN(StreamTextureAndroid);
50 }; 89 };
51 90
52 GpuChannel* channel_; 91 GpuChannel* channel_;
53 92
54 typedef IDMap<StreamTextureAndroid, IDMapOwnPointer> TextureMap; 93 typedef IDMap<StreamTextureAndroid, IDMapOwnPointer> TextureMap;
55 TextureMap textures_; 94 TextureMap textures_;
56 95
96 // Map for more convenient lookup.
97 typedef IDMap<gpu::StreamTexture, IDMapExternalPointer> TextureServiceIdMap;
98 TextureServiceIdMap textures_from_service_id_;
99
57 DISALLOW_COPY_AND_ASSIGN(StreamTextureManagerAndroid); 100 DISALLOW_COPY_AND_ASSIGN(StreamTextureManagerAndroid);
58 }; 101 };
59 102
60 } // namespace content 103 } // namespace content
61 104
62 #endif // CONTENT_COMMON_GPU_STREAM_TEXTURE_MANAGER_ANDROID_H_ 105 #endif // CONTENT_COMMON_GPU_STREAM_TEXTURE_MANAGER_ANDROID_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/common/gpu/stream_texture_manager_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698