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

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

Issue 367002: Added Pepper 3D render context that instantiates the GPU plugin.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 class MockCommandBufferEngine : public CommandBufferEngine { 71 class MockCommandBufferEngine : public CommandBufferEngine {
72 public: 72 public:
73 static const int32 kValidShmId = 1; 73 static const int32 kValidShmId = 1;
74 74
75 MockCommandBufferEngine() 75 MockCommandBufferEngine()
76 : CommandBufferEngine(), 76 : CommandBufferEngine(),
77 token_() { 77 token_() {
78 } 78 }
79 79
80 // Overridden from CommandBufferEngine. 80 // Overridden from CommandBufferEngine.
81 virtual void* GetSharedMemoryAddress(int32 shm_id) { 81 virtual Buffer GetSharedMemoryBuffer(int32 shm_id) {
82 return (shm_id == kValidShmId) ? buffer_ : NULL; 82 Buffer buffer;
83 } 83 if (shm_id == kValidShmId) {
84 84 buffer.ptr = buffer_;
85 // Overridden from CommandBufferEngine. 85 buffer.size = kBufferSize;
86 virtual size_t GetSharedMemorySize(int32 shm_id) { 86 }
87 return (shm_id == kValidShmId) ? kBufferSize : 0; 87 return buffer;
88 } 88 }
89 89
90 template <typename T> 90 template <typename T>
91 T GetSharedMemoryAs(uint32 offset) { 91 T GetSharedMemoryAs(uint32 offset) {
92 DCHECK(offset < kBufferSize); 92 DCHECK(offset < kBufferSize);
93 return reinterpret_cast<T>(&buffer_[offset]); 93 return reinterpret_cast<T>(&buffer_[offset]);
94 } 94 }
95 95
96 uint32 GetSharedMemoryOffset(const void* memory) { 96 uint32 GetSharedMemoryOffset(const void* memory) {
97 ptrdiff_t offset = reinterpret_cast<const int8*>(memory) - &buffer_[0]; 97 ptrdiff_t offset = reinterpret_cast<const int8*>(memory) - &buffer_[0];
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 // Check that it fails if the size is invalid 410 // Check that it fails if the size is invalid
411 cmd.Init(kBucketId, 0, sizeof(kData) + 1, 411 cmd.Init(kBucketId, 0, sizeof(kData) + 1,
412 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory); 412 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory);
413 EXPECT_NE(parse_error::kParseNoError, ExecuteCmd(cmd)); 413 EXPECT_NE(parse_error::kParseNoError, ExecuteCmd(cmd));
414 } 414 }
415 415
416 416
417 } // namespace gpu 417 } // namespace gpu
418 418
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/common_decoder.cc ('k') | gpu/command_buffer/service/gpu_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698