OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_GPU_PROCESS_HOST_H_ |
6 #define CONTENT_BROWSER_GPU_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_GPU_PROCESS_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
| 10 #include "chrome/common/gpu_feature_flags.h" |
10 #include "content/browser/browser_child_process_host.h" | 11 #include "content/browser/browser_child_process_host.h" |
11 | 12 |
12 namespace IPC { | 13 namespace IPC { |
13 class Message; | 14 class Message; |
14 } | 15 } |
15 | 16 |
16 class GpuProcessHost : public BrowserChildProcessHost, | 17 class GpuProcessHost : public BrowserChildProcessHost, |
17 public base::NonThreadSafe { | 18 public base::NonThreadSafe { |
18 public: | 19 public: |
19 | 20 |
20 // Create a GpuProcessHost with the given ID. The object can be found using | 21 // Create a GpuProcessHost with the given ID. The object can be found using |
21 // FromID with the same id. | 22 // FromID with the same id. |
22 static GpuProcessHost* Create(int host_id); | 23 static GpuProcessHost* Create( |
| 24 int host_id, |
| 25 const GpuFeatureFlags& gpu_feature_flags); |
23 | 26 |
24 // Get the GPU process host for the GPU process with the given ID. Returns | 27 // Get the GPU process host for the GPU process with the given ID. Returns |
25 // null if the process no longer exists. | 28 // null if the process no longer exists. |
26 static GpuProcessHost* FromID(int host_id); | 29 static GpuProcessHost* FromID(int host_id); |
27 | 30 |
28 virtual bool Send(IPC::Message* msg); | 31 virtual bool Send(IPC::Message* msg); |
29 | 32 |
30 // IPC::Channel::Listener implementation. | 33 // IPC::Channel::Listener implementation. |
31 virtual bool OnMessageReceived(const IPC::Message& message); | 34 virtual bool OnMessageReceived(const IPC::Message& message); |
32 | 35 |
33 private: | 36 private: |
34 explicit GpuProcessHost(int host_id); | 37 explicit GpuProcessHost( |
| 38 int host_id, |
| 39 const GpuFeatureFlags& gpu_feature_flags); |
35 virtual ~GpuProcessHost(); | 40 virtual ~GpuProcessHost(); |
36 bool Init(); | 41 bool Init(); |
37 | 42 |
38 // Post an IPC message to the UI shim's message handler on the UI thread. | 43 // Post an IPC message to the UI shim's message handler on the UI thread. |
39 void RouteOnUIThread(const IPC::Message& message); | 44 void RouteOnUIThread(const IPC::Message& message); |
40 | 45 |
41 virtual bool CanShutdown(); | 46 virtual bool CanShutdown(); |
42 virtual void OnProcessLaunched(); | 47 virtual void OnProcessLaunched(); |
43 virtual void OnChildDied(); | 48 virtual void OnChildDied(); |
44 virtual void OnProcessCrashed(int exit_code); | 49 virtual void OnProcessCrashed(int exit_code); |
45 | 50 |
46 bool CanLaunchGpuProcess() const; | 51 bool CanLaunchGpuProcess() const; |
47 bool LaunchGpuProcess(); | 52 bool LaunchGpuProcess(); |
48 | 53 |
49 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. | 54 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. |
50 int host_id_; | 55 int host_id_; |
51 | 56 |
| 57 GpuFeatureFlags gpu_feature_flags_; |
| 58 |
52 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 59 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
53 }; | 60 }; |
54 | 61 |
55 #endif // CONTENT_BROWSER_GPU_PROCESS_HOST_H_ | 62 #endif // CONTENT_BROWSER_GPU_PROCESS_HOST_H_ |
OLD | NEW |