Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_message.h" |
| 23 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
| 24 | 24 |
| 25 class GpuMainThread; | 25 class GpuMainThread; |
| 26 struct GPUCreateCommandBufferConfig; | 26 struct GPUCreateCommandBufferConfig; |
| 27 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 27 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 28 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; | 28 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; |
| 29 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; | 29 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; |
| 30 | 30 |
| 31 class BrowserChildProcessHostImpl; | 31 class BrowserChildProcessHostImpl; |
| 32 class RenderWidgetHelper; | |
| 32 | 33 |
| 33 class GpuProcessHost : public content::BrowserChildProcessHostDelegate, | 34 class GpuProcessHost : public content::BrowserChildProcessHostDelegate, |
| 34 public IPC::Message::Sender, | 35 public IPC::Message::Sender, |
| 35 public base::NonThreadSafe { | 36 public base::NonThreadSafe { |
| 36 public: | 37 public: |
| 37 enum GpuProcessKind { | 38 enum GpuProcessKind { |
| 38 GPU_PROCESS_KIND_UNSANDBOXED, | 39 GPU_PROCESS_KIND_UNSANDBOXED, |
| 39 GPU_PROCESS_KIND_SANDBOXED, | 40 GPU_PROCESS_KIND_SANDBOXED, |
| 40 GPU_PROCESS_KIND_COUNT | 41 GPU_PROCESS_KIND_COUNT |
| 41 }; | 42 }; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 const CreateCommandBufferCallback& callback); | 89 const CreateCommandBufferCallback& callback); |
| 89 | 90 |
| 90 // Whether this GPU process is set up to use software rendering. | 91 // Whether this GPU process is set up to use software rendering. |
| 91 bool software_rendering(); | 92 bool software_rendering(); |
| 92 | 93 |
| 93 // What kind of GPU process, e.g. sandboxed or unsandboxed. | 94 // What kind of GPU process, e.g. sandboxed or unsandboxed. |
| 94 GpuProcessKind kind(); | 95 GpuProcessKind kind(); |
| 95 | 96 |
| 96 void ForceShutdown(); | 97 void ForceShutdown(); |
| 97 | 98 |
| 99 void RegisterRenderWidgetHelper( | |
| 100 int render_process_id, | |
| 101 const scoped_refptr<RenderWidgetHelper>& render_widget_helper); | |
| 102 | |
| 103 void UnregisterRenderWidgetHelper(int render_process_id); | |
| 104 | |
| 98 private: | 105 private: |
| 99 static bool HostIsValid(GpuProcessHost* host); | 106 static bool HostIsValid(GpuProcessHost* host); |
| 100 | 107 |
| 101 GpuProcessHost(int host_id, GpuProcessKind kind); | 108 GpuProcessHost(int host_id, GpuProcessKind kind); |
| 102 virtual ~GpuProcessHost(); | 109 virtual ~GpuProcessHost(); |
| 103 | 110 |
| 104 bool Init(); | 111 bool Init(); |
| 105 | 112 |
| 106 // Post an IPC message to the UI shim's message handler on the UI thread. | 113 // Post an IPC message to the UI shim's message handler on the UI thread. |
| 107 void RouteOnUIThread(const IPC::Message& message); | 114 void RouteOnUIThread(const IPC::Message& message); |
| 108 | 115 |
| 109 // BrowserChildProcessHostDelegate implementation. | 116 // BrowserChildProcessHostDelegate implementation. |
| 110 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 117 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 111 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 118 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
| 112 virtual void OnProcessLaunched() OVERRIDE; | 119 virtual void OnProcessLaunched() OVERRIDE; |
| 113 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 120 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
| 114 | 121 |
| 115 // Message handlers. | 122 // Message handlers. |
| 116 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 123 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
| 117 void OnCommandBufferCreated(const int32 route_id); | 124 void OnCommandBufferCreated(const int32 route_id); |
| 118 void OnDestroyCommandBuffer(int32 surface_id); | 125 void OnDestroyCommandBuffer(int32 surface_id); |
| 119 | 126 |
| 127 #if defined(OS_MACOSX) | |
| 128 void OnAcceleratedSurfaceBuffersSwapped( | |
| 129 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); | |
| 130 #endif | |
| 120 #if defined(OS_WIN) && !defined(USE_AURA) | 131 #if defined(OS_WIN) && !defined(USE_AURA) |
| 121 void OnAcceleratedSurfaceBuffersSwapped( | 132 void OnAcceleratedSurfaceBuffersSwapped( |
| 122 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); | 133 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); |
| 123 void OnAcceleratedSurfacePostSubBuffer( | 134 void OnAcceleratedSurfacePostSubBuffer( |
| 124 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params); | 135 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params); |
| 125 void OnAcceleratedSurfaceSuspend(int32 surface_id); | 136 void OnAcceleratedSurfaceSuspend(int32 surface_id); |
| 126 void OnAcceleratedSurfaceRelease( | 137 void OnAcceleratedSurfaceRelease( |
| 127 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params); | 138 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params); |
| 128 #endif | 139 #endif |
| 129 | 140 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 | 192 |
| 182 // Master switch for enabling/disabling GPU acceleration for the current | 193 // Master switch for enabling/disabling GPU acceleration for the current |
| 183 // browser session. It does not change the acceleration settings for | 194 // browser session. It does not change the acceleration settings for |
| 184 // existing tabs, just the future ones. | 195 // existing tabs, just the future ones. |
| 185 static bool gpu_enabled_; | 196 static bool gpu_enabled_; |
| 186 | 197 |
| 187 static bool hardware_gpu_enabled_; | 198 static bool hardware_gpu_enabled_; |
| 188 | 199 |
| 189 scoped_ptr<BrowserChildProcessHostImpl> process_; | 200 scoped_ptr<BrowserChildProcessHostImpl> process_; |
| 190 | 201 |
| 202 std::map<int, scoped_refptr<RenderWidgetHelper> > render_widget_helpers_; | |
|
piman
2012/04/18 21:07:44
Is this map really necessary? There's already a re
jbates
2012/04/18 23:01:58
Sadly RenderProcessHost::FromID is UI thread only
piman
2012/04/18 23:32:22
You can have >1 GpuProcessHost because the teardow
jbates
2012/04/19 01:24:18
Hmm, a scoped_refptr with an externally owned raw
| |
| 203 | |
| 191 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 204 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 192 }; | 205 }; |
| 193 | 206 |
| 194 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 207 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |