| 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 30 matching lines...) Expand all Loading... |
| 41 class CommandBufferServiceLocked : public CommandBufferService { | 41 class CommandBufferServiceLocked : public CommandBufferService { |
| 42 public: | 42 public: |
| 43 explicit CommandBufferServiceLocked( | 43 explicit CommandBufferServiceLocked( |
| 44 TransferBufferManagerInterface* transfer_buffer_manager) | 44 TransferBufferManagerInterface* transfer_buffer_manager) |
| 45 : CommandBufferService(transfer_buffer_manager), | 45 : CommandBufferService(transfer_buffer_manager), |
| 46 flush_locked_(false), | 46 flush_locked_(false), |
| 47 last_flush_(-1), | 47 last_flush_(-1), |
| 48 flush_count_(0) {} | 48 flush_count_(0) {} |
| 49 ~CommandBufferServiceLocked() override {} | 49 ~CommandBufferServiceLocked() override {} |
| 50 | 50 |
| 51 void Flush(int32 put_offset) override { | 51 void Flush(int32 put_offset, |
| 52 const std::vector<uint32>& sync_points) override { |
| 52 flush_count_++; | 53 flush_count_++; |
| 53 if (!flush_locked_) { | 54 if (!flush_locked_) { |
| 54 last_flush_ = -1; | 55 last_flush_ = -1; |
| 55 CommandBufferService::Flush(put_offset); | 56 CommandBufferService::Flush(put_offset, sync_points); |
| 56 } else { | 57 } else { |
| 57 last_flush_ = put_offset; | 58 last_flush_ = put_offset; |
| 58 } | 59 } |
| 59 } | 60 } |
| 60 | 61 |
| 61 void LockFlush() { flush_locked_ = true; } | 62 void LockFlush() { flush_locked_ = true; } |
| 62 | 63 |
| 63 void UnlockFlush() { flush_locked_ = false; } | 64 void UnlockFlush() { flush_locked_ = false; } |
| 64 | 65 |
| 65 int FlushCount() { return flush_count_; } | 66 int FlushCount() { return flush_count_; } |
| 66 | 67 |
| 67 void WaitForGetOffsetInRange(int32 start, int32 end) override { | 68 void WaitForGetOffsetInRange(int32 start, int32 end) override { |
| 68 if (last_flush_ != -1) { | 69 if (last_flush_ != -1) { |
| 69 CommandBufferService::Flush(last_flush_); | 70 CommandBufferService::Flush(last_flush_, std::vector<uint32>()); |
| 70 last_flush_ = -1; | 71 last_flush_ = -1; |
| 71 } | 72 } |
| 72 CommandBufferService::WaitForGetOffsetInRange(start, end); | 73 CommandBufferService::WaitForGetOffsetInRange(start, end); |
| 73 } | 74 } |
| 74 | 75 |
| 75 private: | 76 private: |
| 76 bool flush_locked_; | 77 bool flush_locked_; |
| 77 int last_flush_; | 78 int last_flush_; |
| 78 int flush_count_; | 79 int flush_count_; |
| 79 DISALLOW_COPY_AND_ASSIGN(CommandBufferServiceLocked); | 80 DISALLOW_COPY_AND_ASSIGN(CommandBufferServiceLocked); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 helper_->Finish(); | 704 helper_->Finish(); |
| 704 | 705 |
| 705 // Check that the commands did happen. | 706 // Check that the commands did happen. |
| 706 Mock::VerifyAndClearExpectations(api_mock_.get()); | 707 Mock::VerifyAndClearExpectations(api_mock_.get()); |
| 707 | 708 |
| 708 // Check the error status. | 709 // Check the error status. |
| 709 EXPECT_EQ(error::kNoError, GetError()); | 710 EXPECT_EQ(error::kNoError, GetError()); |
| 710 } | 711 } |
| 711 | 712 |
| 712 } // namespace gpu | 713 } // namespace gpu |
| OLD | NEW |