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

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

Issue 2798363003: Revert "gpu: Use mojom API for creating gpu channel." (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.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_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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 public: 65 public:
66 enum GpuProcessKind { 66 enum GpuProcessKind {
67 GPU_PROCESS_KIND_UNSANDBOXED, 67 GPU_PROCESS_KIND_UNSANDBOXED,
68 GPU_PROCESS_KIND_SANDBOXED, 68 GPU_PROCESS_KIND_SANDBOXED,
69 GPU_PROCESS_KIND_COUNT 69 GPU_PROCESS_KIND_COUNT
70 }; 70 };
71 71
72 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> 72 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)>
73 EstablishChannelCallback; 73 EstablishChannelCallback;
74 74
75 struct EstablishChannelRequest {
76 EstablishChannelRequest();
77 EstablishChannelRequest(const EstablishChannelRequest& other);
78 ~EstablishChannelRequest();
79 int32_t client_id;
80 EstablishChannelCallback callback;
81 };
82
75 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> 83 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)>
76 CreateGpuMemoryBufferCallback; 84 CreateGpuMemoryBufferCallback;
77 85
78 static bool gpu_enabled() { return gpu_enabled_; } 86 static bool gpu_enabled() { return gpu_enabled_; }
79 static int gpu_crash_count() { return gpu_crash_count_; } 87 static int gpu_crash_count() { return gpu_crash_count_; }
80 88
81 // Creates a new GpuProcessHost (if |force_create| is turned on) or gets an 89 // Creates a new GpuProcessHost (if |force_create| is turned on) or gets an
82 // existing one, resulting in the launching of a GPU process if required. 90 // existing one, resulting in the launching of a GPU process if required.
83 // Returns null on failure. It is not safe to store the pointer once control 91 // Returns null on failure. It is not safe to store the pointer once control
84 // has returned to the message loop as it can be destroyed. Instead store the 92 // has returned to the message loop as it can be destroyed. Instead store the
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 void DidDestroyChannel(int32_t client_id) override; 198 void DidDestroyChannel(int32_t client_id) override;
191 void DidLoseContext(bool offscreen, 199 void DidLoseContext(bool offscreen,
192 gpu::error::ContextLostReason reason, 200 gpu::error::ContextLostReason reason,
193 const GURL& active_url) override; 201 const GURL& active_url) override;
194 void SetChildSurface(gpu::SurfaceHandle parent, 202 void SetChildSurface(gpu::SurfaceHandle parent,
195 gpu::SurfaceHandle child) override; 203 gpu::SurfaceHandle child) override;
196 void StoreShaderToDisk(int32_t client_id, 204 void StoreShaderToDisk(int32_t client_id,
197 const std::string& key, 205 const std::string& key,
198 const std::string& shader) override; 206 const std::string& shader) override;
199 207
200 void OnChannelEstablished(int client_id,
201 const EstablishChannelCallback& callback,
202 mojo::ScopedMessagePipeHandle channel_handle);
203
204 // Message handlers. 208 // Message handlers.
205 void OnInitialized(bool result, 209 void OnInitialized(bool result,
206 const gpu::GPUInfo& gpu_info, 210 const gpu::GPUInfo& gpu_info,
207 const gpu::GpuFeatureInfo& gpu_feature_info); 211 const gpu::GpuFeatureInfo& gpu_feature_info);
212 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle);
208 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); 213 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle);
209 #if defined(OS_ANDROID) 214 #if defined(OS_ANDROID)
210 void OnDestroyingVideoSurfaceAck(int surface_id); 215 void OnDestroyingVideoSurfaceAck(int surface_id);
211 #endif 216 #endif
212 void OnFieldTrialActivated(const std::string& trial_name); 217 void OnFieldTrialActivated(const std::string& trial_name);
213 218
214 void CreateChannelCache(int32_t client_id); 219 void CreateChannelCache(int32_t client_id);
215 220
216 bool LaunchGpuProcess(gpu::GpuPreferences* gpu_preferences); 221 bool LaunchGpuProcess(gpu::GpuPreferences* gpu_preferences);
217 222
218 void SendOutstandingReplies(); 223 void SendOutstandingReplies();
219 224
220 void BlockLiveOffscreenContexts(); 225 void BlockLiveOffscreenContexts();
221 226
222 // Update GPU crash counters. Disable GPU if crash limit is reached. 227 // Update GPU crash counters. Disable GPU if crash limit is reached.
223 void RecordProcessCrash(); 228 void RecordProcessCrash();
224 229
225 std::string GetShaderPrefixKey(const std::string& shader); 230 std::string GetShaderPrefixKey(const std::string& shader);
226 231
227 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. 232 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair.
228 int host_id_; 233 int host_id_;
229 234
230 // These are the channel requests that we have already sent to 235 // These are the channel requests that we have already sent to
231 // the GPU process, but haven't heard back about yet. 236 // the GPU process, but haven't heard back about yet.
232 std::queue<EstablishChannelCallback> channel_requests_; 237 std::queue<EstablishChannelRequest> channel_requests_;
233 238
234 // The pending create gpu memory buffer requests we need to reply to. 239 // The pending create gpu memory buffer requests we need to reply to.
235 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_; 240 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_;
236 241
237 // A callback to signal the completion of a SendDestroyingVideoSurface call. 242 // A callback to signal the completion of a SendDestroyingVideoSurface call.
238 base::Closure send_destroying_video_surface_done_cb_; 243 base::Closure send_destroying_video_surface_done_cb_;
239 244
240 // Qeueud messages to send when the process launches. 245 // Qeueud messages to send when the process launches.
241 std::queue<IPC::Message*> queued_messages_; 246 std::queue<IPC::Message*> queued_messages_;
242 247
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 typedef std::map<int32_t, scoped_refptr<gpu::ShaderDiskCache>> 294 typedef std::map<int32_t, scoped_refptr<gpu::ShaderDiskCache>>
290 ClientIdToShaderCacheMap; 295 ClientIdToShaderCacheMap;
291 ClientIdToShaderCacheMap client_id_to_shader_cache_; 296 ClientIdToShaderCacheMap client_id_to_shader_cache_;
292 297
293 std::string shader_prefix_key_info_; 298 std::string shader_prefix_key_info_;
294 299
295 ui::mojom::GpuMainAssociatedPtr gpu_main_ptr_; 300 ui::mojom::GpuMainAssociatedPtr gpu_main_ptr_;
296 ui::mojom::GpuServicePtr gpu_service_ptr_; 301 ui::mojom::GpuServicePtr gpu_service_ptr_;
297 mojo::Binding<ui::mojom::GpuHost> gpu_host_binding_; 302 mojo::Binding<ui::mojom::GpuHost> gpu_host_binding_;
298 303
299 base::WeakPtrFactory<GpuProcessHost> weak_ptr_factory_;
300
301 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); 304 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
302 }; 305 };
303 306
304 } // namespace content 307 } // namespace content
305 308
306 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ 309 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698