| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains the tests for the RingBuffer class. | 5 // This file contains the tests for the RingBuffer class. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/ring_buffer.h" | 7 #include "gpu/command_buffer/client/ring_buffer.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 parser_ = new CommandParser(ring_buffer.ptr, | 48 parser_ = new CommandParser(ring_buffer.ptr, |
| 49 ring_buffer.size, | 49 ring_buffer.size, |
| 50 0, | 50 0, |
| 51 ring_buffer.size, | 51 ring_buffer.size, |
| 52 0, | 52 0, |
| 53 api_mock_.get()); | 53 api_mock_.get()); |
| 54 | 54 |
| 55 gpu_scheduler_.reset(new GpuScheduler( | 55 gpu_scheduler_.reset(new GpuScheduler( |
| 56 command_buffer_.get(), NULL, parser_, INT_MAX)); | 56 command_buffer_.get(), NULL, parser_, INT_MAX)); |
| 57 command_buffer_->SetPutOffsetChangeCallback(NewCallback( | 57 command_buffer_->SetPutOffsetChangeCallback(NewCallback( |
| 58 gpu_scheduler_.get(), &GpuScheduler::ProcessCommands)); | 58 gpu_scheduler_.get(), &GpuScheduler::PutChanged)); |
| 59 | 59 |
| 60 api_mock_->set_engine(gpu_scheduler_.get()); | 60 api_mock_->set_engine(gpu_scheduler_.get()); |
| 61 | 61 |
| 62 helper_.reset(new CommandBufferHelper(command_buffer_.get())); | 62 helper_.reset(new CommandBufferHelper(command_buffer_.get())); |
| 63 helper_->Initialize(kBufferSize); | 63 helper_->Initialize(kBufferSize); |
| 64 } | 64 } |
| 65 | 65 |
| 66 int32 GetToken() { | 66 int32 GetToken() { |
| 67 return command_buffer_->GetState().token; | 67 return command_buffer_->GetState().token; |
| 68 } | 68 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 void* pointer1 = allocator_->Alloc(kSize); | 252 void* pointer1 = allocator_->Alloc(kSize); |
| 253 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); | 253 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); |
| 254 | 254 |
| 255 // Check that the token has indeed passed. | 255 // Check that the token has indeed passed. |
| 256 EXPECT_LE(tokens[0], GetToken()); | 256 EXPECT_LE(tokens[0], GetToken()); |
| 257 | 257 |
| 258 allocator_->FreePendingToken(pointer1, helper_->InsertToken()); | 258 allocator_->FreePendingToken(pointer1, helper_->InsertToken()); |
| 259 } | 259 } |
| 260 | 260 |
| 261 } // namespace gpu | 261 } // namespace gpu |
| OLD | NEW |