| OLD | NEW |
| 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_GPU_CHANNEL_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "ipc/ipc_sync_channel.h" | 21 #include "ipc/ipc_sync_channel.h" |
| 22 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
| 23 #include "ui/gfx/size.h" | 23 #include "ui/gfx/size.h" |
| 24 #include "ui/gl/gl_share_group.h" | 24 #include "ui/gl/gl_share_group.h" |
| 25 #include "ui/gl/gpu_preference.h" | 25 #include "ui/gl/gpu_preference.h" |
| 26 | 26 |
| 27 #if defined(OS_ANDROID) | 27 #if defined(OS_ANDROID) |
| 28 #include "content/common/android/surface_texture_peer.h" | 28 #include "content/common/android/surface_texture_peer.h" |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 class GpuChannelManager; | |
| 32 struct GPUCreateCommandBufferConfig; | 31 struct GPUCreateCommandBufferConfig; |
| 33 class GpuWatchdog; | |
| 34 | 32 |
| 35 namespace base { | 33 namespace base { |
| 36 class MessageLoopProxy; | 34 class MessageLoopProxy; |
| 37 class WaitableEvent; | 35 class WaitableEvent; |
| 38 } | 36 } |
| 39 | 37 |
| 40 namespace gpu { | 38 namespace gpu { |
| 41 struct RefCountedCounter; | 39 struct RefCountedCounter; |
| 42 namespace gles2 { | 40 namespace gles2 { |
| 43 class ImageManager; | 41 class ImageManager; |
| 44 } | 42 } |
| 45 } | 43 } |
| 46 | 44 |
| 47 #if defined(OS_ANDROID) | 45 #if defined(OS_ANDROID) |
| 48 namespace content { | 46 namespace content { |
| 49 class StreamTextureManagerAndroid; | 47 class StreamTextureManagerAndroid; |
| 50 } | 48 } |
| 51 #endif | 49 #endif |
| 52 | 50 |
| 51 namespace content { |
| 52 class GpuChannelManager; |
| 53 class GpuWatchdog; |
| 54 |
| 53 // Encapsulates an IPC channel between the GPU process and one renderer | 55 // Encapsulates an IPC channel between the GPU process and one renderer |
| 54 // process. On the renderer side there's a corresponding GpuChannelHost. | 56 // process. On the renderer side there's a corresponding GpuChannelHost. |
| 55 class GpuChannel : public IPC::Listener, | 57 class GpuChannel : public IPC::Listener, |
| 56 public IPC::Sender, | 58 public IPC::Sender, |
| 57 public base::RefCountedThreadSafe<GpuChannel> { | 59 public base::RefCountedThreadSafe<GpuChannel> { |
| 58 public: | 60 public: |
| 59 // Takes ownership of the renderer process handle. | 61 // Takes ownership of the renderer process handle. |
| 60 GpuChannel(GpuChannelManager* gpu_channel_manager, | 62 GpuChannel(GpuChannelManager* gpu_channel_manager, |
| 61 GpuWatchdog* watchdog, | 63 GpuWatchdog* watchdog, |
| 62 gfx::GLShareGroup* share_group, | 64 gfx::GLShareGroup* share_group, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 gpu::RefCountedCounter* MessagesPendingCount() { | 130 gpu::RefCountedCounter* MessagesPendingCount() { |
| 129 return unprocessed_messages_.get(); | 131 return unprocessed_messages_.get(); |
| 130 } | 132 } |
| 131 | 133 |
| 132 // If preempt_by_counter->count is non-zero, any stub on this channel | 134 // If preempt_by_counter->count is non-zero, any stub on this channel |
| 133 // should stop issuing GL commands. Setting this to NULL stops deferral. | 135 // should stop issuing GL commands. Setting this to NULL stops deferral. |
| 134 void SetPreemptByCounter( | 136 void SetPreemptByCounter( |
| 135 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter); | 137 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter); |
| 136 | 138 |
| 137 #if defined(OS_ANDROID) | 139 #if defined(OS_ANDROID) |
| 138 content::StreamTextureManagerAndroid* stream_texture_manager() { | 140 StreamTextureManagerAndroid* stream_texture_manager() { |
| 139 return stream_texture_manager_.get(); | 141 return stream_texture_manager_.get(); |
| 140 } | 142 } |
| 141 #endif | 143 #endif |
| 142 | 144 |
| 143 protected: | 145 protected: |
| 144 virtual ~GpuChannel(); | 146 virtual ~GpuChannel(); |
| 145 | 147 |
| 146 private: | 148 private: |
| 147 friend class base::RefCountedThreadSafe<GpuChannel>; | 149 friend class base::RefCountedThreadSafe<GpuChannel>; |
| 148 | 150 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 161 | 163 |
| 162 #if defined(OS_ANDROID) | 164 #if defined(OS_ANDROID) |
| 163 // Register the StreamTextureProxy class with the gpu process so that all | 165 // Register the StreamTextureProxy class with the gpu process so that all |
| 164 // the callbacks will be correctly forwarded to the renderer. | 166 // the callbacks will be correctly forwarded to the renderer. |
| 165 void OnRegisterStreamTextureProxy( | 167 void OnRegisterStreamTextureProxy( |
| 166 int32 stream_id, const gfx::Size& initial_size, int32* route_id); | 168 int32 stream_id, const gfx::Size& initial_size, int32* route_id); |
| 167 | 169 |
| 168 // Create a java surface texture object and send it to the renderer process | 170 // Create a java surface texture object and send it to the renderer process |
| 169 // through binder thread. | 171 // through binder thread. |
| 170 void OnEstablishStreamTexture( | 172 void OnEstablishStreamTexture( |
| 171 int32 stream_id, content::SurfaceTexturePeer::SurfaceTextureTarget type, | 173 int32 stream_id, SurfaceTexturePeer::SurfaceTextureTarget type, |
| 172 int32 primary_id, int32 secondary_id); | 174 int32 primary_id, int32 secondary_id); |
| 173 #endif | 175 #endif |
| 174 | 176 |
| 175 // Collect rendering stats. | 177 // Collect rendering stats. |
| 176 void OnCollectRenderingStatsForSurface( | 178 void OnCollectRenderingStatsForSurface( |
| 177 int32 surface_id, IPC::Message* reply_message); | 179 int32 surface_id, IPC::Message* reply_message); |
| 178 | 180 |
| 179 // The lifetime of objects of this class is managed by a GpuChannelManager. | 181 // The lifetime of objects of this class is managed by a GpuChannelManager. |
| 180 // The GpuChannelManager destroy all the GpuChannels that they own when they | 182 // The GpuChannelManager destroy all the GpuChannels that they own when they |
| 181 // are destroyed. So a raw pointer is safe. | 183 // are destroyed. So a raw pointer is safe. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 #endif // defined (ENABLE_GPU) | 217 #endif // defined (ENABLE_GPU) |
| 216 | 218 |
| 217 bool log_messages_; // True if we should log sent and received messages. | 219 bool log_messages_; // True if we should log sent and received messages. |
| 218 gpu::gles2::DisallowedFeatures disallowed_features_; | 220 gpu::gles2::DisallowedFeatures disallowed_features_; |
| 219 GpuWatchdog* watchdog_; | 221 GpuWatchdog* watchdog_; |
| 220 bool software_; | 222 bool software_; |
| 221 bool handle_messages_scheduled_; | 223 bool handle_messages_scheduled_; |
| 222 bool processed_get_state_fast_; | 224 bool processed_get_state_fast_; |
| 223 | 225 |
| 224 #if defined(OS_ANDROID) | 226 #if defined(OS_ANDROID) |
| 225 scoped_ptr<content::StreamTextureManagerAndroid> stream_texture_manager_; | 227 scoped_ptr<StreamTextureManagerAndroid> stream_texture_manager_; |
| 226 #endif | 228 #endif |
| 227 | 229 |
| 228 base::WeakPtrFactory<GpuChannel> weak_factory_; | 230 base::WeakPtrFactory<GpuChannel> weak_factory_; |
| 229 | 231 |
| 230 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 232 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
| 231 }; | 233 }; |
| 232 | 234 |
| 235 } // namespace content |
| 236 |
| 233 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 237 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| OLD | NEW |