| 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 17 matching lines...) Expand all Loading... |
| 28 #include "ipc/message_router.h" | 28 #include "ipc/message_router.h" |
| 29 | 29 |
| 30 namespace IPC { | 30 namespace IPC { |
| 31 class Message; | 31 class Message; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace gpu { | 34 namespace gpu { |
| 35 struct VideoMemoryUsageStats; | 35 struct VideoMemoryUsageStats; |
| 36 } | 36 } |
| 37 | 37 |
| 38 namespace service_manager { |
| 39 class InterfaceRegistry; |
| 40 } |
| 41 |
| 38 namespace content { | 42 namespace content { |
| 39 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg); | 43 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg); |
| 40 | 44 |
| 41 class GpuProcessHostUIShim : public IPC::Listener, | 45 class GpuProcessHostUIShim : public IPC::Listener, |
| 42 public IPC::Sender, | 46 public IPC::Sender, |
| 43 public base::NonThreadSafe { | 47 public base::NonThreadSafe { |
| 44 public: | 48 public: |
| 45 // Create a GpuProcessHostUIShim with the given ID. The object can be found | 49 // Create a GpuProcessHostUIShim with the given ID. The object can be found |
| 46 // using FromID with the same id. | 50 // using FromID with the same id. |
| 47 static GpuProcessHostUIShim* Create(int host_id); | 51 static GpuProcessHostUIShim* Create(int host_id); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 72 // actually received on the IO thread. | 76 // actually received on the IO thread. |
| 73 bool OnMessageReceived(const IPC::Message& message) override; | 77 bool OnMessageReceived(const IPC::Message& message) override; |
| 74 | 78 |
| 75 CONTENT_EXPORT void SimulateRemoveAllContext(); | 79 CONTENT_EXPORT void SimulateRemoveAllContext(); |
| 76 CONTENT_EXPORT void SimulateCrash(); | 80 CONTENT_EXPORT void SimulateCrash(); |
| 77 CONTENT_EXPORT void SimulateHang(); | 81 CONTENT_EXPORT void SimulateHang(); |
| 78 #if defined(OS_ANDROID) | 82 #if defined(OS_ANDROID) |
| 79 CONTENT_EXPORT void SimulateJavaCrash(); | 83 CONTENT_EXPORT void SimulateJavaCrash(); |
| 80 #endif | 84 #endif |
| 81 | 85 |
| 86 #if defined(OS_ANDROID) |
| 87 // Register Mojo interfaces that must be bound on the UI thread. |
| 88 static void RegisterUIThreadMojoInterfaces( |
| 89 service_manager::InterfaceRegistry* registry); |
| 90 #endif |
| 91 |
| 82 private: | 92 private: |
| 83 explicit GpuProcessHostUIShim(int host_id); | 93 explicit GpuProcessHostUIShim(int host_id); |
| 84 ~GpuProcessHostUIShim() override; | 94 ~GpuProcessHostUIShim() override; |
| 85 | 95 |
| 86 // Message handlers. | 96 // Message handlers. |
| 87 bool OnControlMessageReceived(const IPC::Message& message); | 97 bool OnControlMessageReceived(const IPC::Message& message); |
| 88 void OnLogMessage(int level, const std::string& header, | 98 void OnLogMessage(int level, const std::string& header, |
| 89 const std::string& message); | 99 const std::string& message); |
| 90 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); | 100 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); |
| 91 void OnVideoMemoryUsageStatsReceived( | 101 void OnVideoMemoryUsageStatsReceived( |
| 92 const gpu::VideoMemoryUsageStats& video_memory_usage_stats); | 102 const gpu::VideoMemoryUsageStats& video_memory_usage_stats); |
| 93 | 103 |
| 94 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. | 104 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. |
| 95 int host_id_; | 105 int host_id_; |
| 96 base::Closure close_callback_; | 106 base::Closure close_callback_; |
| 97 }; | 107 }; |
| 98 | 108 |
| 99 } // namespace content | 109 } // namespace content |
| 100 | 110 |
| 101 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | 111 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
| OLD | NEW |