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

Side by Side Diff: gpu/command_buffer/client/mapped_memory_unittest.cc

Issue 8340003: Make GLES2Implementation use a larger chunk size for mapping functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typos and formatting Created 9 years, 1 month 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
« no previous file with comments | « gpu/command_buffer/client/mapped_memory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "gpu/command_buffer/client/mapped_memory.h" 5 #include "gpu/command_buffer/client/mapped_memory.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/mac/scoped_nsautorelease_pool.h" 8 #include "base/mac/scoped_nsautorelease_pool.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "gpu/command_buffer/client/cmd_buffer_helper.h" 10 #include "gpu/command_buffer/client/cmd_buffer_helper.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 manager_->Free(m2); 266 manager_->Free(m2);
267 EXPECT_EQ(2u, manager_->num_chunks()); 267 EXPECT_EQ(2u, manager_->num_chunks());
268 manager_->FreeUnused(); 268 manager_->FreeUnused();
269 EXPECT_EQ(1u, manager_->num_chunks()); 269 EXPECT_EQ(1u, manager_->num_chunks());
270 manager_->Free(m1); 270 manager_->Free(m1);
271 EXPECT_EQ(1u, manager_->num_chunks()); 271 EXPECT_EQ(1u, manager_->num_chunks());
272 manager_->FreeUnused(); 272 manager_->FreeUnused();
273 EXPECT_EQ(0u, manager_->num_chunks()); 273 EXPECT_EQ(0u, manager_->num_chunks());
274 } 274 }
275 275
276 TEST_F(MappedMemoryManagerTest, ChunkSizeMultiple) {
277 const unsigned int kSize = 1024;
278 manager_->set_chunk_size_multiple(kSize * 2);
279 // Check if we allocate less than the chunk size multiple we get
280 // chunks arounded up.
281 int32 id1 = -1;
282 unsigned int offset1 = 0xFFFFFFFFU;
283 void* mem1 = manager_->Alloc(kSize, &id1, &offset1);
284 int32 id2 = -1;
285 unsigned int offset2 = 0xFFFFFFFFU;
286 void* mem2 = manager_->Alloc(kSize, &id2, &offset2);
287 int32 id3 = -1;
288 unsigned int offset3 = 0xFFFFFFFFU;
289 void* mem3 = manager_->Alloc(kSize, &id3, &offset3);
290 ASSERT_TRUE(mem1);
291 ASSERT_TRUE(mem2);
292 ASSERT_TRUE(mem3);
293 EXPECT_NE(-1, id1);
294 EXPECT_EQ(id1, id2);
295 EXPECT_NE(id2, id3);
296 EXPECT_EQ(0u, offset1);
297 EXPECT_EQ(kSize, offset2);
298 EXPECT_EQ(0u, offset3);
299 }
300
276 } // namespace gpu 301 } // namespace gpu
277 302
278 303
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/mapped_memory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698