Chromium Code Reviews| Index: cc/resources/resource_provider_unittest.cc |
| diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc |
| index dc2b76d9bb992a0b9c3baddec1a85d93bb64dff1..6bb6758e2dd516f8301cf6bd1a1216d3b14d3423 100644 |
| --- a/cc/resources/resource_provider_unittest.cc |
| +++ b/cc/resources/resource_provider_unittest.cc |
| @@ -187,12 +187,20 @@ class ResourceProviderContext : public TestWebGraphicsContext3D { |
| return sync_point; |
| } |
| - void waitSyncPoint(GLuint sync_point) override { |
| + void waitSyncPoint(GLuint sync_point, |
| + const gpu::SyncToken& sync_token) override { |
| last_waited_sync_point_ = std::max(sync_point, last_waited_sync_point_); |
| + if (last_waited_sync_token_.release_count() > sync_token.release_count()) { |
| + last_waited_sync_token_ = sync_token; |
| + } |
| } |
| unsigned last_waited_sync_point() const { return last_waited_sync_point_; } |
| + const gpu::SyncToken last_waited_sync_token() const { |
|
dcheng
2015/10/27 19:09:28
Just curious: did you intentionally not return a c
David Yen
2015/10/28 22:03:43
Good catch, was a typo.
|
| + return last_waited_sync_token_; |
| + } |
| + |
| void texStorage2DEXT(GLenum target, |
| GLint levels, |
| GLuint internalformat, |
| @@ -276,8 +284,8 @@ class ResourceProviderContext : public TestWebGraphicsContext3D { |
| const GLbyte* mailbox) override { |
| GLuint texture_id = createTexture(); |
| base::AutoLock lock_for_texture_access(namespace_->lock); |
| - scoped_refptr<TestTexture> texture = |
| - shared_data_->ConsumeTexture(mailbox, last_waited_sync_point_); |
| + scoped_refptr<TestTexture> texture = shared_data_->ConsumeTexture( |
| + mailbox, last_waited_sync_point_, last_waited_sync_token_); |
| namespace_->textures.Replace(texture_id, texture); |
| return texture_id; |
| } |
| @@ -346,6 +354,7 @@ class ResourceProviderContext : public TestWebGraphicsContext3D { |
| typedef ScopedPtrDeque<PendingProduceTexture> PendingProduceTextureList; |
| ContextSharedData* shared_data_; |
| GLuint last_waited_sync_point_; |
| + gpu::SyncToken last_waited_sync_token_; |
| PendingProduceTextureList pending_produce_textures_; |
| }; |
| @@ -653,6 +662,8 @@ TEST_P(ResourceProviderTest, TransferGLResources) { |
| resource_provider_->ReceiveFromChild(child_id, list); |
| EXPECT_NE(list[0].mailbox_holder.sync_point, |
| context3d_->last_waited_sync_point()); |
| + EXPECT_NE(list[0].mailbox_holder.sync_token, |
| + context3d_->last_waited_sync_token()); |
| { |
| resource_provider_->WaitSyncPointIfNeeded(list[0].id); |
| ResourceProvider::ScopedReadLockGL lock(resource_provider_.get(), |
| @@ -660,6 +671,8 @@ TEST_P(ResourceProviderTest, TransferGLResources) { |
| } |
| EXPECT_EQ(list[0].mailbox_holder.sync_point, |
| context3d_->last_waited_sync_point()); |
| + EXPECT_EQ(list[0].mailbox_holder.sync_token, |
| + context3d_->last_waited_sync_token()); |
| ResourceProvider::ResourceIdSet resource_ids_to_receive; |
| resource_ids_to_receive.insert(id1); |
| resource_ids_to_receive.insert(id2); |
| @@ -2065,7 +2078,8 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) { |
| sizeof(mailbox.name))); |
| EXPECT_EQ(0u, release_sync_point); |
| - context()->waitSyncPoint(list[0].mailbox_holder.sync_point); |
| + context()->waitSyncPoint(list[0].mailbox_holder.sync_point, |
| + list[0].mailbox_holder.sync_token); |
| unsigned other_texture = |
| context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| uint8_t test_data[4] = { 0 }; |
| @@ -2117,7 +2131,8 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) { |
| sizeof(mailbox.name))); |
| EXPECT_EQ(0u, release_sync_point); |
| - context()->waitSyncPoint(list[0].mailbox_holder.sync_point); |
| + context()->waitSyncPoint(list[0].mailbox_holder.sync_point, |
| + list[0].mailbox_holder.sync_token); |
| unsigned other_texture = |
| context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| uint8_t test_data[4] = { 0 }; |
| @@ -2146,7 +2161,7 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) { |
| EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner); |
| } |
| - context()->waitSyncPoint(release_sync_point); |
| + context()->waitSyncPoint(release_sync_point, gpu::SyncToken()); |
| texture = |
| context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| context()->deleteTexture(texture); |
| @@ -2786,7 +2801,7 @@ class ResourceProviderTestTextureMailboxGLFilters |
| unsigned target = GL_TEXTURE_2D; |
| EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| - EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| + EXPECT_CALL(*context, waitSyncPoint(_, _)).Times(0); |
| EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| @@ -2813,7 +2828,7 @@ class ResourceProviderTestTextureMailboxGLFilters |
| { |
| // Mailbox sync point WaitSyncPoint before using the texture. |
| - EXPECT_CALL(*context, waitSyncPoint(sync_point)); |
| + EXPECT_CALL(*context, waitSyncPoint(sync_point, _)); |
| resource_provider->WaitSyncPointIfNeeded(id); |
| Mock::VerifyAndClearExpectations(context); |
| @@ -2843,7 +2858,7 @@ class ResourceProviderTestTextureMailboxGLFilters |
| EXPECT_CALL(*context, insertSyncPoint()); |
| EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| - EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| + EXPECT_CALL(*context, waitSyncPoint(_, _)).Times(0); |
| EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| } |
| @@ -2929,7 +2944,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) { |
| unsigned target = GL_TEXTURE_EXTERNAL_OES; |
| EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| - EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| + EXPECT_CALL(*context, waitSyncPoint(_, _)).Times(0); |
| EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| @@ -2949,7 +2964,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) { |
| { |
| // Mailbox sync point WaitSyncPoint before using the texture. |
| - EXPECT_CALL(*context, waitSyncPoint(sync_point)); |
| + EXPECT_CALL(*context, waitSyncPoint(sync_point, _)); |
| resource_provider->WaitSyncPointIfNeeded(id); |
| Mock::VerifyAndClearExpectations(context); |
| @@ -2970,7 +2985,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) { |
| EXPECT_CALL(*context, insertSyncPoint()); |
| EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| - EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| + EXPECT_CALL(*context, waitSyncPoint(_, _)).Times(0); |
| EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| } |
| } |
| @@ -2999,7 +3014,7 @@ TEST_P(ResourceProviderTest, |
| unsigned target = GL_TEXTURE_2D; |
| EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| - EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| + EXPECT_CALL(*context, waitSyncPoint(_, _)).Times(0); |
| EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| @@ -3019,12 +3034,12 @@ TEST_P(ResourceProviderTest, |
| { |
| // First call to WaitSyncPointIfNeeded should call waitSyncPoint. |
| - EXPECT_CALL(*context, waitSyncPoint(sync_point)); |
| + EXPECT_CALL(*context, waitSyncPoint(sync_point, _)); |
| resource_provider->WaitSyncPointIfNeeded(id); |
| Mock::VerifyAndClearExpectations(context); |
| // Subsequent calls to WaitSyncPointIfNeeded shouldn't call waitSyncPoint. |
| - EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| + EXPECT_CALL(*context, waitSyncPoint(_, _)).Times(0); |
| resource_provider->WaitSyncPointIfNeeded(id); |
| Mock::VerifyAndClearExpectations(context); |
| } |
| @@ -3053,7 +3068,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_WaitSyncPointIfNeeded_NoSyncPoint) { |
| unsigned target = GL_TEXTURE_2D; |
| EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| - EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| + EXPECT_CALL(*context, waitSyncPoint(_, _)).Times(0); |
| EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| @@ -3073,7 +3088,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_WaitSyncPointIfNeeded_NoSyncPoint) { |
| { |
| // WaitSyncPointIfNeeded with sync_point == 0 shouldn't call waitSyncPoint. |
| - EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| + EXPECT_CALL(*context, waitSyncPoint(_, _)).Times(0); |
| resource_provider->WaitSyncPointIfNeeded(id); |
| Mock::VerifyAndClearExpectations(context); |
| } |