diff options
-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 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host_ui_shim.cc | 5 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura_unittest.cc | 4 | ||||
-rw-r--r-- | content/common/cc_messages_unittest.cc | 22 | ||||
-rwxr-xr-x | gpu/command_buffer/build_gles2_cmd_buffer.py | 4 | ||||
-rw-r--r-- | gpu/command_buffer/common/mailbox.h | 7 | ||||
-rw-r--r-- | gpu/command_buffer/service/mailbox_manager.h | 5 |
10 files changed, 63 insertions, 45 deletions
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index 88ff040..cfbe813 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 MailboxFromChar(char value) { +gpu::Mailbox MailboxFromString(const std::string& string) { gpu::Mailbox mailbox; - memset(mailbox.name, value, sizeof(mailbox.name)); + mailbox.SetName(reinterpret_cast<const int8*>(string.data())); return mailbox; } @@ -322,7 +322,7 @@ TEST_F(TextureLayerTest, RateLimiter) { class MockMailboxCallback { public: MOCK_METHOD3(Release, - void(const gpu::Mailbox& mailbox, + void(const std::string& mailbox, uint32 sync_point, bool lost_resource)); MOCK_METHOD3(Release2, @@ -333,8 +333,8 @@ class MockMailboxCallback { struct CommonMailboxObjects { CommonMailboxObjects() - : mailbox_name1_(MailboxFromChar('1')), - mailbox_name2_(MailboxFromChar('2')), + : mailbox_name1_(64, '1'), + mailbox_name2_(64, '2'), sync_point1_(1), sync_point2_(2), shared_memory_(new base::SharedMemory) { @@ -346,8 +346,10 @@ struct CommonMailboxObjects { mailbox_name2_); const uint32 arbitrary_target1 = 1; const uint32 arbitrary_target2 = 2; - mailbox1_ = TextureMailbox(mailbox_name1_, arbitrary_target1, sync_point1_); - mailbox2_ = TextureMailbox(mailbox_name2_, arbitrary_target2, sync_point2_); + mailbox1_ = TextureMailbox( + MailboxFromString(mailbox_name1_), arbitrary_target1, sync_point1_); + mailbox2_ = TextureMailbox( + MailboxFromString(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, @@ -356,8 +358,8 @@ struct CommonMailboxObjects { mailbox3_ = TextureMailbox(shared_memory_.get(), size); } - gpu::Mailbox mailbox_name1_; - gpu::Mailbox mailbox_name2_; + std::string mailbox_name1_; + std::string mailbox_name2_; MockMailboxCallback mock_callback_; ReleaseCallback release_mailbox1_; ReleaseCallback release_mailbox2_; @@ -772,7 +774,8 @@ class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest { &TextureLayerImplWithMailboxThreadedCallback::ReleaseCallback, base::Unretained(this))); layer_->SetTextureMailbox( - TextureMailbox(MailboxFromChar(mailbox_char), GL_TEXTURE_2D, 0), + TextureMailbox( + MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), callback.Pass()); } @@ -990,7 +993,8 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest { base::Bind( &TextureLayerMailboxIsActivatedDuringCommit::ReleaseCallback)); layer_->SetTextureMailbox( - TextureMailbox(MailboxFromChar(mailbox_char), GL_TEXTURE_2D, 0), + TextureMailbox( + MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), callback.Pass()); } @@ -1636,7 +1640,8 @@ class TextureLayerNoExtraCommitForMailboxTest return true; } - *texture_mailbox = TextureMailbox(MailboxFromChar('1'), GL_TEXTURE_2D, 0); + *texture_mailbox = TextureMailbox( + MailboxFromString(std::string(64, '1')), GL_TEXTURE_2D, 0); *release_callback = SingleReleaseCallback::Create( base::Bind(&TextureLayerNoExtraCommitForMailboxTest::MailboxReleased, base::Unretained(this))); @@ -1747,7 +1752,8 @@ class TextureLayerChangeInvisibleMailboxTest } TextureMailbox MakeMailbox(char name) { - return TextureMailbox(MailboxFromChar(name), GL_TEXTURE_2D, 0); + return TextureMailbox( + MailboxFromString(std::string(64, name)), GL_TEXTURE_2D, 0); } void MailboxReleased(uint32 sync_point, bool lost_resource) { @@ -1880,7 +1886,8 @@ class TextureLayerReleaseResourcesBase TextureMailbox* mailbox, scoped_ptr<SingleReleaseCallback>* release_callback, bool use_shared_memory) OVERRIDE { - *mailbox = TextureMailbox(MailboxFromChar('1'), GL_TEXTURE_2D, 0); + *mailbox = TextureMailbox( + MailboxFromString(std::string(64, '1')), GL_TEXTURE_2D, 0); *release_callback = SingleReleaseCallback::Create( base::Bind(&TextureLayerReleaseResourcesBase::MailboxReleased, base::Unretained(this))); @@ -2036,7 +2043,8 @@ class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest { &TextureLayerWithMailboxMainThreadDeleted::ReleaseCallback, base::Unretained(this))); layer_->SetTextureMailbox( - TextureMailbox(MailboxFromChar(mailbox_char), GL_TEXTURE_2D, 0), + TextureMailbox( + MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), callback.Pass()); } @@ -2109,7 +2117,8 @@ class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { &TextureLayerWithMailboxImplThreadDeleted::ReleaseCallback, base::Unretained(this))); layer_->SetTextureMailbox( - TextureMailbox(MailboxFromChar(mailbox_char), GL_TEXTURE_2D, 0), + TextureMailbox( + MailboxFromString(std::string(64, 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 7c2edf0..07247c6 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, GL_MAILBOX_SIZE_CHROMIUM); + memset(mailbox, 0, sizeof(GLbyte[64])); memcpy(mailbox, &next_mailbox_, sizeof(next_mailbox_)); ++next_mailbox_; } @@ -322,7 +322,7 @@ class ResourceProviderContext : public TestWebGraphicsContext3D { } struct PendingProduceTexture { - GLbyte mailbox[GL_MAILBOX_SIZE_CHROMIUM]; + GLbyte mailbox[64]; 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[GL_MAILBOX_SIZE_CHROMIUM] = {0}; + int8 name[64] = { 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[GL_MAILBOX_SIZE_CHROMIUM] = {0}; + int8 name[64] = { 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 27a7b4c..6394b61 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, GL_MAILBOX_SIZE_CHROMIUM); + memset(mailbox, 0, 64); return; } diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc index 7fe0ece..a820606 100644 --- a/cc/trees/layer_tree_host_unittest_delegated.cc +++ b/cc/trees/layer_tree_host_unittest_delegated.cc @@ -136,10 +136,12 @@ class LayerTreeHostDelegatedTest : public LayerTreeTest { TransferableResource resource; resource.id = resource_id; resource.mailbox_holder.texture_target = GL_TEXTURE_2D; - 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}; + 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 + }; resource.mailbox_holder.mailbox.SetName(arbitrary_mailbox); frame->resource_list.push_back(resource); } diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc index 0edcbde..4d46484 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc @@ -22,6 +22,11 @@ #include "content/public/browser/browser_thread.h" #include "ui/gl/gl_switches.h" +// From gl2/gl2ext.h. +#ifndef GL_MAILBOX_SIZE_CHROMIUM +#define GL_MAILBOX_SIZE_CHROMIUM 64 +#endif + namespace content { namespace { diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index 755b253..6911f28 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc @@ -841,9 +841,7 @@ scoped_ptr<cc::CompositorFrame> MakeGLFrame(float scale_factor, frame->metadata.device_scale_factor = scale_factor; frame->gl_frame_data.reset(new cc::GLFrameData); frame->gl_frame_data->sync_point = 1; - memset(frame->gl_frame_data->mailbox.name, - '1', - sizeof(frame->gl_frame_data->mailbox.name)); + memset(frame->gl_frame_data->mailbox.name, '1', 64); frame->gl_frame_data->size = size; frame->gl_frame_data->sub_buffer_rect = damage; return frame.Pass(); diff --git a/content/common/cc_messages_unittest.cc b/content/common/cc_messages_unittest.cc index 7711c23..11b9ea2 100644 --- a/content/common/cc_messages_unittest.cc +++ b/content/common/cc_messages_unittest.cc @@ -641,15 +641,19 @@ TEST_F(CCMessagesTest, Resources) { unsigned int arbitrary_uint1 = 71234838; unsigned int arbitrary_uint2 = 53589793; - GLbyte arbitrary_mailbox1[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}; - - GLbyte arbitrary_mailbox2[GL_MAILBOX_SIZE_CHROMIUM] = { - 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, - 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, 8, 7, - 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, 8, 7}; + GLbyte arbitrary_mailbox1[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_mailbox2[64] = { + 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, + 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, + 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, + 0, 9, 8, 7 + }; TransferableResource arbitrary_resource1; arbitrary_resource1.id = 2178312; diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 23dacf1..4eb9c47 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -1327,7 +1327,7 @@ _FUNCTION_INFO = { 'decoder_func': 'DoConsumeTextureCHROMIUM', 'type': 'PUT', 'data_type': 'GLbyte', - 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM + 'count': 64, 'unit_test': False, 'extension': True, 'chromium': True, @@ -1910,7 +1910,7 @@ _FUNCTION_INFO = { 'decoder_func': 'DoProduceTextureCHROMIUM', 'type': 'PUT', 'data_type': 'GLbyte', - 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM + 'count': 64, 'unit_test': False, 'extension': True, 'chromium': True, diff --git a/gpu/command_buffer/common/mailbox.h b/gpu/command_buffer/common/mailbox.h index ef9221d..938167f 100644 --- a/gpu/command_buffer/common/mailbox.h +++ b/gpu/command_buffer/common/mailbox.h @@ -10,11 +10,6 @@ #include "gpu/command_buffer/common/types.h" #include "gpu/gpu_export.h" -// From gl2/gl2ext.h. -#ifndef GL_MAILBOX_SIZE_CHROMIUM -#define GL_MAILBOX_SIZE_CHROMIUM 64 -#endif - namespace gpu { struct GPU_EXPORT Mailbox { @@ -22,7 +17,7 @@ struct GPU_EXPORT Mailbox { bool IsZero() const; void SetZero(); void SetName(const int8* name); - int8 name[GL_MAILBOX_SIZE_CHROMIUM]; + int8 name[64]; bool operator<(const Mailbox& other) const { return memcmp(this, &other, sizeof other) < 0; } diff --git a/gpu/command_buffer/service/mailbox_manager.h b/gpu/command_buffer/service/mailbox_manager.h index fadf2bd..e06ef2d 100644 --- a/gpu/command_buffer/service/mailbox_manager.h +++ b/gpu/command_buffer/service/mailbox_manager.h @@ -14,6 +14,11 @@ #include "gpu/command_buffer/common/mailbox.h" #include "gpu/gpu_export.h" +// From gl2/gl2ext.h. +#ifndef GL_MAILBOX_SIZE_CHROMIUM +#define GL_MAILBOX_SIZE_CHROMIUM 64 +#endif + typedef signed char GLbyte; namespace gpu { |