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

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: crown of aragorn 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Tells the GPU process to create a new command buffer that draws into the 114 // Tells the GPU process to create a new command buffer that draws into the
117 // given surface. 115 // given surface.
118 void CreateViewCommandBuffer( 116 void CreateViewCommandBuffer(
119 const gfx::GLSurfaceHandle& compositing_surface, 117 const gfx::GLSurfaceHandle& compositing_surface,
120 int surface_id, 118 int surface_id,
121 int client_id, 119 int client_id,
122 const GPUCreateCommandBufferConfig& init_params, 120 const GPUCreateCommandBufferConfig& init_params,
123 int route_id, 121 int route_id,
124 const CreateCommandBufferCallback& callback); 122 const CreateCommandBufferCallback& callback);
125 123
126 // Tells the GPU process to create a new image using the given window. 124 // Tells the GPU process to create a new GPU memory buffer using the given
127 void CreateImage( 125 // handle.
128 gfx::PluginWindowHandle window,
129 int client_id,
130 int image_id,
131 const CreateImageCallback& callback);
132
133 // Tells the GPU process to delete image.
134 void DeleteImage(int client_id, int image_id, int sync_point);
135
136 void CreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, 126 void CreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
137 const gfx::Size& size, 127 const gfx::Size& size,
138 unsigned internalformat, 128 unsigned internalformat,
139 unsigned usage, 129 unsigned usage,
140 const CreateGpuMemoryBufferCallback& callback); 130 const CreateGpuMemoryBufferCallback& callback);
131
132 // Tells the GPU process to destroy GPU memory buffer.
141 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, 133 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
142 int sync_point); 134 int sync_point);
143 135
144 // What kind of GPU process, e.g. sandboxed or unsandboxed. 136 // What kind of GPU process, e.g. sandboxed or unsandboxed.
145 GpuProcessKind kind(); 137 GpuProcessKind kind();
146 138
147 void ForceShutdown(); 139 void ForceShutdown();
148 140
149 void BeginFrameSubscription( 141 void BeginFrameSubscription(
150 int surface_id, 142 int surface_id,
(...skipping 16 matching lines...) Expand all
167 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 159 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
168 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 160 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
169 virtual void OnProcessLaunched() OVERRIDE; 161 virtual void OnProcessLaunched() OVERRIDE;
170 virtual void OnProcessCrashed(int exit_code) OVERRIDE; 162 virtual void OnProcessCrashed(int exit_code) OVERRIDE;
171 163
172 // Message handlers. 164 // Message handlers.
173 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); 165 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info);
174 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); 166 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle);
175 void OnCommandBufferCreated(bool succeeded); 167 void OnCommandBufferCreated(bool succeeded);
176 void OnDestroyCommandBuffer(int32 surface_id); 168 void OnDestroyCommandBuffer(int32 surface_id);
177 void OnImageCreated(const gfx::Size size);
178 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); 169 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle);
179 void OnDidCreateOffscreenContext(const GURL& url); 170 void OnDidCreateOffscreenContext(const GURL& url);
180 void OnDidLoseContext(bool offscreen, 171 void OnDidLoseContext(bool offscreen,
181 gpu::error::ContextLostReason reason, 172 gpu::error::ContextLostReason reason,
182 const GURL& url); 173 const GURL& url);
183 void OnDidDestroyOffscreenContext(const GURL& url); 174 void OnDidDestroyOffscreenContext(const GURL& url);
184 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); 175 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats);
185 #if defined(OS_MACOSX) 176 #if defined(OS_MACOSX)
186 void OnAcceleratedSurfaceBuffersSwapped( 177 void OnAcceleratedSurfaceBuffersSwapped(
187 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); 178 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
(...skipping 15 matching lines...) Expand all
203 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. 194 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair.
204 int host_id_; 195 int host_id_;
205 196
206 // These are the channel requests that we have already sent to 197 // These are the channel requests that we have already sent to
207 // the GPU process, but haven't heard back about yet. 198 // the GPU process, but haven't heard back about yet.
208 std::queue<EstablishChannelCallback> channel_requests_; 199 std::queue<EstablishChannelCallback> channel_requests_;
209 200
210 // The pending create command buffer requests we need to reply to. 201 // The pending create command buffer requests we need to reply to.
211 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; 202 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_;
212 203
213 // The pending create image requests we need to reply to.
214 std::queue<CreateImageCallback> create_image_requests_;
215
216 // The pending create gpu memory buffer requests we need to reply to. 204 // The pending create gpu memory buffer requests we need to reply to.
217 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_; 205 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_;
218 206
219 // Qeueud messages to send when the process launches. 207 // Qeueud messages to send when the process launches.
220 std::queue<IPC::Message*> queued_messages_; 208 std::queue<IPC::Message*> queued_messages_;
221 209
222 // Whether the GPU process is valid, set to false after Send() failed. 210 // Whether the GPU process is valid, set to false after Send() failed.
223 bool valid_; 211 bool valid_;
224 212
225 // Whether we are running a GPU thread inside the browser process instead 213 // Whether we are running a GPU thread inside the browser process instead
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > 267 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> >
280 SurfaceRefMap; 268 SurfaceRefMap;
281 SurfaceRefMap surface_refs_; 269 SurfaceRefMap surface_refs_;
282 270
283 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); 271 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
284 }; 272 };
285 273
286 } // namespace content 274 } // namespace content
287 275
288 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ 276 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698