Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: gpu/command_buffer/client/ring_buffer_test.cc

Issue 8953006: Free the command buffer when tabs are switched (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/client/mapped_memory_unittest.cc ('k') | gpu/command_buffer/service/gpu_scheduler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/ring_buffer_test.cc
diff --git a/gpu/command_buffer/client/ring_buffer_test.cc b/gpu/command_buffer/client/ring_buffer_test.cc
index 8b8e46e1ae829d42a8ef3d982b4b2ae41c570c65..86dc020621813a13a5e4dcf53e99da192ac49b06 100644
--- a/gpu/command_buffer/client/ring_buffer_test.cc
+++ b/gpu/command_buffer/client/ring_buffer_test.cc
@@ -36,8 +36,8 @@ class BaseRingBufferTest : public testing::Test {
class DoJumpCommand {
public:
- explicit DoJumpCommand(CommandParser* parser)
- : parser_(parser) {
+ explicit DoJumpCommand(GpuScheduler* gpu_scheduler)
+ : gpu_scheduler_(gpu_scheduler) {
}
error::Error DoCommand(
@@ -45,12 +45,12 @@ class BaseRingBufferTest : public testing::Test {
unsigned int arg_count,
const void* cmd_data) {
const cmd::Jump* jump_cmd = static_cast<const cmd::Jump*>(cmd_data);
- parser_->set_get(jump_cmd->offset);
+ gpu_scheduler_->parser()->set_get(jump_cmd->offset);
return error::kNoError;
};
private:
- CommandParser* parser_;
+ GpuScheduler* gpu_scheduler_;
};
virtual void SetUp() {
@@ -67,27 +67,21 @@ class BaseRingBufferTest : public testing::Test {
command_buffer_.reset(new CommandBufferService);
command_buffer_->Initialize();
- parser_ = new CommandParser(api_mock_.get());
-
gpu_scheduler_.reset(new GpuScheduler(
- command_buffer_.get(), NULL, parser_));
+ command_buffer_.get(), api_mock_.get(), NULL));
command_buffer_->SetPutOffsetChangeCallback(base::Bind(
&GpuScheduler::PutChanged, base::Unretained(gpu_scheduler_.get())));
+ command_buffer_->SetGetBufferChangeCallback(base::Bind(
+ &GpuScheduler::SetGetBuffer, base::Unretained(gpu_scheduler_.get())));
api_mock_->set_engine(gpu_scheduler_.get());
- do_jump_command_.reset(new DoJumpCommand(parser_));
+ do_jump_command_.reset(new DoJumpCommand(gpu_scheduler_.get()));
EXPECT_CALL(*api_mock_, DoCommand(cmd::kJump, _, _))
.WillRepeatedly(
Invoke(do_jump_command_.get(), &DoJumpCommand::DoCommand));
helper_.reset(new CommandBufferHelper(command_buffer_.get()));
helper_->Initialize(kBufferSize);
-
- // Note: parser->SetBuffer would normally be called through
- // helper_->Initialize but currently it needs a GpuCommandBufferStub as the
- // CommandBuffer instead of the CommandBufferService for that to happen.
- Buffer ring_buffer = helper_->get_ring_buffer();
- parser_->SetBuffer(ring_buffer.ptr, ring_buffer.size, 0, ring_buffer.size);
}
int32 GetToken() {
@@ -101,7 +95,6 @@ class BaseRingBufferTest : public testing::Test {
scoped_ptr<AsyncAPIMock> api_mock_;
scoped_ptr<CommandBufferService> command_buffer_;
scoped_ptr<GpuScheduler> gpu_scheduler_;
- CommandParser* parser_;
scoped_ptr<CommandBufferHelper> helper_;
scoped_ptr<DoJumpCommand> do_jump_command_;
};
« no previous file with comments | « gpu/command_buffer/client/mapped_memory_unittest.cc ('k') | gpu/command_buffer/service/gpu_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698