| 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 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 11 #include "base/location.h" | 12 #include "base/location.h" |
| 12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 15 #include "content/common/gpu/gpu_channel.h" | 16 #include "content/common/gpu/gpu_channel.h" |
| 16 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 17 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 17 #include "content/common/gpu/gpu_memory_manager.h" | 18 #include "content/common/gpu/gpu_memory_manager.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 void GpuChannelManager::OnEstablishChannel( | 174 void GpuChannelManager::OnEstablishChannel( |
| 174 const GpuMsg_EstablishChannel_Params& params) { | 175 const GpuMsg_EstablishChannel_Params& params) { |
| 175 DCHECK(!params.preempts || !params.preempted); | 176 DCHECK(!params.preempts || !params.preempted); |
| 176 scoped_ptr<GpuChannel> channel(CreateGpuChannel( | 177 scoped_ptr<GpuChannel> channel(CreateGpuChannel( |
| 177 params.client_id, params.client_tracing_id, params.preempts, | 178 params.client_id, params.client_tracing_id, params.preempts, |
| 178 params.allow_future_sync_points, params.allow_real_time_streams)); | 179 params.allow_future_sync_points, params.allow_real_time_streams)); |
| 179 if (params.preempted) | 180 if (params.preempted) |
| 180 channel->SetPreemptByFlag(preemption_flag_.get()); | 181 channel->SetPreemptByFlag(preemption_flag_.get()); |
| 181 IPC::ChannelHandle channel_handle = channel->Init(shutdown_event_); | 182 IPC::ChannelHandle channel_handle = channel->Init(shutdown_event_); |
| 182 | 183 |
| 183 gpu_channels_.set(params.client_id, channel.Pass()); | 184 gpu_channels_.set(params.client_id, std::move(channel)); |
| 184 | 185 |
| 185 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); | 186 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); |
| 186 } | 187 } |
| 187 | 188 |
| 188 void GpuChannelManager::OnCloseChannel( | 189 void GpuChannelManager::OnCloseChannel( |
| 189 const IPC::ChannelHandle& channel_handle) { | 190 const IPC::ChannelHandle& channel_handle) { |
| 190 for (auto it = gpu_channels_.begin(); it != gpu_channels_.end(); ++it) { | 191 for (auto it = gpu_channels_.begin(); it != gpu_channels_.end(); ++it) { |
| 191 if (it->second->channel_id() == channel_handle.name) { | 192 if (it->second->channel_id() == channel_handle.name) { |
| 192 gpu_channels_.erase(it); | 193 gpu_channels_.erase(it); |
| 193 return; | 194 return; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 340 } |
| 340 } | 341 } |
| 341 if (!stub || !stub->decoder()->MakeCurrent()) | 342 if (!stub || !stub->decoder()->MakeCurrent()) |
| 342 return; | 343 return; |
| 343 glFinish(); | 344 glFinish(); |
| 344 DidAccessGpu(); | 345 DidAccessGpu(); |
| 345 } | 346 } |
| 346 #endif | 347 #endif |
| 347 | 348 |
| 348 } // namespace content | 349 } // namespace content |
| OLD | NEW |