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