| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | |
| 6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | |
| 7 | |
| 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 | |
| 10 // portion of this class, the GpuProcessHost, is responsible for | |
| 11 // shuttling messages between the browser and GPU processes. | |
| 12 | |
| 13 #include <stdint.h> | |
| 14 | |
| 15 #include <string> | |
| 16 | |
| 17 #include "base/callback.h" | |
| 18 #include "base/compiler_specific.h" | |
| 19 #include "base/memory/linked_ptr.h" | |
| 20 #include "base/memory/ref_counted.h" | |
| 21 #include "base/threading/non_thread_safe.h" | |
| 22 #include "build/build_config.h" | |
| 23 #include "content/common/content_export.h" | |
| 24 #include "gpu/config/gpu_info.h" | |
| 25 #include "gpu/ipc/common/memory_stats.h" | |
| 26 #include "ipc/ipc_listener.h" | |
| 27 #include "ipc/ipc_sender.h" | |
| 28 #include "ipc/message_router.h" | |
| 29 | |
| 30 namespace IPC { | |
| 31 class Message; | |
| 32 } | |
| 33 | |
| 34 namespace service_manager { | |
| 35 class BinderRegistry; | |
| 36 } | |
| 37 | |
| 38 namespace content { | |
| 39 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg); | |
| 40 | |
| 41 class GpuProcessHostUIShim : public base::NonThreadSafe { | |
| 42 public: | |
| 43 // Create a GpuProcessHostUIShim with the given ID. The object can be found | |
| 44 // using FromID with the same id. | |
| 45 static GpuProcessHostUIShim* Create(int host_id); | |
| 46 | |
| 47 // Destroy the GpuProcessHostUIShim with the given host ID. This can only | |
| 48 // be called on the UI thread. Only the GpuProcessHost should destroy the | |
| 49 // UI shim. | |
| 50 static void Destroy(int host_id, const std::string& message); | |
| 51 | |
| 52 CONTENT_EXPORT static GpuProcessHostUIShim* FromID(int host_id); | |
| 53 | |
| 54 // The GpuProcessHost causes this to be called on the UI thread to | |
| 55 // dispatch the incoming messages from the GPU process, which are | |
| 56 // actually received on the IO thread. | |
| 57 void OnMessageReceived(const IPC::Message& message); | |
| 58 | |
| 59 // Register Mojo interfaces that must be bound on the UI thread. | |
| 60 static void RegisterUIThreadMojoInterfaces( | |
| 61 service_manager::BinderRegistry* registry); | |
| 62 | |
| 63 private: | |
| 64 explicit GpuProcessHostUIShim(int host_id); | |
| 65 ~GpuProcessHostUIShim(); | |
| 66 | |
| 67 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. | |
| 68 int host_id_; | |
| 69 }; | |
| 70 | |
| 71 } // namespace content | |
| 72 | |
| 73 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | |
| OLD | NEW |