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

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

Issue 558513003: command_buffer: Batch command processing to reduce handler overheads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 3 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
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 virtual void SetUp() { 160 virtual void SetUp() {
161 decoder_.set_engine(&engine_); 161 decoder_.set_engine(&engine_);
162 } 162 }
163 163
164 virtual void TearDown() { 164 virtual void TearDown() {
165 } 165 }
166 166
167 template <typename T> 167 template <typename T>
168 error::Error ExecuteCmd(const T& cmd) { 168 error::Error ExecuteCmd(const T& cmd) {
169 COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed); 169 COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed);
170 return decoder_.DoCommand(cmd.kCmdId, 170 return decoder_.DoCommands(
171 ComputeNumEntries(sizeof(cmd)) - 1, 171 1, (const void*)&cmd, ComputeNumEntries(sizeof(cmd)), 0);
172 &cmd);
173 } 172 }
174 173
175 template <typename T> 174 template <typename T>
176 error::Error ExecuteImmediateCmd(const T& cmd, size_t data_size) { 175 error::Error ExecuteImmediateCmd(const T& cmd, size_t data_size) {
177 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN); 176 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN);
178 return decoder_.DoCommand(cmd.kCmdId, 177 return decoder_.DoCommands(
179 ComputeNumEntries(sizeof(cmd) + data_size) - 1, 178 1, (const void*)&cmd, ComputeNumEntries(sizeof(cmd) + data_size), 0);
180 &cmd);
181 } 179 }
182 180
183 MockCommandBufferEngine engine_; 181 MockCommandBufferEngine engine_;
184 TestCommonDecoder decoder_; 182 TestCommonDecoder decoder_;
185 }; 183 };
186 184
187 TEST_F(CommonDecoderTest, Initialize) { 185 TEST_F(CommonDecoderTest, Initialize) {
188 EXPECT_EQ(0, engine_.GetGetOffset()); 186 EXPECT_EQ(0, engine_.GetGetOffset());
189 } 187 }
190 188
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory); 504 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory);
507 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 505 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
508 506
509 // Check that it fails if the size is invalid 507 // Check that it fails if the size is invalid
510 cmd.Init(kBucketId, 0, sizeof(kData) + 1, 508 cmd.Init(kBucketId, 0, sizeof(kData) + 1,
511 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory); 509 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory);
512 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 510 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
513 } 511 }
514 512
515 } // namespace gpu 513 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/cmd_parser_test.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698