| 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 // Tests for the Command Buffer Helper. | 5 // Tests for the Command Buffer Helper. |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 const int32 kCommandBufferSizeBytes = | 30 const int32 kCommandBufferSizeBytes = |
| 31 kTotalNumCommandEntries * sizeof(CommandBufferEntry); | 31 kTotalNumCommandEntries * sizeof(CommandBufferEntry); |
| 32 const int32 kUnusedCommandId = 5; // we use 0 and 2 currently. | 32 const int32 kUnusedCommandId = 5; // we use 0 and 2 currently. |
| 33 | 33 |
| 34 // Override CommandBufferService::Flush() to lock flushing and simulate | 34 // Override CommandBufferService::Flush() to lock flushing and simulate |
| 35 // the buffer becoming full in asynchronous mode. | 35 // the buffer becoming full in asynchronous mode. |
| 36 class CommandBufferServiceLocked : public CommandBufferService { | 36 class CommandBufferServiceLocked : public CommandBufferService { |
| 37 public: | 37 public: |
| 38 explicit CommandBufferServiceLocked( | 38 explicit CommandBufferServiceLocked( |
| 39 TransferBufferManagerInterface* transfer_buffer_manager) | 39 TransferBufferManagerInterface* transfer_buffer_manager) |
| 40 : CommandBufferService(transfer_buffer_manager), | 40 : CommandBufferService(transfer_buffer_manager, |
| 41 kCommandBufferNamespace_InProcess, |
| 42 0), |
| 41 flush_locked_(false), | 43 flush_locked_(false), |
| 42 last_flush_(-1), | 44 last_flush_(-1), |
| 43 flush_count_(0) {} | 45 flush_count_(0) {} |
| 44 ~CommandBufferServiceLocked() override {} | 46 ~CommandBufferServiceLocked() override {} |
| 45 | 47 |
| 46 void Flush(int32 put_offset) override { | 48 void Flush(int32 put_offset) override { |
| 47 flush_count_++; | 49 flush_count_++; |
| 48 if (!flush_locked_) { | 50 if (!flush_locked_) { |
| 49 last_flush_ = -1; | 51 last_flush_ = -1; |
| 50 CommandBufferService::Flush(put_offset); | 52 CommandBufferService::Flush(put_offset); |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 helper_->OrderingBarrier(); | 756 helper_->OrderingBarrier(); |
| 755 flush_count2 = command_buffer_->FlushCount(); | 757 flush_count2 = command_buffer_->FlushCount(); |
| 756 helper_->OrderingBarrier(); | 758 helper_->OrderingBarrier(); |
| 757 flush_count3 = command_buffer_->FlushCount(); | 759 flush_count3 = command_buffer_->FlushCount(); |
| 758 | 760 |
| 759 EXPECT_EQ(flush_count2, flush_count1 + 1); | 761 EXPECT_EQ(flush_count2, flush_count1 + 1); |
| 760 EXPECT_EQ(flush_count3, flush_count2 + 1); | 762 EXPECT_EQ(flush_count3, flush_count2 + 1); |
| 761 } | 763 } |
| 762 | 764 |
| 763 } // namespace gpu | 765 } // namespace gpu |
| OLD | NEW |