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

Side by Side Diff: content/browser/gpu/gpu_process_host.h

Issue 331723003: gpu: Remove Create/DeleteImage IPC by adding an X11_PIXMAP_BUFFER GpuMemoryBuffer type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wip Created 6 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
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_BROWSER_GPU_GPU_PROCESS_HOST_H_ 5 #ifndef CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_
6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ 6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 GPU_PROCESS_KIND_UNSANDBOXED, 58 GPU_PROCESS_KIND_UNSANDBOXED,
59 GPU_PROCESS_KIND_SANDBOXED, 59 GPU_PROCESS_KIND_SANDBOXED,
60 GPU_PROCESS_KIND_COUNT 60 GPU_PROCESS_KIND_COUNT
61 }; 61 };
62 62
63 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> 63 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)>
64 EstablishChannelCallback; 64 EstablishChannelCallback;
65 65
66 typedef base::Callback<void(bool)> CreateCommandBufferCallback; 66 typedef base::Callback<void(bool)> CreateCommandBufferCallback;
67 67
68 typedef base::Callback<void(const gfx::Size)> CreateImageCallback;
69
70 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> 68 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)>
71 CreateGpuMemoryBufferCallback; 69 CreateGpuMemoryBufferCallback;
72 70
73 static bool gpu_enabled() { return gpu_enabled_; } 71 static bool gpu_enabled() { return gpu_enabled_; }
74 72
75 // Creates a new GpuProcessHost or gets an existing one, resulting in the 73 // Creates a new GpuProcessHost or gets an existing one, resulting in the
76 // launching of a GPU process if required. Returns null on failure. It 74 // launching of a GPU process if required. Returns null on failure. It
77 // is not safe to store the pointer once control has returned to the message 75 // is not safe to store the pointer once control has returned to the message
78 // loop as it can be destroyed. Instead store the associated GPU host ID. 76 // loop as it can be destroyed. Instead store the associated GPU host ID.
79 // This could return NULL if GPU access is not allowed (blacklisted). 77 // This could return NULL if GPU access is not allowed (blacklisted).
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // Tells the GPU process to create a new command buffer that draws into the 113 // Tells the GPU process to create a new command buffer that draws into the
116 // given surface. 114 // given surface.
117 void CreateViewCommandBuffer( 115 void CreateViewCommandBuffer(
118 const gfx::GLSurfaceHandle& compositing_surface, 116 const gfx::GLSurfaceHandle& compositing_surface,
119 int surface_id, 117 int surface_id,
120 int client_id, 118 int client_id,
121 const GPUCreateCommandBufferConfig& init_params, 119 const GPUCreateCommandBufferConfig& init_params,
122 int route_id, 120 int route_id,
123 const CreateCommandBufferCallback& callback); 121 const CreateCommandBufferCallback& callback);
124 122
125 // Tells the GPU process to create a new image using the given window. 123 // Tells the GPU process to create a new GPU memory buffer using the given
126 void CreateImage( 124 // handle.
127 gfx::PluginWindowHandle window,
128 int client_id,
129 int image_id,
130 const CreateImageCallback& callback);
131
132 // Tells the GPU process to delete image.
133 void DeleteImage(int client_id, int image_id, int sync_point);
134
135 void CreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, 125 void CreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
136 const gfx::Size& size, 126 const gfx::Size& size,
137 unsigned internalformat, 127 unsigned internalformat,
138 unsigned usage, 128 unsigned usage,
139 const CreateGpuMemoryBufferCallback& callback); 129 const CreateGpuMemoryBufferCallback& callback);
130
131 // Tells the GPU process to destroy GPU memory buffer.
140 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, 132 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
141 int sync_point); 133 int sync_point);
142 134
143 // What kind of GPU process, e.g. sandboxed or unsandboxed. 135 // What kind of GPU process, e.g. sandboxed or unsandboxed.
144 GpuProcessKind kind(); 136 GpuProcessKind kind();
145 137
146 void ForceShutdown(); 138 void ForceShutdown();
147 139
148 void BeginFrameSubscription( 140 void BeginFrameSubscription(
149 int surface_id, 141 int surface_id,
(...skipping 16 matching lines...) Expand all
166 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 158 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
167 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 159 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
168 virtual void OnProcessLaunched() OVERRIDE; 160 virtual void OnProcessLaunched() OVERRIDE;
169 virtual void OnProcessCrashed(int exit_code) OVERRIDE; 161 virtual void OnProcessCrashed(int exit_code) OVERRIDE;
170 162
171 // Message handlers. 163 // Message handlers.
172 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); 164 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info);
173 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); 165 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle);
174 void OnCommandBufferCreated(bool succeeded); 166 void OnCommandBufferCreated(bool succeeded);
175 void OnDestroyCommandBuffer(int32 surface_id); 167 void OnDestroyCommandBuffer(int32 surface_id);
176 void OnImageCreated(const gfx::Size size);
177 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); 168 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle);
178 void OnDidCreateOffscreenContext(const GURL& url); 169 void OnDidCreateOffscreenContext(const GURL& url);
179 void OnDidLoseContext(bool offscreen, 170 void OnDidLoseContext(bool offscreen,
180 gpu::error::ContextLostReason reason, 171 gpu::error::ContextLostReason reason,
181 const GURL& url); 172 const GURL& url);
182 void OnDidDestroyOffscreenContext(const GURL& url); 173 void OnDidDestroyOffscreenContext(const GURL& url);
183 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); 174 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats);
184 #if defined(OS_MACOSX) 175 #if defined(OS_MACOSX)
185 void OnAcceleratedSurfaceBuffersSwapped( 176 void OnAcceleratedSurfaceBuffersSwapped(
186 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); 177 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
(...skipping 15 matching lines...) Expand all
202 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. 193 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair.
203 int host_id_; 194 int host_id_;
204 195
205 // These are the channel requests that we have already sent to 196 // These are the channel requests that we have already sent to
206 // the GPU process, but haven't heard back about yet. 197 // the GPU process, but haven't heard back about yet.
207 std::queue<EstablishChannelCallback> channel_requests_; 198 std::queue<EstablishChannelCallback> channel_requests_;
208 199
209 // The pending create command buffer requests we need to reply to. 200 // The pending create command buffer requests we need to reply to.
210 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; 201 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_;
211 202
212 // The pending create image requests we need to reply to.
213 std::queue<CreateImageCallback> create_image_requests_;
214
215 // The pending create gpu memory buffer requests we need to reply to. 203 // The pending create gpu memory buffer requests we need to reply to.
216 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_; 204 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_;
217 205
218 // Qeueud messages to send when the process launches. 206 // Qeueud messages to send when the process launches.
219 std::queue<IPC::Message*> queued_messages_; 207 std::queue<IPC::Message*> queued_messages_;
220 208
221 // Whether the GPU process is valid, set to false after Send() failed. 209 // Whether the GPU process is valid, set to false after Send() failed.
222 bool valid_; 210 bool valid_;
223 211
224 // Whether we are running a GPU thread inside the browser process instead 212 // Whether we are running a GPU thread inside the browser process instead
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > 266 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> >
279 SurfaceRefMap; 267 SurfaceRefMap;
280 SurfaceRefMap surface_refs_; 268 SurfaceRefMap surface_refs_;
281 269
282 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); 270 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
283 }; 271 };
284 272
285 } // namespace content 273 } // namespace content
286 274
287 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ 275 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698