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 23 matching lines...) Expand all Loading... |
34 public IPC::Message::Sender, | 34 public IPC::Message::Sender, |
35 public base::NonThreadSafe { | 35 public base::NonThreadSafe { |
36 public: | 36 public: |
37 enum GpuProcessKind { | 37 enum GpuProcessKind { |
38 GPU_PROCESS_KIND_UNSANDBOXED, | 38 GPU_PROCESS_KIND_UNSANDBOXED, |
39 GPU_PROCESS_KIND_SANDBOXED, | 39 GPU_PROCESS_KIND_SANDBOXED, |
40 GPU_PROCESS_KIND_COUNT | 40 GPU_PROCESS_KIND_COUNT |
41 }; | 41 }; |
42 | 42 |
43 typedef base::Callback<void(const IPC::ChannelHandle&, | 43 typedef base::Callback<void(const IPC::ChannelHandle&, |
| 44 base::ProcessHandle, |
44 const content::GPUInfo&)> | 45 const content::GPUInfo&)> |
45 EstablishChannelCallback; | 46 EstablishChannelCallback; |
46 | 47 |
47 typedef base::Callback<void(int32)> CreateCommandBufferCallback; | 48 typedef base::Callback<void(int32)> CreateCommandBufferCallback; |
48 | 49 |
49 static bool gpu_enabled() { return gpu_enabled_; } | 50 static bool gpu_enabled() { return gpu_enabled_; } |
50 | 51 |
51 // Creates a new GpuProcessHost or gets an existing one, resulting in the | 52 // Creates a new GpuProcessHost or gets an existing one, resulting in the |
52 // launching of a GPU process if required. Returns null on failure. It | 53 // launching of a GPU process if required. Returns null on failure. It |
53 // is not safe to store the pointer once control has returned to the message | 54 // is not safe to store the pointer once control has returned to the message |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Multimap is used to simulate reference counting, see comment in | 158 // Multimap is used to simulate reference counting, see comment in |
158 // GpuProcessHostUIShim::CreateViewCommandBuffer. | 159 // GpuProcessHostUIShim::CreateViewCommandBuffer. |
159 class SurfaceRef; | 160 class SurfaceRef; |
160 typedef std::multimap<int, linked_ptr<SurfaceRef> > SurfaceRefMap; | 161 typedef std::multimap<int, linked_ptr<SurfaceRef> > SurfaceRefMap; |
161 SurfaceRefMap surface_refs_; | 162 SurfaceRefMap surface_refs_; |
162 #endif | 163 #endif |
163 | 164 |
164 // Qeueud messages to send when the process launches. | 165 // Qeueud messages to send when the process launches. |
165 std::queue<IPC::Message*> queued_messages_; | 166 std::queue<IPC::Message*> queued_messages_; |
166 | 167 |
| 168 // The handle for the GPU process or null if it is not known to be launched. |
| 169 base::ProcessHandle gpu_process_; |
| 170 |
167 // Whether we are running a GPU thread inside the browser process instead | 171 // Whether we are running a GPU thread inside the browser process instead |
168 // of a separate GPU process. | 172 // of a separate GPU process. |
169 bool in_process_; | 173 bool in_process_; |
170 | 174 |
171 bool software_rendering_; | 175 bool software_rendering_; |
172 GpuProcessKind kind_; | 176 GpuProcessKind kind_; |
173 | 177 |
174 scoped_ptr<GpuMainThread> in_process_gpu_thread_; | 178 scoped_ptr<GpuMainThread> in_process_gpu_thread_; |
175 | 179 |
176 // Whether we actually launched a GPU process. | 180 // Whether we actually launched a GPU process. |
177 bool process_launched_; | 181 bool process_launched_; |
178 | 182 |
179 // Time Init started. Used to log total GPU process startup time to UMA. | 183 // Time Init started. Used to log total GPU process startup time to UMA. |
180 base::TimeTicks init_start_time_; | 184 base::TimeTicks init_start_time_; |
181 | 185 |
182 // Master switch for enabling/disabling GPU acceleration for the current | 186 // Master switch for enabling/disabling GPU acceleration for the current |
183 // browser session. It does not change the acceleration settings for | 187 // browser session. It does not change the acceleration settings for |
184 // existing tabs, just the future ones. | 188 // existing tabs, just the future ones. |
185 static bool gpu_enabled_; | 189 static bool gpu_enabled_; |
186 | 190 |
187 static bool hardware_gpu_enabled_; | 191 static bool hardware_gpu_enabled_; |
188 | 192 |
189 scoped_ptr<BrowserChildProcessHostImpl> process_; | 193 scoped_ptr<BrowserChildProcessHostImpl> process_; |
190 | 194 |
191 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 195 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
192 }; | 196 }; |
193 | 197 |
194 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 198 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |