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/client/gpu_channel_host.h" | 5 #include "content/common/gpu/client/gpu_channel_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 latency_info.begin(), latency_info.end()); | 155 latency_info.begin(), latency_info.end()); |
156 | 156 |
157 if (do_flush) | 157 if (do_flush) |
158 InternalFlush(&flush_info); | 158 InternalFlush(&flush_info); |
159 | 159 |
160 return flush_id; | 160 return flush_id; |
161 } | 161 } |
162 return 0; | 162 return 0; |
163 } | 163 } |
164 | 164 |
| 165 void GpuChannelHost::FlushPendingStream(int32 stream_id) { |
| 166 AutoLock lock(context_lock_); |
| 167 auto flush_info_iter = stream_flush_info_.find(stream_id); |
| 168 if (flush_info_iter == stream_flush_info_.end()) |
| 169 return; |
| 170 |
| 171 StreamFlushInfo& flush_info = flush_info_iter->second; |
| 172 if (flush_info.flush_pending) |
| 173 InternalFlush(&flush_info); |
| 174 } |
| 175 |
165 void GpuChannelHost::InternalFlush(StreamFlushInfo* flush_info) { | 176 void GpuChannelHost::InternalFlush(StreamFlushInfo* flush_info) { |
166 context_lock_.AssertAcquired(); | 177 context_lock_.AssertAcquired(); |
167 DCHECK(flush_info); | 178 DCHECK(flush_info); |
168 DCHECK(flush_info->flush_pending); | 179 DCHECK(flush_info->flush_pending); |
169 DCHECK_LT(flush_info->flushed_stream_flush_id, flush_info->flush_id); | 180 DCHECK_LT(flush_info->flushed_stream_flush_id, flush_info->flush_id); |
170 Send(new GpuCommandBufferMsg_AsyncFlush( | 181 Send(new GpuCommandBufferMsg_AsyncFlush( |
171 flush_info->route_id, flush_info->put_offset, flush_info->flush_count, | 182 flush_info->route_id, flush_info->put_offset, flush_info->flush_count, |
172 flush_info->latency_info)); | 183 flush_info->latency_info)); |
173 flush_info->latency_info.clear(); | 184 flush_info->latency_info.clear(); |
174 flush_info->flush_pending = false; | 185 flush_info->flush_pending = false; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 400 |
390 int32 GpuChannelHost::ReserveImageId() { | 401 int32 GpuChannelHost::ReserveImageId() { |
391 return next_image_id_.GetNext(); | 402 return next_image_id_.GetNext(); |
392 } | 403 } |
393 | 404 |
394 int32 GpuChannelHost::GenerateRouteID() { | 405 int32 GpuChannelHost::GenerateRouteID() { |
395 return next_route_id_.GetNext(); | 406 return next_route_id_.GetNext(); |
396 } | 407 } |
397 | 408 |
398 int32 GpuChannelHost::GenerateStreamID() { | 409 int32 GpuChannelHost::GenerateStreamID() { |
399 return next_stream_id_.GetNext(); | 410 const int32 stream_id = next_stream_id_.GetNext(); |
| 411 DCHECK_NE(0, stream_id); |
| 412 DCHECK_NE(kDefaultStreamId, stream_id); |
| 413 return stream_id; |
400 } | 414 } |
401 | 415 |
402 uint32_t GpuChannelHost::ValidateFlushIDReachedServer(int32 stream_id, | 416 uint32_t GpuChannelHost::ValidateFlushIDReachedServer(int32 stream_id, |
403 bool force_validate) { | 417 bool force_validate) { |
404 // Store what flush ids we will be validating for all streams. | 418 // Store what flush ids we will be validating for all streams. |
405 base::hash_map<int32, uint32_t> validate_flushes; | 419 base::hash_map<int32, uint32_t> validate_flushes; |
406 uint32_t flushed_stream_flush_id = 0; | 420 uint32_t flushed_stream_flush_id = 0; |
407 uint32_t verified_stream_flush_id = 0; | 421 uint32_t verified_stream_flush_id = 0; |
408 { | 422 { |
409 AutoLock lock(context_lock_); | 423 AutoLock lock(context_lock_); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 541 |
528 listeners_.clear(); | 542 listeners_.clear(); |
529 } | 543 } |
530 | 544 |
531 bool GpuChannelHost::MessageFilter::IsLost() const { | 545 bool GpuChannelHost::MessageFilter::IsLost() const { |
532 AutoLock lock(lock_); | 546 AutoLock lock(lock_); |
533 return lost_; | 547 return lost_; |
534 } | 548 } |
535 | 549 |
536 } // namespace content | 550 } // namespace content |
OLD | NEW |