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

Side by Side Diff: content/common/gpu/gpu_channel.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 | « no previous file | content/common/gpu/gpu_channel.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_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 10
11 #include "base/id_map.h" 11 #include "base/id_map.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/process.h" 15 #include "base/process.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "content/common/gpu/gpu_command_buffer_stub.h" 17 #include "content/common/gpu/gpu_command_buffer_stub.h"
18 #include "content/common/gpu/gpu_memory_manager.h" 18 #include "content/common/gpu/gpu_memory_manager.h"
19 #include "content/common/message_router.h" 19 #include "content/common/message_router.h"
20 #include "ipc/ipc_sync_channel.h" 20 #include "ipc/ipc_sync_channel.h"
21 #include "ui/gfx/native_widget_types.h" 21 #include "ui/gfx/native_widget_types.h"
22 #include "ui/gfx/size.h" 22 #include "ui/gfx/size.h"
23 #include "ui/gl/gl_share_group.h" 23 #include "ui/gl/gl_share_group.h"
24 #include "ui/gl/gpu_preference.h" 24 #include "ui/gl/gpu_preference.h"
25 25
26 #if defined(OS_ANDROID)
27 #include "content/common/android/surface_texture_peer.h"
28 #endif
29
26 class GpuChannelManager; 30 class GpuChannelManager;
27 struct GPUCreateCommandBufferConfig; 31 struct GPUCreateCommandBufferConfig;
28 class GpuWatchdog; 32 class GpuWatchdog;
29 33
30 namespace base { 34 namespace base {
31 class MessageLoopProxy; 35 class MessageLoopProxy;
32 class WaitableEvent; 36 class WaitableEvent;
33 } 37 }
34 38
35 namespace gpu { 39 namespace gpu {
36 struct RefCountedCounter; 40 struct RefCountedCounter;
37 } 41 }
38 42
43 #if defined(OS_ANDROID)
44 namespace content {
45 class StreamTextureManagerAndroid;
46 }
47 #endif
48
39 // Encapsulates an IPC channel between the GPU process and one renderer 49 // Encapsulates an IPC channel between the GPU process and one renderer
40 // process. On the renderer side there's a corresponding GpuChannelHost. 50 // process. On the renderer side there's a corresponding GpuChannelHost.
41 class GpuChannel : public IPC::Listener, 51 class GpuChannel : public IPC::Listener,
42 public IPC::Sender, 52 public IPC::Sender,
43 public base::RefCountedThreadSafe<GpuChannel> { 53 public base::RefCountedThreadSafe<GpuChannel> {
44 public: 54 public:
45 // Takes ownership of the renderer process handle. 55 // Takes ownership of the renderer process handle.
46 GpuChannel(GpuChannelManager* gpu_channel_manager, 56 GpuChannel(GpuChannelManager* gpu_channel_manager,
47 GpuWatchdog* watchdog, 57 GpuWatchdog* watchdog,
48 gfx::GLShareGroup* share_group, 58 gfx::GLShareGroup* share_group,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 136
127 void HandleMessage(); 137 void HandleMessage();
128 138
129 // Message handlers. 139 // Message handlers.
130 void OnCreateOffscreenCommandBuffer( 140 void OnCreateOffscreenCommandBuffer(
131 const gfx::Size& size, 141 const gfx::Size& size,
132 const GPUCreateCommandBufferConfig& init_params, 142 const GPUCreateCommandBufferConfig& init_params,
133 IPC::Message* reply_message); 143 IPC::Message* reply_message);
134 void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message); 144 void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message);
135 145
146 #if defined(OS_ANDROID)
147 // Register the StreamTextureProxy class with the gpu process so that all
148 // the callbacks will be correctly forwarded to the renderer.
149 void OnRegisterStreamTextureProxy(
150 int32 stream_id, const gfx::Size& initial_size, int32* route_id);
151
152 // Create a java surface texture object and send it to the renderer process
153 // through binder thread.
154 void OnEstablishStreamTexture(
155 int32 stream_id, content::SurfaceTexturePeer::SurfaceTextureTarget type,
156 int32 primary_id, int32 secondary_id);
157 #endif
158
136 // The lifetime of objects of this class is managed by a GpuChannelManager. 159 // The lifetime of objects of this class is managed by a GpuChannelManager.
137 // The GpuChannelManager destroy all the GpuChannels that they own when they 160 // The GpuChannelManager destroy all the GpuChannels that they own when they
138 // are destroyed. So a raw pointer is safe. 161 // are destroyed. So a raw pointer is safe.
139 GpuChannelManager* gpu_channel_manager_; 162 GpuChannelManager* gpu_channel_manager_;
140 163
141 scoped_ptr<IPC::SyncChannel> channel_; 164 scoped_ptr<IPC::SyncChannel> channel_;
142 165
143 // Number of routed messages for pending processing on a stub. 166 // Number of routed messages for pending processing on a stub.
144 scoped_refptr<gpu::RefCountedCounter> unprocessed_messages_; 167 scoped_refptr<gpu::RefCountedCounter> unprocessed_messages_;
145 168
(...skipping 24 matching lines...) Expand all
170 StubMap stubs_; 193 StubMap stubs_;
171 #endif // defined (ENABLE_GPU) 194 #endif // defined (ENABLE_GPU)
172 195
173 bool log_messages_; // True if we should log sent and received messages. 196 bool log_messages_; // True if we should log sent and received messages.
174 gpu::gles2::DisallowedFeatures disallowed_features_; 197 gpu::gles2::DisallowedFeatures disallowed_features_;
175 GpuWatchdog* watchdog_; 198 GpuWatchdog* watchdog_;
176 bool software_; 199 bool software_;
177 bool handle_messages_scheduled_; 200 bool handle_messages_scheduled_;
178 bool processed_get_state_fast_; 201 bool processed_get_state_fast_;
179 202
203 #if defined(OS_ANDROID)
204 scoped_ptr<content::StreamTextureManagerAndroid> stream_texture_manager_;
205 #endif
206
180 base::WeakPtrFactory<GpuChannel> weak_factory_; 207 base::WeakPtrFactory<GpuChannel> weak_factory_;
181 208
182 DISALLOW_COPY_AND_ASSIGN(GpuChannel); 209 DISALLOW_COPY_AND_ASSIGN(GpuChannel);
183 }; 210 };
184 211
185 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 212 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/gpu_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698