| 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 "content/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/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/location.h" | 11 #include "base/location.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "content/common/gpu/establish_channel_params.h" | |
| 16 #include "content/common/gpu/gpu_channel.h" | 15 #include "content/common/gpu/gpu_channel.h" |
| 17 #include "content/common/gpu/gpu_channel_manager_delegate.h" | 16 #include "content/common/gpu/gpu_channel_manager_delegate.h" |
| 18 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 17 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 19 #include "content/common/gpu/gpu_memory_manager.h" | 18 #include "content/common/gpu/gpu_memory_manager.h" |
| 20 #include "content/common/gpu/gpu_messages.h" | 19 #include "content/common/gpu/gpu_messages.h" |
| 21 #include "gpu/command_buffer/common/sync_token.h" | 20 #include "gpu/command_buffer/common/sync_token.h" |
| 22 #include "gpu/command_buffer/common/value_state.h" | 21 #include "gpu/command_buffer/common/value_state.h" |
| 23 #include "gpu/command_buffer/service/feature_info.h" | 22 #include "gpu/command_buffer/service/feature_info.h" |
| 24 #include "gpu/command_buffer/service/mailbox_manager.h" | 23 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 25 #include "gpu/command_buffer/service/memory_program_cache.h" | 24 #include "gpu/command_buffer/service/memory_program_cache.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 bool allow_real_time_streams) { | 151 bool allow_real_time_streams) { |
| 153 return make_scoped_ptr( | 152 return make_scoped_ptr( |
| 154 new GpuChannel(this, sync_point_manager(), watchdog_, share_group(), | 153 new GpuChannel(this, sync_point_manager(), watchdog_, share_group(), |
| 155 mailbox_manager(), preempts ? preemption_flag() : nullptr, | 154 mailbox_manager(), preempts ? preemption_flag() : nullptr, |
| 156 preempts ? nullptr : preemption_flag(), task_runner_.get(), | 155 preempts ? nullptr : preemption_flag(), task_runner_.get(), |
| 157 io_task_runner_.get(), client_id, client_tracing_id, | 156 io_task_runner_.get(), client_id, client_tracing_id, |
| 158 allow_view_command_buffers, allow_real_time_streams)); | 157 allow_view_command_buffers, allow_real_time_streams)); |
| 159 } | 158 } |
| 160 | 159 |
| 161 IPC::ChannelHandle GpuChannelManager::EstablishChannel( | 160 IPC::ChannelHandle GpuChannelManager::EstablishChannel( |
| 162 const EstablishChannelParams& params) { | 161 int client_id, |
| 163 scoped_ptr<GpuChannel> channel(CreateGpuChannel( | 162 uint64_t client_tracing_id, |
| 164 params.client_id, params.client_tracing_id, params.preempts, | 163 bool preempts, |
| 165 params.allow_view_command_buffers, params.allow_real_time_streams)); | 164 bool allow_view_command_buffers, |
| 165 bool allow_real_time_streams) { |
| 166 scoped_ptr<GpuChannel> channel( |
| 167 CreateGpuChannel(client_id, client_tracing_id, preempts, |
| 168 allow_view_command_buffers, allow_real_time_streams)); |
| 166 IPC::ChannelHandle channel_handle = channel->Init(shutdown_event_); | 169 IPC::ChannelHandle channel_handle = channel->Init(shutdown_event_); |
| 167 | 170 gpu_channels_.set(client_id, std::move(channel)); |
| 168 gpu_channels_.set(params.client_id, std::move(channel)); | |
| 169 return channel_handle; | 171 return channel_handle; |
| 170 } | 172 } |
| 171 | 173 |
| 172 void GpuChannelManager::InternalDestroyGpuMemoryBuffer( | 174 void GpuChannelManager::InternalDestroyGpuMemoryBuffer( |
| 173 gfx::GpuMemoryBufferId id, | 175 gfx::GpuMemoryBufferId id, |
| 174 int client_id) { | 176 int client_id) { |
| 175 io_task_runner_->PostTask( | 177 io_task_runner_->PostTask( |
| 176 FROM_HERE, | 178 FROM_HERE, |
| 177 base::Bind(&GpuChannelManager::InternalDestroyGpuMemoryBufferOnIO, | 179 base::Bind(&GpuChannelManager::InternalDestroyGpuMemoryBufferOnIO, |
| 178 base::Unretained(this), id, client_id)); | 180 base::Unretained(this), id, client_id)); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 302 } |
| 301 } | 303 } |
| 302 if (!stub || !stub->decoder()->MakeCurrent()) | 304 if (!stub || !stub->decoder()->MakeCurrent()) |
| 303 return; | 305 return; |
| 304 glFinish(); | 306 glFinish(); |
| 305 DidAccessGpu(); | 307 DidAccessGpu(); |
| 306 } | 308 } |
| 307 #endif | 309 #endif |
| 308 | 310 |
| 309 } // namespace content | 311 } // namespace content |
| OLD | NEW |