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> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
15 #include "base/process.h" | 15 #include "base/process.h" |
16 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/common/gpu/gpu_process_launch_causes.h" | 19 #include "content/common/gpu/gpu_process_launch_causes.h" |
20 #include "content/public/browser/browser_child_process_host_delegate.h" | 20 #include "content/public/browser/browser_child_process_host_delegate.h" |
21 #include "content/public/common/gpu_info.h" | 21 #include "content/public/common/gpu_info.h" |
22 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_sender.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 | 32 |
33 namespace IPC { | 33 namespace IPC { |
34 struct ChannelHandle; | 34 struct ChannelHandle; |
35 } | 35 } |
36 | 36 |
37 class GpuProcessHost : public content::BrowserChildProcessHostDelegate, | 37 class GpuProcessHost : public content::BrowserChildProcessHostDelegate, |
38 public IPC::Message::Sender, | 38 public IPC::Sender, |
39 public base::NonThreadSafe { | 39 public base::NonThreadSafe { |
40 public: | 40 public: |
41 enum GpuProcessKind { | 41 enum GpuProcessKind { |
42 GPU_PROCESS_KIND_UNSANDBOXED, | 42 GPU_PROCESS_KIND_UNSANDBOXED, |
43 GPU_PROCESS_KIND_SANDBOXED, | 43 GPU_PROCESS_KIND_SANDBOXED, |
44 GPU_PROCESS_KIND_COUNT | 44 GPU_PROCESS_KIND_COUNT |
45 }; | 45 }; |
46 | 46 |
47 typedef base::Callback<void(const IPC::ChannelHandle&, | 47 typedef base::Callback<void(const IPC::ChannelHandle&, |
48 const content::GPUInfo&)> | 48 const content::GPUInfo&)> |
(...skipping 16 matching lines...) Expand all Loading... |
65 // any thread. | 65 // any thread. |
66 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, | 66 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, |
67 content::CauseForGpuLaunch cause, | 67 content::CauseForGpuLaunch cause, |
68 IPC::Message* message); | 68 IPC::Message* message); |
69 | 69 |
70 // Get the GPU process host for the GPU process with the given ID. Returns | 70 // Get the GPU process host for the GPU process with the given ID. Returns |
71 // null if the process no longer exists. | 71 // null if the process no longer exists. |
72 static GpuProcessHost* FromID(int host_id); | 72 static GpuProcessHost* FromID(int host_id); |
73 int host_id() const { return host_id_; } | 73 int host_id() const { return host_id_; } |
74 | 74 |
75 // IPC::Message::Sender implementation. | 75 // IPC::Sender implementation. |
76 virtual bool Send(IPC::Message* msg) OVERRIDE; | 76 virtual bool Send(IPC::Message* msg) OVERRIDE; |
77 | 77 |
78 // Tells the GPU process to create a new channel for communication with a | 78 // Tells the GPU process to create a new channel for communication with a |
79 // client. Once the GPU process responds asynchronously with the IPC handle | 79 // client. Once the GPU process responds asynchronously with the IPC handle |
80 // and GPUInfo, we call the callback. | 80 // and GPUInfo, we call the callback. |
81 void EstablishGpuChannel(int client_id, | 81 void EstablishGpuChannel(int client_id, |
82 bool share_context, | 82 bool share_context, |
83 const EstablishChannelCallback& callback); | 83 const EstablishChannelCallback& callback); |
84 | 84 |
85 // Tells the GPU process to create a new command buffer that draws into the | 85 // Tells the GPU process to create a new command buffer that draws into the |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 static bool gpu_enabled_; | 193 static bool gpu_enabled_; |
194 | 194 |
195 static bool hardware_gpu_enabled_; | 195 static bool hardware_gpu_enabled_; |
196 | 196 |
197 scoped_ptr<BrowserChildProcessHostImpl> process_; | 197 scoped_ptr<BrowserChildProcessHostImpl> process_; |
198 | 198 |
199 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 199 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
200 }; | 200 }; |
201 | 201 |
202 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 202 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |