OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
11 | 11 |
12 #include "base/callback_old.h" | 12 #include "base/callback_old.h" |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
15 #include "content/browser/browser_child_process_host.h" | 15 #include "content/browser/browser_child_process_host.h" |
16 #include "content/common/gpu/gpu_info.h" | 16 #include "content/common/gpu/gpu_info.h" |
17 #include "content/common/gpu/gpu_process_launch_causes.h" | 17 #include "content/common/gpu/gpu_process_launch_causes.h" |
18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
19 | 19 |
20 struct GPUCreateCommandBufferConfig; | 20 struct GPUCreateCommandBufferConfig; |
21 | 21 |
22 namespace IPC { | 22 namespace IPC { |
23 class Message; | 23 class Message; |
24 } | 24 } |
25 | 25 |
| 26 class GpuMainThread; |
| 27 |
26 class GpuProcessHost : public BrowserChildProcessHost, | 28 class GpuProcessHost : public BrowserChildProcessHost, |
27 public base::NonThreadSafe { | 29 public base::NonThreadSafe { |
28 public: | 30 public: |
29 // Creates a new GpuProcessHost or gets one for a particular | 31 // Creates a new GpuProcessHost or gets one for a particular |
30 // renderer process, resulting in the launching of a GPU process if required. | 32 // renderer process, resulting in the launching of a GPU process if required. |
31 // Returns null on failure. It is not safe to store the pointer once control | 33 // Returns null on failure. It is not safe to store the pointer once control |
32 // has returned to the message loop as it can be destroyed. Instead store the | 34 // has returned to the message loop as it can be destroyed. Instead store the |
33 // associated GPU host ID. A renderer ID of zero means the browser process. | 35 // associated GPU host ID. A renderer ID of zero means the browser process. |
34 // This could return NULL if GPU access is not allowed (blacklisted). | 36 // This could return NULL if GPU access is not allowed (blacklisted). |
35 static GpuProcessHost* GetForRenderer(int renderer_id, | 37 static GpuProcessHost* GetForRenderer(int renderer_id, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 typedef std::multimap<ViewID, linked_ptr<SurfaceRef> > SurfaceRefMap; | 146 typedef std::multimap<ViewID, linked_ptr<SurfaceRef> > SurfaceRefMap; |
145 SurfaceRefMap surface_refs_; | 147 SurfaceRefMap surface_refs_; |
146 #endif | 148 #endif |
147 | 149 |
148 // Qeueud messages to send when the process launches. | 150 // Qeueud messages to send when the process launches. |
149 std::queue<IPC::Message*> queued_messages_; | 151 std::queue<IPC::Message*> queued_messages_; |
150 | 152 |
151 // The handle for the GPU process or null if it is not known to be launched. | 153 // The handle for the GPU process or null if it is not known to be launched. |
152 base::ProcessHandle gpu_process_; | 154 base::ProcessHandle gpu_process_; |
153 | 155 |
| 156 // Whether we are running a GPU thread inside the browser process instead |
| 157 // of a separate GPU process. |
| 158 bool in_process_; |
| 159 |
| 160 scoped_ptr<GpuMainThread> in_process_gpu_thread_; |
| 161 |
154 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 162 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
155 }; | 163 }; |
156 | 164 |
157 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 165 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |