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