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