| 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 #include "gpu/ipc/service/gpu_channel_manager.h" | 5 #include "gpu/ipc/service/gpu_channel_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 framebuffer_completeness_cache_ = | 108 framebuffer_completeness_cache_ = |
| 109 new gles2::FramebufferCompletenessCache; | 109 new gles2::FramebufferCompletenessCache; |
| 110 return framebuffer_completeness_cache_.get(); | 110 return framebuffer_completeness_cache_.get(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void GpuChannelManager::RemoveChannel(int client_id) { | 113 void GpuChannelManager::RemoveChannel(int client_id) { |
| 114 delegate_->DidDestroyChannel(client_id); | 114 delegate_->DidDestroyChannel(client_id); |
| 115 gpu_channels_.erase(client_id); | 115 gpu_channels_.erase(client_id); |
| 116 } | 116 } |
| 117 | 117 |
| 118 #if defined(OS_MACOSX) | |
| 119 void GpuChannelManager::AddBufferPresentedCallback( | |
| 120 gpu::SurfaceHandle surface_handle, | |
| 121 const BufferPresentedCallback& callback) { | |
| 122 DCHECK(buffer_presented_callback_map_.find(surface_handle) == | |
| 123 buffer_presented_callback_map_.end()); | |
| 124 buffer_presented_callback_map_[surface_handle] = callback; | |
| 125 } | |
| 126 | |
| 127 void GpuChannelManager::RemoveBufferPresentedCallback( | |
| 128 gpu::SurfaceHandle surface_handle) { | |
| 129 auto it = buffer_presented_callback_map_.find(surface_handle); | |
| 130 DCHECK(it != buffer_presented_callback_map_.end()); | |
| 131 buffer_presented_callback_map_.erase(it); | |
| 132 } | |
| 133 | |
| 134 void GpuChannelManager::BufferPresented(gpu::SurfaceHandle surface_handle, | |
| 135 const base::TimeTicks& vsync_timebase, | |
| 136 const base::TimeDelta& vsync_interval) { | |
| 137 auto it = buffer_presented_callback_map_.find(surface_handle); | |
| 138 if (it != buffer_presented_callback_map_.end()) | |
| 139 it->second.Run(surface_handle, vsync_timebase, vsync_interval); | |
| 140 } | |
| 141 #endif | |
| 142 | |
| 143 GpuChannel* GpuChannelManager::LookupChannel(int32_t client_id) const { | 118 GpuChannel* GpuChannelManager::LookupChannel(int32_t client_id) const { |
| 144 const auto& it = gpu_channels_.find(client_id); | 119 const auto& it = gpu_channels_.find(client_id); |
| 145 return it != gpu_channels_.end() ? it->second : nullptr; | 120 return it != gpu_channels_.end() ? it->second : nullptr; |
| 146 } | 121 } |
| 147 | 122 |
| 148 std::unique_ptr<GpuChannel> GpuChannelManager::CreateGpuChannel( | 123 std::unique_ptr<GpuChannel> GpuChannelManager::CreateGpuChannel( |
| 149 int client_id, | 124 int client_id, |
| 150 uint64_t client_tracing_id, | 125 uint64_t client_tracing_id, |
| 151 bool preempts, | 126 bool preempts, |
| 152 bool allow_view_command_buffers, | 127 bool allow_view_command_buffers, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 } | 280 } |
| 306 } | 281 } |
| 307 if (!stub || !stub->decoder()->MakeCurrent()) | 282 if (!stub || !stub->decoder()->MakeCurrent()) |
| 308 return; | 283 return; |
| 309 glFinish(); | 284 glFinish(); |
| 310 DidAccessGpu(); | 285 DidAccessGpu(); |
| 311 } | 286 } |
| 312 #endif | 287 #endif |
| 313 | 288 |
| 314 } // namespace gpu | 289 } // namespace gpu |
| OLD | NEW |