| 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/client/gpu_channel_host.h" | 5 #include "gpu/ipc/client/gpu_channel_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 GpuChannelHostFactory* factory, | 63 GpuChannelHostFactory* factory, |
| 64 int channel_id, | 64 int channel_id, |
| 65 const gpu::GPUInfo& gpu_info, | 65 const gpu::GPUInfo& gpu_info, |
| 66 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) | 66 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) |
| 67 : factory_(factory), | 67 : factory_(factory), |
| 68 channel_id_(channel_id), | 68 channel_id_(channel_id), |
| 69 gpu_info_(gpu_info), | 69 gpu_info_(gpu_info), |
| 70 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { | 70 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { |
| 71 next_image_id_.GetNext(); | 71 next_image_id_.GetNext(); |
| 72 next_route_id_.GetNext(); | 72 next_route_id_.GetNext(); |
| 73 next_stream_id_.GetNext(); | |
| 74 } | 73 } |
| 75 | 74 |
| 76 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle, | 75 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle, |
| 77 base::WaitableEvent* shutdown_event) { | 76 base::WaitableEvent* shutdown_event) { |
| 78 DCHECK(factory_->IsMainThread()); | 77 DCHECK(factory_->IsMainThread()); |
| 79 // Open a channel to the GPU process. We pass nullptr as the main listener | 78 // Open a channel to the GPU process. We pass nullptr as the main listener |
| 80 // here since we need to filter everything to route it to the right thread. | 79 // here since we need to filter everything to route it to the right thread. |
| 81 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = | 80 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = |
| 82 factory_->GetIOThreadTaskRunner(); | 81 factory_->GetIOThreadTaskRunner(); |
| 83 channel_ = IPC::SyncChannel::Create(channel_handle, IPC::Channel::MODE_CLIENT, | 82 channel_ = IPC::SyncChannel::Create(channel_handle, IPC::Channel::MODE_CLIENT, |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 237 } |
| 239 | 238 |
| 240 int32_t GpuChannelHost::ReserveImageId() { | 239 int32_t GpuChannelHost::ReserveImageId() { |
| 241 return next_image_id_.GetNext(); | 240 return next_image_id_.GetNext(); |
| 242 } | 241 } |
| 243 | 242 |
| 244 int32_t GpuChannelHost::GenerateRouteID() { | 243 int32_t GpuChannelHost::GenerateRouteID() { |
| 245 return next_route_id_.GetNext(); | 244 return next_route_id_.GetNext(); |
| 246 } | 245 } |
| 247 | 246 |
| 248 int32_t GpuChannelHost::GenerateStreamID() { | |
| 249 const int32_t stream_id = next_stream_id_.GetNext(); | |
| 250 DCHECK_NE(gpu::GPU_STREAM_INVALID, stream_id); | |
| 251 DCHECK_NE(gpu::GPU_STREAM_DEFAULT, stream_id); | |
| 252 return stream_id; | |
| 253 } | |
| 254 | |
| 255 uint32_t GpuChannelHost::ValidateFlushIDReachedServer(int32_t stream_id, | 247 uint32_t GpuChannelHost::ValidateFlushIDReachedServer(int32_t stream_id, |
| 256 bool force_validate) { | 248 bool force_validate) { |
| 257 // Store what flush ids we will be validating for all streams. | 249 // Store what flush ids we will be validating for all streams. |
| 258 base::hash_map<int32_t, uint32_t> validate_flushes; | 250 base::hash_map<int32_t, uint32_t> validate_flushes; |
| 259 uint32_t flushed_stream_flush_id = 0; | 251 uint32_t flushed_stream_flush_id = 0; |
| 260 uint32_t verified_stream_flush_id = 0; | 252 uint32_t verified_stream_flush_id = 0; |
| 261 { | 253 { |
| 262 AutoLock lock(context_lock_); | 254 AutoLock lock(context_lock_); |
| 263 for (const auto& iter : stream_flush_info_) { | 255 for (const auto& iter : stream_flush_info_) { |
| 264 const int32_t iter_stream_id = iter.first; | 256 const int32_t iter_stream_id = iter.first; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 373 |
| 382 listeners_.clear(); | 374 listeners_.clear(); |
| 383 } | 375 } |
| 384 | 376 |
| 385 bool GpuChannelHost::MessageFilter::IsLost() const { | 377 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 386 AutoLock lock(lock_); | 378 AutoLock lock(lock_); |
| 387 return lost_; | 379 return lost_; |
| 388 } | 380 } |
| 389 | 381 |
| 390 } // namespace gpu | 382 } // namespace gpu |
| OLD | NEW |