| Index: cc/layers/texture_layer_unittest.cc
|
| diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc
|
| index 5b3955e07c16957ed1d6ca5e33d5790a1d8c1663..477e41cd6d4ae267c950acf2fb6f739ad3a89122 100644
|
| --- a/cc/layers/texture_layer_unittest.cc
|
| +++ b/cc/layers/texture_layer_unittest.cc
|
| @@ -315,12 +315,14 @@ TEST_F(TextureLayerTest, RateLimiter) {
|
|
|
| class MockMailboxCallback {
|
| public:
|
| - 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));
|
| + 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));
|
| };
|
|
|
| struct CommonMailboxObjects {
|
| @@ -338,10 +340,10 @@ struct CommonMailboxObjects {
|
| mailbox_name2_);
|
| gpu::Mailbox m1;
|
| m1.SetName(reinterpret_cast<const int8*>(mailbox_name1_.data()));
|
| - mailbox1_ = TextureMailbox(m1, sync_point1_);
|
| + mailbox1_ = TextureMailbox(m1, 1, sync_point1_);
|
| gpu::Mailbox m2;
|
| m2.SetName(reinterpret_cast<const int8*>(mailbox_name2_.data()));
|
| - mailbox2_ = TextureMailbox(m2, sync_point2_);
|
| + mailbox2_ = TextureMailbox(m2, 2, sync_point2_);
|
|
|
| gfx::Size size(128, 128);
|
| EXPECT_TRUE(shared_memory_->CreateAndMapAnonymous(4 * size.GetArea()));
|
| @@ -360,14 +362,14 @@ struct CommonMailboxObjects {
|
| TextureMailbox mailbox1_;
|
| TextureMailbox mailbox2_;
|
| TextureMailbox mailbox3_;
|
| - unsigned sync_point1_;
|
| - unsigned sync_point2_;
|
| + uint32 sync_point1_;
|
| + uint32 sync_point2_;
|
| scoped_ptr<base::SharedMemory> shared_memory_;
|
| };
|
|
|
| -class TestMailboxHolder : public TextureLayer::MailboxHolder {
|
| +class TestMailboxHolder : public TextureLayer::TextureMailboxHolder {
|
| public:
|
| - using TextureLayer::MailboxHolder::Create;
|
| + using TextureLayer::TextureMailboxHolder::Create;
|
|
|
| protected:
|
| virtual ~TestMailboxHolder() {}
|
| @@ -754,7 +756,7 @@ class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest {
|
| commit_count_(0) {}
|
|
|
| // Make sure callback is received on main and doesn't block the impl thread.
|
| - void ReleaseCallback(unsigned sync_point, bool lost_resource) {
|
| + void ReleaseCallback(uint32 sync_point, bool lost_resource) {
|
| EXPECT_EQ(true, main_thread_.CalledOnValidThread());
|
| EXPECT_FALSE(lost_resource);
|
| ++callback_count_;
|
| @@ -762,12 +764,15 @@ class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest {
|
|
|
| void SetMailbox(char mailbox_char) {
|
| EXPECT_EQ(true, main_thread_.CalledOnValidThread());
|
| - TextureMailbox mailbox(std::string(64, mailbox_char));
|
| + gpu::Mailbox mailbox;
|
| + mailbox.SetName(
|
| + reinterpret_cast<const int8*>(std::string(64, mailbox_char).data()));
|
| scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
|
| base::Bind(
|
| &TextureLayerImplWithMailboxThreadedCallback::ReleaseCallback,
|
| base::Unretained(this)));
|
| - layer_->SetTextureMailbox(mailbox, callback.Pass());
|
| + layer_->SetTextureMailbox(TextureMailbox(mailbox, GL_TEXTURE_2D, 0),
|
| + callback.Pass());
|
| }
|
|
|
| virtual void BeginTest() OVERRIDE {
|
| @@ -1017,14 +1022,17 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest {
|
| wait_thread_.Start();
|
| }
|
|
|
| - static void ReleaseCallback(unsigned sync_point, bool lost_resource) {}
|
| + static void ReleaseCallback(uint32 sync_point, bool lost_resource) {}
|
|
|
| void SetMailbox(char mailbox_char) {
|
| - TextureMailbox mailbox(std::string(64, mailbox_char));
|
| + gpu::Mailbox mailbox;
|
| + mailbox.SetName(
|
| + reinterpret_cast<const int8*>(std::string(64, mailbox_char).data()));
|
| scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
|
| base::Bind(
|
| &TextureLayerMailboxIsActivatedDuringCommit::ReleaseCallback));
|
| - layer_->SetTextureMailbox(mailbox, callback.Pass());
|
| + layer_->SetTextureMailbox(TextureMailbox(mailbox, GL_TEXTURE_2D, 0),
|
| + callback.Pass());
|
| }
|
|
|
| virtual void BeginTest() OVERRIDE {
|
| @@ -1689,22 +1697,24 @@ class TextureLayerNoExtraCommitForMailboxTest
|
| return 0;
|
| }
|
| virtual bool PrepareTextureMailbox(
|
| - TextureMailbox* mailbox,
|
| + TextureMailbox* texture_mailbox,
|
| scoped_ptr<SingleReleaseCallback>* release_callback,
|
| bool use_shared_memory) OVERRIDE {
|
| if (layer_tree_host()->source_frame_number() == 1) {
|
| - *mailbox = TextureMailbox();
|
| + *texture_mailbox = TextureMailbox();
|
| return true;
|
| }
|
|
|
| - *mailbox = TextureMailbox(std::string(64, '1'));
|
| + gpu::Mailbox mailbox;
|
| + mailbox.SetName(reinterpret_cast<const int8*>(std::string(64, '1').data()));
|
| + *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, 0);
|
| *release_callback = SingleReleaseCallback::Create(
|
| base::Bind(&TextureLayerNoExtraCommitForMailboxTest::MailboxReleased,
|
| base::Unretained(this)));
|
| return true;
|
| }
|
|
|
| - void MailboxReleased(unsigned sync_point, bool lost_resource) {
|
| + void MailboxReleased(uint32 sync_point, bool lost_resource) {
|
| EXPECT_EQ(2, layer_tree_host()->source_frame_number());
|
| EndTest();
|
| }
|
| @@ -1821,10 +1831,13 @@ class TextureLayerChangeInvisibleMailboxTest
|
| }
|
|
|
| TextureMailbox MakeMailbox(char name) {
|
| - return TextureMailbox(std::string(64, name));
|
| + gpu::Mailbox mailbox;
|
| + mailbox.SetName(
|
| + reinterpret_cast<const int8*>(std::string(64, name).data()));
|
| + return TextureMailbox(mailbox, GL_TEXTURE_2D, 0);
|
| }
|
|
|
| - void MailboxReleased(unsigned sync_point, bool lost_resource) {
|
| + void MailboxReleased(uint32 sync_point, bool lost_resource) {
|
| ++mailbox_returned_;
|
| }
|
|
|
| @@ -2015,7 +2028,7 @@ SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TextureLayerLostContextTest);
|
|
|
| class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest {
|
| public:
|
| - void ReleaseCallback(unsigned sync_point, bool lost_resource) {
|
| + void ReleaseCallback(uint32 sync_point, bool lost_resource) {
|
| EXPECT_EQ(true, main_thread_.CalledOnValidThread());
|
| EXPECT_FALSE(lost_resource);
|
| ++callback_count_;
|
| @@ -2024,12 +2037,15 @@ class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest {
|
|
|
| void SetMailbox(char mailbox_char) {
|
| EXPECT_EQ(true, main_thread_.CalledOnValidThread());
|
| - TextureMailbox mailbox(std::string(64, mailbox_char));
|
| + gpu::Mailbox mailbox;
|
| + mailbox.SetName(
|
| + reinterpret_cast<const int8*>(std::string(64, mailbox_char).data()));
|
| scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
|
| base::Bind(
|
| &TextureLayerWithMailboxMainThreadDeleted::ReleaseCallback,
|
| base::Unretained(this)));
|
| - layer_->SetTextureMailbox(mailbox, callback.Pass());
|
| + layer_->SetTextureMailbox(TextureMailbox(mailbox, GL_TEXTURE_2D, 0),
|
| + callback.Pass());
|
| }
|
|
|
| virtual void SetupTree() OVERRIDE {
|
| @@ -2087,7 +2103,7 @@ SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
|
|
|
| class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest {
|
| public:
|
| - void ReleaseCallback(unsigned sync_point, bool lost_resource) {
|
| + void ReleaseCallback(uint32 sync_point, bool lost_resource) {
|
| EXPECT_EQ(true, main_thread_.CalledOnValidThread());
|
| EXPECT_FALSE(lost_resource);
|
| ++callback_count_;
|
| @@ -2096,12 +2112,15 @@ class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest {
|
|
|
| void SetMailbox(char mailbox_char) {
|
| EXPECT_EQ(true, main_thread_.CalledOnValidThread());
|
| - TextureMailbox mailbox(std::string(64, mailbox_char));
|
| + gpu::Mailbox mailbox;
|
| + mailbox.SetName(
|
| + reinterpret_cast<const int8*>(std::string(64, mailbox_char).data()));
|
| scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
|
| base::Bind(
|
| &TextureLayerWithMailboxImplThreadDeleted::ReleaseCallback,
|
| base::Unretained(this)));
|
| - layer_->SetTextureMailbox(mailbox, callback.Pass());
|
| + layer_->SetTextureMailbox(TextureMailbox(mailbox, GL_TEXTURE_2D, 0),
|
| + callback.Pass());
|
| }
|
|
|
| virtual void SetupTree() OVERRIDE {
|
|
|