| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 // This class lives on the UI thread and supports classes like the | 9 // This class lives on the UI thread and supports classes like the |
| 10 // BackingStoreProxy, which must live on the UI thread. The IO thread | 10 // BackingStoreProxy, which must live on the UI thread. The IO thread |
| 11 // portion of this class, the GpuProcessHost, is responsible for | 11 // portion of this class, the GpuProcessHost, is responsible for |
| 12 // shuttling messages between the browser and GPU processes. | 12 // shuttling messages between the browser and GPU processes. |
| 13 | 13 |
| 14 #include <queue> | 14 #include <queue> |
| 15 | 15 |
| 16 #include "base/callback.h" | 16 #include "base/callback.h" |
| 17 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
| 20 #include "content/common/gpu/gpu_channel_manager.h" | |
| 21 #include "content/common/gpu/gpu_feature_flags.h" | |
| 22 #include "content/common/gpu/gpu_info.h" | |
| 23 #include "content/common/gpu/gpu_process_launch_causes.h" | |
| 24 #include "content/common/message_router.h" | 20 #include "content/common/message_router.h" |
| 25 | 21 |
| 26 namespace gfx { | 22 namespace gfx { |
| 27 class Size; | 23 class Size; |
| 28 } | 24 } |
| 29 | 25 |
| 30 struct GPUCreateCommandBufferConfig; | 26 struct GPUCreateCommandBufferConfig; |
| 31 struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params; | 27 struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params; |
| 32 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 28 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 33 | 29 |
| 34 namespace IPC { | 30 namespace IPC { |
| 35 struct ChannelHandle; | 31 struct ChannelHandle; |
| 36 class Message; | 32 class Message; |
| 37 } | 33 } |
| 38 | 34 |
| 39 // A task that will forward an IPC message to the UI shim. | |
| 40 class RouteToGpuProcessHostUIShimTask : public Task { | |
| 41 public: | |
| 42 RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg); | |
| 43 ~RouteToGpuProcessHostUIShimTask(); | |
| 44 | |
| 45 private: | |
| 46 virtual void Run(); | |
| 47 | |
| 48 int host_id_; | |
| 49 IPC::Message msg_; | |
| 50 }; | |
| 51 | |
| 52 class GpuProcessHostUIShim | 35 class GpuProcessHostUIShim |
| 53 : public IPC::Channel::Listener, | 36 : public IPC::Channel::Listener, |
| 54 public IPC::Channel::Sender, | 37 public IPC::Channel::Sender, |
| 55 public base::NonThreadSafe { | 38 public base::NonThreadSafe { |
| 56 public: | 39 public: |
| 57 // Create a GpuProcessHostUIShim with the given ID. The object can be found | 40 // Create a GpuProcessHostUIShim with the given ID. The object can be found |
| 58 // using FromID with the same id. | 41 // using FromID with the same id. |
| 59 static GpuProcessHostUIShim* Create(int host_id); | 42 static GpuProcessHostUIShim* Create(int host_id); |
| 60 | 43 |
| 61 // Destroy the GpuProcessHostUIShim with the given host ID. This can only | 44 // Destroy the GpuProcessHostUIShim with the given host ID. This can only |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 gfx::Size size); | 85 gfx::Size size); |
| 103 #elif defined(OS_MACOSX) | 86 #elif defined(OS_MACOSX) |
| 104 void OnAcceleratedSurfaceSetIOSurface( | 87 void OnAcceleratedSurfaceSetIOSurface( |
| 105 const GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params& params); | 88 const GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params& params); |
| 106 void OnAcceleratedSurfaceBuffersSwapped( | 89 void OnAcceleratedSurfaceBuffersSwapped( |
| 107 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); | 90 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); |
| 108 #endif | 91 #endif |
| 109 | 92 |
| 110 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. | 93 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. |
| 111 int host_id_; | 94 int host_id_; |
| 112 | |
| 113 // In single process and in process GPU mode, this references the | |
| 114 // GpuChannelManager or null otherwise. It must be called and deleted on the | |
| 115 // GPU thread. | |
| 116 GpuChannelManager* gpu_channel_manager_; | |
| 117 | |
| 118 // This is likewise single process / in process GPU specific. This is a Sender | |
| 119 // implementation that forwards IPC messages to this UI shim on the UI thread. | |
| 120 IPC::Channel::Sender* ui_thread_sender_; | |
| 121 }; | 95 }; |
| 122 | 96 |
| 123 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | 97 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
| OLD | NEW |