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_UI_SHIM_H_ | 5 #ifndef CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | 6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
7 | 7 |
8 // This class lives on the UI thread and supports classes like the | 8 // This class lives on the UI thread and supports classes like the |
9 // BackingStoreProxy, which must live on the UI thread. The IO thread | 9 // BackingStoreProxy, which must live on the UI thread. The IO thread |
10 // portion of this class, the GpuProcessHost, is responsible for | 10 // portion of this class, the GpuProcessHost, is responsible for |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 // Destroy all remaining GpuProcessHostUIShims. | 62 // Destroy all remaining GpuProcessHostUIShims. |
63 CONTENT_EXPORT static void DestroyAll(); | 63 CONTENT_EXPORT static void DestroyAll(); |
64 | 64 |
65 CONTENT_EXPORT static GpuProcessHostUIShim* FromID(int host_id); | 65 CONTENT_EXPORT static GpuProcessHostUIShim* FromID(int host_id); |
66 | 66 |
67 // Get a GpuProcessHostUIShim instance; it doesn't matter which one. | 67 // Get a GpuProcessHostUIShim instance; it doesn't matter which one. |
68 // Return NULL if none has been created. | 68 // Return NULL if none has been created. |
69 CONTENT_EXPORT static GpuProcessHostUIShim* GetOneInstance(); | 69 CONTENT_EXPORT static GpuProcessHostUIShim* GetOneInstance(); |
70 | 70 |
71 // Stops the GPU process. | |
72 CONTENT_EXPORT void StopGpuProcess(const base::Closure& callback); | |
73 | |
74 // IPC::Sender implementation. | 71 // IPC::Sender implementation. |
75 bool Send(IPC::Message* msg) override; | 72 bool Send(IPC::Message* msg) override; |
76 | 73 |
77 // IPC::Listener implementation. | 74 // IPC::Listener implementation. |
78 // The GpuProcessHost causes this to be called on the UI thread to | 75 // The GpuProcessHost causes this to be called on the UI thread to |
79 // dispatch the incoming messages from the GPU process, which are | 76 // dispatch the incoming messages from the GPU process, which are |
80 // actually received on the IO thread. | 77 // actually received on the IO thread. |
81 bool OnMessageReceived(const IPC::Message& message) override; | 78 bool OnMessageReceived(const IPC::Message& message) override; |
82 | 79 |
83 CONTENT_EXPORT void SimulateRemoveAllContext(); | 80 CONTENT_EXPORT void SimulateRemoveAllContext(); |
84 CONTENT_EXPORT void SimulateCrash(); | 81 CONTENT_EXPORT void SimulateCrash(); |
85 CONTENT_EXPORT void SimulateHang(); | 82 CONTENT_EXPORT void SimulateHang(); |
86 | 83 |
87 private: | 84 private: |
88 explicit GpuProcessHostUIShim(int host_id); | 85 explicit GpuProcessHostUIShim(int host_id); |
89 ~GpuProcessHostUIShim() override; | 86 ~GpuProcessHostUIShim() override; |
90 | 87 |
91 // Message handlers. | 88 // Message handlers. |
92 bool OnControlMessageReceived(const IPC::Message& message); | 89 bool OnControlMessageReceived(const IPC::Message& message); |
93 void OnLogMessage(int level, const std::string& header, | 90 void OnLogMessage(int level, const std::string& header, |
94 const std::string& message); | 91 const std::string& message); |
95 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); | 92 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); |
96 void OnVideoMemoryUsageStatsReceived( | 93 void OnVideoMemoryUsageStatsReceived( |
97 const gpu::VideoMemoryUsageStats& video_memory_usage_stats); | 94 const gpu::VideoMemoryUsageStats& video_memory_usage_stats); |
98 | 95 |
99 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. | 96 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. |
100 int host_id_; | 97 int host_id_; |
101 base::Closure close_callback_; | |
102 }; | 98 }; |
103 | 99 |
104 } // namespace content | 100 } // namespace content |
105 | 101 |
106 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | 102 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
OLD | NEW |