| 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 13 matching lines...) Expand all Loading... |
| 24 #include "gpu/config/gpu_info.h" | 24 #include "gpu/config/gpu_info.h" |
| 25 #include "gpu/ipc/common/memory_stats.h" | 25 #include "gpu/ipc/common/memory_stats.h" |
| 26 #include "ipc/ipc_listener.h" | 26 #include "ipc/ipc_listener.h" |
| 27 #include "ipc/ipc_sender.h" | 27 #include "ipc/ipc_sender.h" |
| 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 service_manager { |
| 35 class InterfaceRegistry; |
| 36 } |
| 37 |
| 34 namespace content { | 38 namespace content { |
| 35 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg); | 39 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg); |
| 36 | 40 |
| 37 class GpuProcessHostUIShim : public IPC::Listener, | 41 class GpuProcessHostUIShim : public IPC::Listener, |
| 38 public base::NonThreadSafe { | 42 public base::NonThreadSafe { |
| 39 public: | 43 public: |
| 40 // Create a GpuProcessHostUIShim with the given ID. The object can be found | 44 // Create a GpuProcessHostUIShim with the given ID. The object can be found |
| 41 // using FromID with the same id. | 45 // using FromID with the same id. |
| 42 static GpuProcessHostUIShim* Create(int host_id); | 46 static GpuProcessHostUIShim* Create(int host_id); |
| 43 | 47 |
| 44 // Destroy the GpuProcessHostUIShim with the given host ID. This can only | 48 // Destroy the GpuProcessHostUIShim with the given host ID. This can only |
| 45 // be called on the UI thread. Only the GpuProcessHost should destroy the | 49 // be called on the UI thread. Only the GpuProcessHost should destroy the |
| 46 // UI shim. | 50 // UI shim. |
| 47 static void Destroy(int host_id, const std::string& message); | 51 static void Destroy(int host_id, const std::string& message); |
| 48 | 52 |
| 49 // Destroy all remaining GpuProcessHostUIShims. | 53 // Destroy all remaining GpuProcessHostUIShims. |
| 50 CONTENT_EXPORT static void DestroyAll(); | 54 CONTENT_EXPORT static void DestroyAll(); |
| 51 | 55 |
| 52 CONTENT_EXPORT static GpuProcessHostUIShim* FromID(int host_id); | 56 CONTENT_EXPORT static GpuProcessHostUIShim* FromID(int host_id); |
| 53 | 57 |
| 54 // IPC::Listener implementation. | 58 // IPC::Listener implementation. |
| 55 // The GpuProcessHost causes this to be called on the UI thread to | 59 // The GpuProcessHost causes this to be called on the UI thread to |
| 56 // dispatch the incoming messages from the GPU process, which are | 60 // dispatch the incoming messages from the GPU process, which are |
| 57 // actually received on the IO thread. | 61 // actually received on the IO thread. |
| 58 bool OnMessageReceived(const IPC::Message& message) override; | 62 bool OnMessageReceived(const IPC::Message& message) override; |
| 59 | 63 |
| 64 #if defined(OS_ANDROID) |
| 65 // Register Mojo interfaces that must be bound on the UI thread. |
| 66 static void RegisterUIThreadMojoInterfaces( |
| 67 service_manager::InterfaceRegistry* registry); |
| 68 #endif |
| 69 |
| 60 private: | 70 private: |
| 61 explicit GpuProcessHostUIShim(int host_id); | 71 explicit GpuProcessHostUIShim(int host_id); |
| 62 ~GpuProcessHostUIShim() override; | 72 ~GpuProcessHostUIShim() override; |
| 63 | 73 |
| 64 // Message handlers. | 74 // Message handlers. |
| 65 bool OnControlMessageReceived(const IPC::Message& message); | 75 bool OnControlMessageReceived(const IPC::Message& message); |
| 66 void OnLogMessage(int level, const std::string& header, | 76 void OnLogMessage(int level, const std::string& header, |
| 67 const std::string& message); | 77 const std::string& message); |
| 68 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); | 78 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); |
| 69 | 79 |
| 70 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. | 80 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. |
| 71 int host_id_; | 81 int host_id_; |
| 72 }; | 82 }; |
| 73 | 83 |
| 74 } // namespace content | 84 } // namespace content |
| 75 | 85 |
| 76 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | 86 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
| OLD | NEW |