diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-21 00:34:29 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-21 00:34:29 +0000 |
commit | a11e5c2a673d6447737c2f8282cff095e150a43a (patch) | |
tree | 1a3898a53d6e22107c97d22b006ede45c102c4f2 /cc/layers/texture_layer_unittest.cc | |
parent | 48ed2610d757483f2e4ebddda617fd7e92855d5a (diff) | |
download | chromium_src-a11e5c2a673d6447737c2f8282cff095e150a43a.zip chromium_src-a11e5c2a673d6447737c2f8282cff095e150a43a.tar.gz chromium_src-a11e5c2a673d6447737c2f8282cff095e150a43a.tar.bz2 |
Revert "Add gpu::MailboxHolder to hold state for a gpu::Mailbox"
This reverts commit 9ee2343406a6fae9c8aacc7303f7b1e5a04aab9e.
This patch is the source of the top crash in canary. See the bug
for more details.
TBR=sheu
NOTREECHECKS=true
BUG=336040
Review URL: https://codereview.chromium.org/129873005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers/texture_layer_unittest.cc')
-rw-r--r-- | cc/layers/texture_layer_unittest.cc | 87 |
1 files changed, 35 insertions, 52 deletions
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index 6b78a71..dc44a77 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc @@ -41,12 +41,6 @@ using ::testing::AnyNumber; namespace cc { namespace { -gpu::Mailbox MailboxFromString(const std::string& string) { - gpu::Mailbox mailbox; - mailbox.SetName(reinterpret_cast<const int8*>(string.data())); - return mailbox; -} - class MockLayerTreeHost : public LayerTreeHost { public: explicit MockLayerTreeHost(FakeLayerTreeHostClient* client) @@ -321,14 +315,12 @@ TEST_F(TextureLayerTest, RateLimiter) { class MockMailboxCallback { public: - MOCK_METHOD3(Release, - void(const std::string& mailbox, - uint32 sync_point, - bool lost_resource)); - MOCK_METHOD3(Release2, - void(base::SharedMemory* shared_memory, - uint32 sync_point, - bool lost_resource)); + MOCK_METHOD3(Release, void(const std::string& mailbox, + unsigned sync_point, + bool lost_resource)); + MOCK_METHOD3(Release2, void(base::SharedMemory* shared_memory, + unsigned sync_point, + bool lost_resource)); }; struct CommonMailboxObjects { @@ -344,12 +336,13 @@ struct CommonMailboxObjects { release_mailbox2_ = base::Bind(&MockMailboxCallback::Release, base::Unretained(&mock_callback_), 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_); + gpu::Mailbox m1; + m1.SetName(reinterpret_cast<const int8*>(mailbox_name1_.data())); + mailbox1_ = TextureMailbox(m1, sync_point1_); + gpu::Mailbox m2; + m2.SetName(reinterpret_cast<const int8*>(mailbox_name2_.data())); + mailbox2_ = TextureMailbox(m2, sync_point2_); + gfx::Size size(128, 128); EXPECT_TRUE(shared_memory_->CreateAndMapAnonymous(4 * size.GetArea())); release_mailbox3_ = base::Bind(&MockMailboxCallback::Release2, @@ -367,14 +360,14 @@ struct CommonMailboxObjects { TextureMailbox mailbox1_; TextureMailbox mailbox2_; TextureMailbox mailbox3_; - uint32 sync_point1_; - uint32 sync_point2_; + unsigned sync_point1_; + unsigned sync_point2_; scoped_ptr<base::SharedMemory> shared_memory_; }; -class TestMailboxHolder : public TextureLayer::TextureMailboxHolder { +class TestMailboxHolder : public TextureLayer::MailboxHolder { public: - using TextureLayer::TextureMailboxHolder::Create; + using TextureLayer::MailboxHolder::Create; protected: virtual ~TestMailboxHolder() {} @@ -761,7 +754,7 @@ class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest { commit_count_(0) {} // Make sure callback is received on main and doesn't block the impl thread. - void ReleaseCallback(uint32 sync_point, bool lost_resource) { + void ReleaseCallback(unsigned sync_point, bool lost_resource) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); EXPECT_FALSE(lost_resource); ++callback_count_; @@ -769,14 +762,12 @@ class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest { void SetMailbox(char mailbox_char) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); + TextureMailbox mailbox(std::string(64, mailbox_char)); scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( base::Bind( &TextureLayerImplWithMailboxThreadedCallback::ReleaseCallback, base::Unretained(this))); - layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), - callback.Pass()); + layer_->SetTextureMailbox(mailbox, callback.Pass()); } virtual void BeginTest() OVERRIDE { @@ -1026,16 +1017,14 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest { wait_thread_.Start(); } - static void ReleaseCallback(uint32 sync_point, bool lost_resource) {} + static void ReleaseCallback(unsigned sync_point, bool lost_resource) {} void SetMailbox(char mailbox_char) { + TextureMailbox mailbox(std::string(64, mailbox_char)); scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( base::Bind( &TextureLayerMailboxIsActivatedDuringCommit::ReleaseCallback)); - layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), - callback.Pass()); + layer_->SetTextureMailbox(mailbox, callback.Pass()); } virtual void BeginTest() OVERRIDE { @@ -1700,23 +1689,22 @@ class TextureLayerNoExtraCommitForMailboxTest return 0; } virtual bool PrepareTextureMailbox( - TextureMailbox* texture_mailbox, + TextureMailbox* mailbox, scoped_ptr<SingleReleaseCallback>* release_callback, bool use_shared_memory) OVERRIDE { if (layer_tree_host()->source_frame_number() == 1) { - *texture_mailbox = TextureMailbox(); + *mailbox = TextureMailbox(); return true; } - *texture_mailbox = TextureMailbox( - MailboxFromString(std::string(64, '1')), GL_TEXTURE_2D, 0); + *mailbox = TextureMailbox(std::string(64, '1')); *release_callback = SingleReleaseCallback::Create( base::Bind(&TextureLayerNoExtraCommitForMailboxTest::MailboxReleased, base::Unretained(this))); return true; } - void MailboxReleased(uint32 sync_point, bool lost_resource) { + void MailboxReleased(unsigned sync_point, bool lost_resource) { EXPECT_EQ(2, layer_tree_host()->source_frame_number()); EndTest(); } @@ -1833,11 +1821,10 @@ class TextureLayerChangeInvisibleMailboxTest } TextureMailbox MakeMailbox(char name) { - return TextureMailbox( - MailboxFromString(std::string(64, name)), GL_TEXTURE_2D, 0); + return TextureMailbox(std::string(64, name)); } - void MailboxReleased(uint32 sync_point, bool lost_resource) { + void MailboxReleased(unsigned sync_point, bool lost_resource) { ++mailbox_returned_; } @@ -2028,7 +2015,7 @@ SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TextureLayerLostContextTest); class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest { public: - void ReleaseCallback(uint32 sync_point, bool lost_resource) { + void ReleaseCallback(unsigned sync_point, bool lost_resource) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); EXPECT_FALSE(lost_resource); ++callback_count_; @@ -2037,14 +2024,12 @@ class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest { void SetMailbox(char mailbox_char) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); + TextureMailbox mailbox(std::string(64, mailbox_char)); scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( base::Bind( &TextureLayerWithMailboxMainThreadDeleted::ReleaseCallback, base::Unretained(this))); - layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), - callback.Pass()); + layer_->SetTextureMailbox(mailbox, callback.Pass()); } virtual void SetupTree() OVERRIDE { @@ -2102,7 +2087,7 @@ SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { public: - void ReleaseCallback(uint32 sync_point, bool lost_resource) { + void ReleaseCallback(unsigned sync_point, bool lost_resource) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); EXPECT_FALSE(lost_resource); ++callback_count_; @@ -2111,14 +2096,12 @@ class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { void SetMailbox(char mailbox_char) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); + TextureMailbox mailbox(std::string(64, mailbox_char)); scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( base::Bind( &TextureLayerWithMailboxImplThreadDeleted::ReleaseCallback, base::Unretained(this))); - layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), - callback.Pass()); + layer_->SetTextureMailbox(mailbox, callback.Pass()); } virtual void SetupTree() OVERRIDE { |