Chromium Code Reviews| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 | 58 |
| 59 // Destroy all remaining GpuProcessHostUIShims. | 59 // Destroy all remaining GpuProcessHostUIShims. |
| 60 CONTENT_EXPORT static void DestroyAll(); | 60 CONTENT_EXPORT static void DestroyAll(); |
| 61 | 61 |
| 62 CONTENT_EXPORT static GpuProcessHostUIShim* FromID(int host_id); | 62 CONTENT_EXPORT static GpuProcessHostUIShim* FromID(int host_id); |
| 63 | 63 |
| 64 // Get a GpuProcessHostUIShim instance; it doesn't matter which one. | 64 // Get a GpuProcessHostUIShim instance; it doesn't matter which one. |
| 65 // Return NULL if none has been created. | 65 // Return NULL if none has been created. |
| 66 CONTENT_EXPORT static GpuProcessHostUIShim* GetOneInstance(); | 66 CONTENT_EXPORT static GpuProcessHostUIShim* GetOneInstance(); |
| 67 | 67 |
| 68 // Stops the GPU process. | |
| 69 void StopGpuProcess(base::Closure callback); | |
|
Zhenyao Mo
2015/07/27 16:23:12
should callback be const reference type?
| |
| 70 | |
| 68 // IPC::Sender implementation. | 71 // IPC::Sender implementation. |
| 69 bool Send(IPC::Message* msg) override; | 72 bool Send(IPC::Message* msg) override; |
| 70 | 73 |
| 71 // IPC::Listener implementation. | 74 // IPC::Listener implementation. |
| 72 // 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 |
| 73 // dispatch the incoming messages from the GPU process, which are | 76 // dispatch the incoming messages from the GPU process, which are |
| 74 // actually received on the IO thread. | 77 // actually received on the IO thread. |
| 75 bool OnMessageReceived(const IPC::Message& message) override; | 78 bool OnMessageReceived(const IPC::Message& message) override; |
| 76 | 79 |
| 77 CONTENT_EXPORT void RelinquishGpuResources(const base::Closure& callback); | |
| 78 CONTENT_EXPORT void SimulateRemoveAllContext(); | 80 CONTENT_EXPORT void SimulateRemoveAllContext(); |
| 79 CONTENT_EXPORT void SimulateCrash(); | 81 CONTENT_EXPORT void SimulateCrash(); |
| 80 CONTENT_EXPORT void SimulateHang(); | 82 CONTENT_EXPORT void SimulateHang(); |
| 81 | 83 |
| 82 private: | 84 private: |
| 83 explicit GpuProcessHostUIShim(int host_id); | 85 explicit GpuProcessHostUIShim(int host_id); |
| 84 ~GpuProcessHostUIShim() override; | 86 ~GpuProcessHostUIShim() override; |
| 85 | 87 |
| 86 // Message handlers. | 88 // Message handlers. |
| 87 bool OnControlMessageReceived(const IPC::Message& message); | 89 bool OnControlMessageReceived(const IPC::Message& message); |
| 88 | 90 |
| 89 void OnLogMessage(int level, const std::string& header, | 91 void OnLogMessage(int level, const std::string& header, |
| 90 const std::string& message); | 92 const std::string& message); |
| 91 | 93 |
| 92 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); | 94 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); |
| 93 | 95 |
| 94 void OnAcceleratedSurfaceInitialized(int32 surface_id, int32 route_id); | 96 void OnAcceleratedSurfaceInitialized(int32 surface_id, int32 route_id); |
| 95 #if defined(OS_MACOSX) | 97 #if defined(OS_MACOSX) |
| 96 void OnAcceleratedSurfaceBuffersSwapped( | 98 void OnAcceleratedSurfaceBuffersSwapped( |
| 97 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); | 99 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); |
| 98 #endif | 100 #endif |
| 99 void OnVideoMemoryUsageStatsReceived( | 101 void OnVideoMemoryUsageStatsReceived( |
| 100 const GPUVideoMemoryUsageStats& video_memory_usage_stats); | 102 const GPUVideoMemoryUsageStats& video_memory_usage_stats); |
| 101 void OnResourcesRelinquished(); | |
| 102 void OnAddSubscription(int32 process_id, unsigned int target); | 103 void OnAddSubscription(int32 process_id, unsigned int target); |
| 103 void OnRemoveSubscription(int32 process_id, unsigned int target); | 104 void OnRemoveSubscription(int32 process_id, unsigned int target); |
| 104 | 105 |
| 105 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. | 106 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. |
| 106 int host_id_; | 107 int host_id_; |
| 107 base::Closure relinquish_callback_; | 108 base::Closure close_callback_; |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 } // namespace content | 111 } // namespace content |
| 111 | 112 |
| 112 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | 113 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
| OLD | NEW |