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

Side by Side Diff: gpu/command_buffer/service/common_decoder_unittest.cc

Issue 213353005: Refactor gpu::Buffer to allow different types of backing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix pointer alignment in tests Created 6 years, 8 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "gpu/command_buffer/service/common_decoder.h" 5 #include "gpu/command_buffer/service/common_decoder.h"
6 #include "gpu/command_buffer/service/cmd_buffer_engine.h" 6 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace gpu { 9 namespace gpu {
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 static const size_t kBufferSize = 1024; 76 static const size_t kBufferSize = 1024;
77 static const int32 kValidOffset = kBufferSize / 2; 77 static const int32 kValidOffset = kBufferSize / 2;
78 static const int32 kInvalidOffset = kBufferSize; 78 static const int32 kInvalidOffset = kBufferSize;
79 79
80 MockCommandBufferEngine() 80 MockCommandBufferEngine()
81 : CommandBufferEngine(), 81 : CommandBufferEngine(),
82 token_(), 82 token_(),
83 get_offset_(0) { 83 get_offset_(0) {
84 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); 84 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory());
85 shared_memory->CreateAndMapAnonymous(kBufferSize); 85 shared_memory->CreateAndMapAnonymous(kBufferSize);
86 buffer_ = new gpu::Buffer(shared_memory.Pass(), kBufferSize); 86 buffer_ = MakeBufferFromSharedMemory(shared_memory.Pass(), kBufferSize);
87 } 87 }
88 88
89 // Overridden from CommandBufferEngine. 89 // Overridden from CommandBufferEngine.
90 virtual scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32 shm_id) 90 virtual scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32 shm_id)
91 OVERRIDE { 91 OVERRIDE {
92 if (IsValidSharedMemoryId(shm_id)) 92 if (IsValidSharedMemoryId(shm_id))
93 return buffer_; 93 return buffer_;
94 return NULL; 94 return NULL;
95 } 95 }
96 96
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory); 506 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory);
507 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 507 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
508 508
509 // Check that it fails if the size is invalid 509 // Check that it fails if the size is invalid
510 cmd.Init(kBucketId, 0, sizeof(kData) + 1, 510 cmd.Init(kBucketId, 0, sizeof(kData) + 1,
511 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory); 511 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory);
512 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 512 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
513 } 513 }
514 514
515 } // namespace gpu 515 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698