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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 GpuChannelHost::GpuChannelHost( | 62 GpuChannelHost::GpuChannelHost( |
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_fence_id_.GetNext(); | |
72 next_route_id_.GetNext(); | 73 next_route_id_.GetNext(); |
73 next_stream_id_.GetNext(); | 74 next_stream_id_.GetNext(); |
74 } | 75 } |
75 | 76 |
76 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle, | 77 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle, |
77 base::WaitableEvent* shutdown_event) { | 78 base::WaitableEvent* shutdown_event) { |
78 DCHECK(factory_->IsMainThread()); | 79 DCHECK(factory_->IsMainThread()); |
79 // Open a channel to the GPU process. We pass nullptr as the main listener | 80 // 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. | 81 // here since we need to filter everything to route it to the right thread. |
81 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = | 82 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 default: | 276 default: |
276 NOTREACHED(); | 277 NOTREACHED(); |
277 return gfx::GpuMemoryBufferHandle(); | 278 return gfx::GpuMemoryBufferHandle(); |
278 } | 279 } |
279 } | 280 } |
280 | 281 |
281 int32_t GpuChannelHost::ReserveImageId() { | 282 int32_t GpuChannelHost::ReserveImageId() { |
282 return next_image_id_.GetNext(); | 283 return next_image_id_.GetNext(); |
283 } | 284 } |
284 | 285 |
286 gfx::GpuFenceHandle GpuChannelHost::ShareGpuFenceToGpuProcess( | |
287 const gfx::GpuFenceHandle& source_handle) { | |
288 gfx::GpuFenceHandle handle; | |
289 handle.shared_event_handle = | |
290 gfx::SharedEvent::DuplicateHandle(source_handle.shared_event_handle); | |
ericrk
2017/03/10 03:04:39
We don't need to call ShareToProcess here? Just du
reveman
2017/03/13 12:33:05
This looks the same as GpuChannelHost::ShareToGpuP
| |
291 return handle; | |
292 } | |
293 | |
294 int32_t GpuChannelHost::ReserveFenceId() { | |
295 return next_fence_id_.GetNext(); | |
296 } | |
297 | |
285 int32_t GpuChannelHost::GenerateRouteID() { | 298 int32_t GpuChannelHost::GenerateRouteID() { |
286 return next_route_id_.GetNext(); | 299 return next_route_id_.GetNext(); |
287 } | 300 } |
288 | 301 |
289 int32_t GpuChannelHost::GenerateStreamID() { | 302 int32_t GpuChannelHost::GenerateStreamID() { |
290 const int32_t stream_id = next_stream_id_.GetNext(); | 303 const int32_t stream_id = next_stream_id_.GetNext(); |
291 DCHECK_NE(gpu::GPU_STREAM_INVALID, stream_id); | 304 DCHECK_NE(gpu::GPU_STREAM_INVALID, stream_id); |
292 DCHECK_NE(gpu::GPU_STREAM_DEFAULT, stream_id); | 305 DCHECK_NE(gpu::GPU_STREAM_DEFAULT, stream_id); |
293 return stream_id; | 306 return stream_id; |
294 } | 307 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 | 435 |
423 listeners_.clear(); | 436 listeners_.clear(); |
424 } | 437 } |
425 | 438 |
426 bool GpuChannelHost::MessageFilter::IsLost() const { | 439 bool GpuChannelHost::MessageFilter::IsLost() const { |
427 AutoLock lock(lock_); | 440 AutoLock lock(lock_); |
428 return lost_; | 441 return lost_; |
429 } | 442 } |
430 | 443 |
431 } // namespace gpu | 444 } // namespace gpu |
OLD | NEW |