| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "gpu/command_buffer/common/sync_token.h" | 17 #include "gpu/command_buffer/common/sync_token.h" |
| 18 #include "gpu/command_buffer/common/value_state.h" | |
| 19 #include "gpu/command_buffer/service/feature_info.h" | 18 #include "gpu/command_buffer/service/feature_info.h" |
| 20 #include "gpu/command_buffer/service/mailbox_manager.h" | 19 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 21 #include "gpu/command_buffer/service/memory_program_cache.h" | 20 #include "gpu/command_buffer/service/memory_program_cache.h" |
| 22 #include "gpu/command_buffer/service/shader_translator_cache.h" | 21 #include "gpu/command_buffer/service/shader_translator_cache.h" |
| 23 #include "gpu/command_buffer/service/sync_point_manager.h" | 22 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 24 #include "gpu/ipc/common/gpu_messages.h" | 23 #include "gpu/ipc/common/gpu_messages.h" |
| 25 #include "gpu/ipc/service/gpu_channel.h" | 24 #include "gpu/ipc/service/gpu_channel.h" |
| 26 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" | 25 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
| 27 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 26 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 28 #include "gpu/ipc/service/gpu_memory_manager.h" | 27 #include "gpu/ipc/service/gpu_memory_manager.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 base::Bind(&GpuChannelManager::InternalDestroyGpuMemoryBuffer, | 201 base::Bind(&GpuChannelManager::InternalDestroyGpuMemoryBuffer, |
| 203 base::Unretained(this), id, client_id)); | 202 base::Unretained(this), id, client_id)); |
| 204 return; | 203 return; |
| 205 } | 204 } |
| 206 } | 205 } |
| 207 | 206 |
| 208 // No sync token or invalid sync token, destroy immediately. | 207 // No sync token or invalid sync token, destroy immediately. |
| 209 InternalDestroyGpuMemoryBuffer(id, client_id); | 208 InternalDestroyGpuMemoryBuffer(id, client_id); |
| 210 } | 209 } |
| 211 | 210 |
| 212 void GpuChannelManager::UpdateValueState(int client_id, | |
| 213 unsigned int target, | |
| 214 const ValueState& state) { | |
| 215 // Only pass updated state to the channel corresponding to the | |
| 216 // render_widget_host where the event originated. | |
| 217 auto it = gpu_channels_.find(client_id); | |
| 218 if (it != gpu_channels_.end()) | |
| 219 it->second->HandleUpdateValueState(target, state); | |
| 220 } | |
| 221 | |
| 222 void GpuChannelManager::PopulateShaderCache(const std::string& program_proto) { | 211 void GpuChannelManager::PopulateShaderCache(const std::string& program_proto) { |
| 223 if (program_cache()) | 212 if (program_cache()) |
| 224 program_cache()->LoadProgram(program_proto); | 213 program_cache()->LoadProgram(program_proto); |
| 225 } | 214 } |
| 226 | 215 |
| 227 uint32_t GpuChannelManager::GetUnprocessedOrderNum() const { | 216 uint32_t GpuChannelManager::GetUnprocessedOrderNum() const { |
| 228 uint32_t unprocessed_order_num = 0; | 217 uint32_t unprocessed_order_num = 0; |
| 229 for (auto& kv : gpu_channels_) { | 218 for (auto& kv : gpu_channels_) { |
| 230 unprocessed_order_num = | 219 unprocessed_order_num = |
| 231 std::max(unprocessed_order_num, kv.second->GetUnprocessedOrderNum()); | 220 std::max(unprocessed_order_num, kv.second->GetUnprocessedOrderNum()); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } | 304 } |
| 316 } | 305 } |
| 317 if (!stub || !stub->decoder()->MakeCurrent()) | 306 if (!stub || !stub->decoder()->MakeCurrent()) |
| 318 return; | 307 return; |
| 319 glFinish(); | 308 glFinish(); |
| 320 DidAccessGpu(); | 309 DidAccessGpu(); |
| 321 } | 310 } |
| 322 #endif | 311 #endif |
| 323 | 312 |
| 324 } // namespace gpu | 313 } // namespace gpu |
| OLD | NEW |