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 // TODO(derekjchow): Make this API prettier. | |
|
halliwell
2015/07/25 17:00:38
I don't understand the TODO, can you elaborate?
derekjchow1
2015/07/28 16:14:57
Done.
| |
| 70 void StopGpuProcess(base::Closure callback); | |
| 71 | |
| 68 // IPC::Sender implementation. | 72 // IPC::Sender implementation. |
| 69 bool Send(IPC::Message* msg) override; | 73 bool Send(IPC::Message* msg) override; |
| 70 | 74 |
| 71 // IPC::Listener implementation. | 75 // IPC::Listener implementation. |
| 72 // The GpuProcessHost causes this to be called on the UI thread to | 76 // The GpuProcessHost causes this to be called on the UI thread to |
| 73 // dispatch the incoming messages from the GPU process, which are | 77 // dispatch the incoming messages from the GPU process, which are |
| 74 // actually received on the IO thread. | 78 // actually received on the IO thread. |
| 75 bool OnMessageReceived(const IPC::Message& message) override; | 79 bool OnMessageReceived(const IPC::Message& message) override; |
| 76 | 80 |
| 77 CONTENT_EXPORT void RelinquishGpuResources(const base::Closure& callback); | |
| 78 CONTENT_EXPORT void SimulateRemoveAllContext(); | 81 CONTENT_EXPORT void SimulateRemoveAllContext(); |
| 79 CONTENT_EXPORT void SimulateCrash(); | 82 CONTENT_EXPORT void SimulateCrash(); |
| 80 CONTENT_EXPORT void SimulateHang(); | 83 CONTENT_EXPORT void SimulateHang(); |
| 81 | 84 |
| 82 private: | 85 private: |
| 83 explicit GpuProcessHostUIShim(int host_id); | 86 explicit GpuProcessHostUIShim(int host_id); |
| 84 ~GpuProcessHostUIShim() override; | 87 ~GpuProcessHostUIShim() override; |
| 85 | 88 |
| 86 // Message handlers. | 89 // Message handlers. |
| 87 bool OnControlMessageReceived(const IPC::Message& message); | 90 bool OnControlMessageReceived(const IPC::Message& message); |
| 88 | 91 |
| 89 void OnLogMessage(int level, const std::string& header, | 92 void OnLogMessage(int level, const std::string& header, |
| 90 const std::string& message); | 93 const std::string& message); |
| 91 | 94 |
| 92 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); | 95 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); |
| 93 | 96 |
| 94 void OnAcceleratedSurfaceInitialized(int32 surface_id, int32 route_id); | 97 void OnAcceleratedSurfaceInitialized(int32 surface_id, int32 route_id); |
| 95 #if defined(OS_MACOSX) | 98 #if defined(OS_MACOSX) |
| 96 void OnAcceleratedSurfaceBuffersSwapped( | 99 void OnAcceleratedSurfaceBuffersSwapped( |
| 97 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); | 100 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); |
| 98 #endif | 101 #endif |
| 99 void OnVideoMemoryUsageStatsReceived( | 102 void OnVideoMemoryUsageStatsReceived( |
| 100 const GPUVideoMemoryUsageStats& video_memory_usage_stats); | 103 const GPUVideoMemoryUsageStats& video_memory_usage_stats); |
| 101 void OnResourcesRelinquished(); | |
| 102 void OnAddSubscription(int32 process_id, unsigned int target); | 104 void OnAddSubscription(int32 process_id, unsigned int target); |
| 103 void OnRemoveSubscription(int32 process_id, unsigned int target); | 105 void OnRemoveSubscription(int32 process_id, unsigned int target); |
| 104 | 106 |
| 105 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. | 107 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. |
| 106 int host_id_; | 108 int host_id_; |
| 107 base::Closure relinquish_callback_; | 109 base::Closure close_callback_; |
| 108 }; | 110 }; |
| 109 | 111 |
| 110 } // namespace content | 112 } // namespace content |
| 111 | 113 |
| 112 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | 114 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
| OLD | NEW |