| 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 } | 391 } |
| 392 | 392 |
| 393 int32 GpuChannelHost::GenerateRouteID() { | 393 int32 GpuChannelHost::GenerateRouteID() { |
| 394 return next_route_id_.GetNext(); | 394 return next_route_id_.GetNext(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 int32 GpuChannelHost::GenerateStreamID() { | 397 int32 GpuChannelHost::GenerateStreamID() { |
| 398 return next_stream_id_.GetNext(); | 398 return next_stream_id_.GetNext(); |
| 399 } | 399 } |
| 400 | 400 |
| 401 uint32_t GpuChannelHost::ValidateFlushIDReachedServer(int32 stream_id) { | 401 uint32_t GpuChannelHost::ValidateFlushIDReachedServer(int32 stream_id, |
| 402 bool force_validate) { |
| 402 // Store what flush ids we will be validating for all streams. | 403 // Store what flush ids we will be validating for all streams. |
| 403 base::hash_map<int32, uint32_t> validate_flushes; | 404 base::hash_map<int32, uint32_t> validate_flushes; |
| 404 uint32_t flushed_stream_flush_id = 0; | 405 uint32_t flushed_stream_flush_id = 0; |
| 405 uint32_t verified_stream_flush_id = 0; | 406 uint32_t verified_stream_flush_id = 0; |
| 406 { | 407 { |
| 407 AutoLock lock(context_lock_); | 408 AutoLock lock(context_lock_); |
| 408 for (const auto& iter : stream_flush_info_) { | 409 for (const auto& iter : stream_flush_info_) { |
| 409 const int32 iter_stream_id = iter.first; | 410 const int32 iter_stream_id = iter.first; |
| 410 const StreamFlushInfo& flush_info = iter.second; | 411 const StreamFlushInfo& flush_info = iter.second; |
| 411 if (iter_stream_id == stream_id) { | 412 if (iter_stream_id == stream_id) { |
| 412 flushed_stream_flush_id = flush_info.flushed_stream_flush_id; | 413 flushed_stream_flush_id = flush_info.flushed_stream_flush_id; |
| 413 verified_stream_flush_id = flush_info.verified_stream_flush_id; | 414 verified_stream_flush_id = flush_info.verified_stream_flush_id; |
| 414 } | 415 } |
| 415 | 416 |
| 416 if (flush_info.flushed_stream_flush_id > | 417 if (flush_info.flushed_stream_flush_id > |
| 417 flush_info.verified_stream_flush_id) { | 418 flush_info.verified_stream_flush_id) { |
| 418 validate_flushes.insert( | 419 validate_flushes.insert( |
| 419 std::make_pair(iter_stream_id, flush_info.flushed_stream_flush_id)); | 420 std::make_pair(iter_stream_id, flush_info.flushed_stream_flush_id)); |
| 420 } | 421 } |
| 421 } | 422 } |
| 422 } | 423 } |
| 423 | 424 |
| 424 if (flushed_stream_flush_id == verified_stream_flush_id) { | 425 if (!force_validate && flushed_stream_flush_id == verified_stream_flush_id) { |
| 425 // Current stream has no unverified flushes. | 426 // Current stream has no unverified flushes. |
| 426 return verified_stream_flush_id; | 427 return verified_stream_flush_id; |
| 427 } | 428 } |
| 428 | 429 |
| 429 if (Send(new GpuChannelMsg_Nop())) { | 430 if (Send(new GpuChannelMsg_Nop())) { |
| 430 // Update verified flush id for all streams. | 431 // Update verified flush id for all streams. |
| 431 uint32_t highest_flush_id = 0; | 432 uint32_t highest_flush_id = 0; |
| 432 AutoLock lock(context_lock_); | 433 AutoLock lock(context_lock_); |
| 433 for (const auto& iter : validate_flushes) { | 434 for (const auto& iter : validate_flushes) { |
| 434 const int32 validated_stream_id = iter.first; | 435 const int32 validated_stream_id = iter.first; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 | 526 |
| 526 listeners_.clear(); | 527 listeners_.clear(); |
| 527 } | 528 } |
| 528 | 529 |
| 529 bool GpuChannelHost::MessageFilter::IsLost() const { | 530 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 530 AutoLock lock(lock_); | 531 AutoLock lock(lock_); |
| 531 return lost_; | 532 return lost_; |
| 532 } | 533 } |
| 533 | 534 |
| 534 } // namespace content | 535 } // namespace content |
| OLD | NEW |