| 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 CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ | 5 #ifndef CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ |
| 6 #define CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ | 6 #define CHROME_BROWSER_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 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 // Sends a reply message later when the next GpuHostMsg_SynchronizeReply comes | 116 // Sends a reply message later when the next GpuHostMsg_SynchronizeReply comes |
| 117 // in. | 117 // in. |
| 118 void Synchronize(SynchronizeCallback* callback); | 118 void Synchronize(SynchronizeCallback* callback); |
| 119 | 119 |
| 120 typedef Callback1<int32>::Type CreateCommandBufferCallback; | 120 typedef Callback1<int32>::Type CreateCommandBufferCallback; |
| 121 | 121 |
| 122 // Tells the GPU process to create a new command buffer that draws into the | 122 // Tells the GPU process to create a new command buffer that draws into the |
| 123 // window associated with the given renderer. | 123 // window associated with the given renderer. |
| 124 void CreateViewCommandBuffer( | 124 void CreateViewCommandBuffer( |
| 125 gfx::PluginWindowHandle compositing_surface, |
| 125 int32 render_view_id, | 126 int32 render_view_id, |
| 126 int32 renderer_id, | 127 int32 renderer_id, |
| 127 const GPUCreateCommandBufferConfig& init_params, | 128 const GPUCreateCommandBufferConfig& init_params, |
| 128 CreateCommandBufferCallback* callback); | 129 CreateCommandBufferCallback* callback); |
| 129 | 130 |
| 130 #if defined(OS_MACOSX) | 131 #if defined(OS_MACOSX) |
| 131 // Notify the GPU process that an accelerated surface was destroyed. | 132 // Notify the GPU process that an accelerated surface was destroyed. |
| 132 void DidDestroyAcceleratedSurface(int renderer_id, int32 render_view_id); | 133 void DidDestroyAcceleratedSurface(int renderer_id, int32 render_view_id); |
| 133 | 134 |
| 134 // TODO(apatrick): Remove this when mac does not use AcceleratedSurfaces for | 135 // TODO(apatrick): Remove this when mac does not use AcceleratedSurfaces for |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // the GPU process, but haven't heard back about yet. | 191 // the GPU process, but haven't heard back about yet. |
| 191 std::queue<linked_ptr<EstablishChannelCallback> > channel_requests_; | 192 std::queue<linked_ptr<EstablishChannelCallback> > channel_requests_; |
| 192 | 193 |
| 193 // The pending synchronization requests we need to reply to. | 194 // The pending synchronization requests we need to reply to. |
| 194 std::queue<linked_ptr<SynchronizeCallback> > synchronize_requests_; | 195 std::queue<linked_ptr<SynchronizeCallback> > synchronize_requests_; |
| 195 | 196 |
| 196 // The pending create command buffer requests we need to reply to. | 197 // The pending create command buffer requests we need to reply to. |
| 197 std::queue<linked_ptr<CreateCommandBufferCallback> > | 198 std::queue<linked_ptr<CreateCommandBufferCallback> > |
| 198 create_command_buffer_requests_; | 199 create_command_buffer_requests_; |
| 199 | 200 |
| 201 #if defined(OS_LINUX) |
| 200 typedef std::pair<int32 /* renderer_id */, | 202 typedef std::pair<int32 /* renderer_id */, |
| 201 int32 /* render_view_id */> ViewID; | 203 int32 /* render_view_id */> ViewID; |
| 202 | 204 |
| 203 // Encapsulates surfaces that we acquire when creating view command buffers. | 205 // Encapsulates surfaces that we lock when creating view command buffers. |
| 204 // We assume that a render view has at most 1 such surface associated | 206 // We release this lock once the command buffer (or associated GPU process) |
| 205 // with it. Multimap is used to simulate reference counting, see comment in | 207 // is destroyed. This prevents the browser from destroying the surface |
| 208 // while the GPU process is drawing to it. |
| 209 |
| 210 // Multimap is used to simulate reference counting, see comment in |
| 206 // GpuProcessHostUIShim::CreateViewCommandBuffer. | 211 // GpuProcessHostUIShim::CreateViewCommandBuffer. |
| 207 class ViewSurface; | 212 class SurfaceRef; |
| 208 typedef std::multimap<ViewID, linked_ptr<ViewSurface> > ViewSurfaceMap; | 213 typedef std::multimap<ViewID, linked_ptr<SurfaceRef> > SurfaceRefMap; |
| 209 ViewSurfaceMap acquired_surfaces_; | 214 SurfaceRefMap surface_refs_; |
| 215 #endif |
| 210 | 216 |
| 211 // In single process and in process GPU mode, this references the | 217 // In single process and in process GPU mode, this references the |
| 212 // GpuChannelManager or null otherwise. It must be called and deleted on the | 218 // GpuChannelManager or null otherwise. It must be called and deleted on the |
| 213 // GPU thread. | 219 // GPU thread. |
| 214 GpuChannelManager* gpu_channel_manager_; | 220 GpuChannelManager* gpu_channel_manager_; |
| 215 | 221 |
| 216 // This is likewise single process / in process GPU specific. This is a Sender | 222 // This is likewise single process / in process GPU specific. This is a Sender |
| 217 // implementation that forwards IPC messages to this UI shim on the UI thread. | 223 // implementation that forwards IPC messages to this UI shim on the UI thread. |
| 218 IPC::Channel::Sender* ui_thread_sender_; | 224 IPC::Channel::Sender* ui_thread_sender_; |
| 219 }; | 225 }; |
| 220 | 226 |
| 221 #endif // CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ | 227 #endif // CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ |
| 222 | 228 |
| OLD | NEW |