diff options
Diffstat (limited to 'cc')
-rw-r--r-- | cc/layers/texture_layer_unittest.cc | 41 | ||||
-rw-r--r-- | cc/resources/resource_provider_unittest.cc | 8 | ||||
-rw-r--r-- | cc/test/test_web_graphics_context_3d.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_delegated.cc | 10 |
4 files changed, 25 insertions, 36 deletions
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index cfbe813..88ff040 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc @@ -41,9 +41,9 @@ using ::testing::AnyNumber; namespace cc { namespace { -gpu::Mailbox MailboxFromString(const std::string& string) { +gpu::Mailbox MailboxFromChar(char value) { gpu::Mailbox mailbox; - mailbox.SetName(reinterpret_cast<const int8*>(string.data())); + memset(mailbox.name, value, sizeof(mailbox.name)); return mailbox; } @@ -322,7 +322,7 @@ TEST_F(TextureLayerTest, RateLimiter) { class MockMailboxCallback { public: MOCK_METHOD3(Release, - void(const std::string& mailbox, + void(const gpu::Mailbox& mailbox, uint32 sync_point, bool lost_resource)); MOCK_METHOD3(Release2, @@ -333,8 +333,8 @@ class MockMailboxCallback { struct CommonMailboxObjects { CommonMailboxObjects() - : mailbox_name1_(64, '1'), - mailbox_name2_(64, '2'), + : mailbox_name1_(MailboxFromChar('1')), + mailbox_name2_(MailboxFromChar('2')), sync_point1_(1), sync_point2_(2), shared_memory_(new base::SharedMemory) { @@ -346,10 +346,8 @@ struct CommonMailboxObjects { mailbox_name2_); const uint32 arbitrary_target1 = 1; const uint32 arbitrary_target2 = 2; - mailbox1_ = TextureMailbox( - MailboxFromString(mailbox_name1_), arbitrary_target1, sync_point1_); - mailbox2_ = TextureMailbox( - MailboxFromString(mailbox_name2_), arbitrary_target2, sync_point2_); + mailbox1_ = TextureMailbox(mailbox_name1_, arbitrary_target1, sync_point1_); + mailbox2_ = TextureMailbox(mailbox_name2_, arbitrary_target2, sync_point2_); gfx::Size size(128, 128); EXPECT_TRUE(shared_memory_->CreateAndMapAnonymous(4 * size.GetArea())); release_mailbox3_ = base::Bind(&MockMailboxCallback::Release2, @@ -358,8 +356,8 @@ struct CommonMailboxObjects { mailbox3_ = TextureMailbox(shared_memory_.get(), size); } - std::string mailbox_name1_; - std::string mailbox_name2_; + gpu::Mailbox mailbox_name1_; + gpu::Mailbox mailbox_name2_; MockMailboxCallback mock_callback_; ReleaseCallback release_mailbox1_; ReleaseCallback release_mailbox2_; @@ -774,8 +772,7 @@ class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest { &TextureLayerImplWithMailboxThreadedCallback::ReleaseCallback, base::Unretained(this))); layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), + TextureMailbox(MailboxFromChar(mailbox_char), GL_TEXTURE_2D, 0), callback.Pass()); } @@ -993,8 +990,7 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest { base::Bind( &TextureLayerMailboxIsActivatedDuringCommit::ReleaseCallback)); layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), + TextureMailbox(MailboxFromChar(mailbox_char), GL_TEXTURE_2D, 0), callback.Pass()); } @@ -1640,8 +1636,7 @@ class TextureLayerNoExtraCommitForMailboxTest return true; } - *texture_mailbox = TextureMailbox( - MailboxFromString(std::string(64, '1')), GL_TEXTURE_2D, 0); + *texture_mailbox = TextureMailbox(MailboxFromChar('1'), GL_TEXTURE_2D, 0); *release_callback = SingleReleaseCallback::Create( base::Bind(&TextureLayerNoExtraCommitForMailboxTest::MailboxReleased, base::Unretained(this))); @@ -1752,8 +1747,7 @@ class TextureLayerChangeInvisibleMailboxTest } TextureMailbox MakeMailbox(char name) { - return TextureMailbox( - MailboxFromString(std::string(64, name)), GL_TEXTURE_2D, 0); + return TextureMailbox(MailboxFromChar(name), GL_TEXTURE_2D, 0); } void MailboxReleased(uint32 sync_point, bool lost_resource) { @@ -1886,8 +1880,7 @@ class TextureLayerReleaseResourcesBase TextureMailbox* mailbox, scoped_ptr<SingleReleaseCallback>* release_callback, bool use_shared_memory) OVERRIDE { - *mailbox = TextureMailbox( - MailboxFromString(std::string(64, '1')), GL_TEXTURE_2D, 0); + *mailbox = TextureMailbox(MailboxFromChar('1'), GL_TEXTURE_2D, 0); *release_callback = SingleReleaseCallback::Create( base::Bind(&TextureLayerReleaseResourcesBase::MailboxReleased, base::Unretained(this))); @@ -2043,8 +2036,7 @@ class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest { &TextureLayerWithMailboxMainThreadDeleted::ReleaseCallback, base::Unretained(this))); layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), + TextureMailbox(MailboxFromChar(mailbox_char), GL_TEXTURE_2D, 0), callback.Pass()); } @@ -2117,8 +2109,7 @@ class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { &TextureLayerWithMailboxImplThreadDeleted::ReleaseCallback, base::Unretained(this))); layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), + TextureMailbox(MailboxFromChar(mailbox_char), GL_TEXTURE_2D, 0), callback.Pass()); } diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc index 07247c6..7c2edf0 100644 --- a/cc/resources/resource_provider_unittest.cc +++ b/cc/resources/resource_provider_unittest.cc @@ -105,7 +105,7 @@ class ContextSharedData { uint32 InsertSyncPoint() { return next_sync_point_++; } void GenMailbox(GLbyte* mailbox) { - memset(mailbox, 0, sizeof(GLbyte[64])); + memset(mailbox, 0, GL_MAILBOX_SIZE_CHROMIUM); memcpy(mailbox, &next_mailbox_, sizeof(next_mailbox_)); ++next_mailbox_; } @@ -322,7 +322,7 @@ class ResourceProviderContext : public TestWebGraphicsContext3D { } struct PendingProduceTexture { - GLbyte mailbox[64]; + GLbyte mailbox[GL_MAILBOX_SIZE_CHROMIUM]; scoped_refptr<TestTexture> texture; }; typedef ScopedPtrDeque<PendingProduceTexture> PendingProduceTextureList; @@ -346,7 +346,7 @@ class TestSharedBitmapManager : public SharedBitmapManager { OVERRIDE { scoped_ptr<base::SharedMemory> memory(new base::SharedMemory); memory->CreateAndMapAnonymous(size.GetArea() * 4); - int8 name[64] = { 0 }; + int8 name[GL_MAILBOX_SIZE_CHROMIUM] = {0}; name[0] = count_++; SharedBitmapId id; id.SetName(name); @@ -366,7 +366,7 @@ class TestSharedBitmapManager : public SharedBitmapManager { virtual scoped_ptr<SharedBitmap> GetBitmapForSharedMemory( base::SharedMemory* memory) OVERRIDE { - int8 name[64] = { 0 }; + int8 name[GL_MAILBOX_SIZE_CHROMIUM] = {0}; name[0] = count_++; SharedBitmapId id; id.SetName(name); diff --git a/cc/test/test_web_graphics_context_3d.cc b/cc/test/test_web_graphics_context_3d.cc index 6394b61..27a7b4c 100644 --- a/cc/test/test_web_graphics_context_3d.cc +++ b/cc/test/test_web_graphics_context_3d.cc @@ -436,7 +436,7 @@ void TestWebGraphicsContext3D::genMailboxCHROMIUM(GLbyte* mailbox) { --times_gen_mailbox_succeeds_; } if (context_lost_) { - memset(mailbox, 0, 64); + memset(mailbox, 0, GL_MAILBOX_SIZE_CHROMIUM); return; } diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc index a820606..7fe0ece 100644 --- a/cc/trees/layer_tree_host_unittest_delegated.cc +++ b/cc/trees/layer_tree_host_unittest_delegated.cc @@ -136,12 +136,10 @@ class LayerTreeHostDelegatedTest : public LayerTreeTest { TransferableResource resource; resource.id = resource_id; resource.mailbox_holder.texture_target = GL_TEXTURE_2D; - GLbyte arbitrary_mailbox[64] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, - 1, 2, 3, 4 - }; + GLbyte arbitrary_mailbox[GL_MAILBOX_SIZE_CHROMIUM] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, + 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}; resource.mailbox_holder.mailbox.SetName(arbitrary_mailbox); frame->resource_list.push_back(resource); } |