| 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_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 26 matching lines...) Expand all Loading... |
| 37 namespace IPC { | 37 namespace IPC { |
| 38 struct ChannelHandle; | 38 struct ChannelHandle; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace content { | 41 namespace content { |
| 42 class BrowserChildProcessHostImpl; | 42 class BrowserChildProcessHostImpl; |
| 43 class GpuMainThread; | 43 class GpuMainThread; |
| 44 class RenderWidgetHostViewFrameSubscriber; | 44 class RenderWidgetHostViewFrameSubscriber; |
| 45 class ShaderDiskCache; | 45 class ShaderDiskCache; |
| 46 | 46 |
| 47 typedef base::Thread* (*GpuMainThreadFactoryFunction)(const std::string& id); |
| 48 |
| 47 class GpuProcessHost : public BrowserChildProcessHostDelegate, | 49 class GpuProcessHost : public BrowserChildProcessHostDelegate, |
| 48 public IPC::Sender, | 50 public IPC::Sender, |
| 49 public base::NonThreadSafe { | 51 public base::NonThreadSafe { |
| 50 public: | 52 public: |
| 51 enum GpuProcessKind { | 53 enum GpuProcessKind { |
| 52 GPU_PROCESS_KIND_UNSANDBOXED, | 54 GPU_PROCESS_KIND_UNSANDBOXED, |
| 53 GPU_PROCESS_KIND_SANDBOXED, | 55 GPU_PROCESS_KIND_SANDBOXED, |
| 54 GPU_PROCESS_KIND_COUNT | 56 GPU_PROCESS_KIND_COUNT |
| 55 }; | 57 }; |
| 56 | 58 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 75 static void GetProcessHandles( | 77 static void GetProcessHandles( |
| 76 const GpuDataManager::GetGpuProcessHandlesCallback& callback); | 78 const GpuDataManager::GetGpuProcessHandlesCallback& callback); |
| 77 | 79 |
| 78 // Helper function to send the given message to the GPU process on the IO | 80 // Helper function to send the given message to the GPU process on the IO |
| 79 // thread. Calls Get and if a host is returned, sends it. Can be called from | 81 // thread. Calls Get and if a host is returned, sends it. Can be called from |
| 80 // any thread. Deletes the message if it cannot be sent. | 82 // any thread. Deletes the message if it cannot be sent. |
| 81 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, | 83 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, |
| 82 CauseForGpuLaunch cause, | 84 CauseForGpuLaunch cause, |
| 83 IPC::Message* message); | 85 IPC::Message* message); |
| 84 | 86 |
| 87 CONTENT_EXPORT static void RegisterGpuMainThreadFactory( |
| 88 GpuMainThreadFactoryFunction create); |
| 89 |
| 85 // Get the GPU process host for the GPU process with the given ID. Returns | 90 // Get the GPU process host for the GPU process with the given ID. Returns |
| 86 // null if the process no longer exists. | 91 // null if the process no longer exists. |
| 87 static GpuProcessHost* FromID(int host_id); | 92 static GpuProcessHost* FromID(int host_id); |
| 88 int host_id() const { return host_id_; } | 93 int host_id() const { return host_id_; } |
| 89 | 94 |
| 90 // IPC::Sender implementation. | 95 // IPC::Sender implementation. |
| 91 virtual bool Send(IPC::Message* msg) OVERRIDE; | 96 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 92 | 97 |
| 93 // Adds a message filter to the GpuProcessHost's channel. | 98 // Adds a message filter to the GpuProcessHost's channel. |
| 94 void AddFilter(IPC::ChannelProxy::MessageFilter* filter); | 99 void AddFilter(IPC::ChannelProxy::MessageFilter* filter); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // Whether the GPU process is valid, set to false after Send() failed. | 212 // Whether the GPU process is valid, set to false after Send() failed. |
| 208 bool valid_; | 213 bool valid_; |
| 209 | 214 |
| 210 // Whether we are running a GPU thread inside the browser process instead | 215 // Whether we are running a GPU thread inside the browser process instead |
| 211 // of a separate GPU process. | 216 // of a separate GPU process. |
| 212 bool in_process_; | 217 bool in_process_; |
| 213 | 218 |
| 214 bool swiftshader_rendering_; | 219 bool swiftshader_rendering_; |
| 215 GpuProcessKind kind_; | 220 GpuProcessKind kind_; |
| 216 | 221 |
| 217 #if !defined(CHROME_MULTIPLE_DLL) | 222 scoped_ptr<base::Thread> in_process_gpu_thread_; |
| 218 scoped_ptr<GpuMainThread> in_process_gpu_thread_; | |
| 219 #endif | |
| 220 | 223 |
| 221 // Whether we actually launched a GPU process. | 224 // Whether we actually launched a GPU process. |
| 222 bool process_launched_; | 225 bool process_launched_; |
| 223 | 226 |
| 224 // Whether the GPU process successfully initialized. | 227 // Whether the GPU process successfully initialized. |
| 225 bool initialized_; | 228 bool initialized_; |
| 226 | 229 |
| 227 // Time Init started. Used to log total GPU process startup time to UMA. | 230 // Time Init started. Used to log total GPU process startup time to UMA. |
| 228 base::TimeTicks init_start_time_; | 231 base::TimeTicks init_start_time_; |
| 229 | 232 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > | 269 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > |
| 267 SurfaceRefMap; | 270 SurfaceRefMap; |
| 268 SurfaceRefMap surface_refs_; | 271 SurfaceRefMap surface_refs_; |
| 269 | 272 |
| 270 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 273 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 271 }; | 274 }; |
| 272 | 275 |
| 273 } // namespace content | 276 } // namespace content |
| 274 | 277 |
| 275 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 278 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |