| Index: cc/resources/resource_provider_unittest.cc
|
| diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc
|
| index fdd7fc0da760113e46ecfde488a66ddcf4413c69..2bba801b5359e7f502b1c393b100291687945321 100644
|
| --- a/cc/resources/resource_provider_unittest.cc
|
| +++ b/cc/resources/resource_provider_unittest.cc
|
| @@ -354,14 +354,14 @@ void GetResourcePixels(ResourceProvider* resource_provider,
|
| uint8_t* pixels) {
|
| resource_provider->WaitSyncPointIfNeeded(id);
|
| switch (resource_provider->default_resource_type()) {
|
| - case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: {
|
| + case ResourceProvider::GLTexture: {
|
| ResourceProvider::ScopedReadLockGL lock_gl(resource_provider, id);
|
| ASSERT_NE(0U, lock_gl.texture_id());
|
| context->bindTexture(GL_TEXTURE_2D, lock_gl.texture_id());
|
| context->GetPixels(size, format, pixels);
|
| break;
|
| }
|
| - case ResourceProvider::RESOURCE_TYPE_BITMAP: {
|
| + case ResourceProvider::Bitmap: {
|
| ResourceProvider::ScopedReadLockSoftware lock_software(resource_provider,
|
| id);
|
| memcpy(pixels,
|
| @@ -369,7 +369,7 @@ void GetResourcePixels(ResourceProvider* resource_provider,
|
| lock_software.sk_bitmap()->getSize());
|
| break;
|
| }
|
| - case ResourceProvider::RESOURCE_TYPE_INVALID:
|
| + case ResourceProvider::InvalidType:
|
| NOTREACHED();
|
| break;
|
| }
|
| @@ -384,7 +384,7 @@ class ResourceProviderTest
|
| child_context_(NULL),
|
| main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) {
|
| switch (GetParam()) {
|
| - case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: {
|
| + case ResourceProvider::GLTexture: {
|
| scoped_ptr<ResourceProviderContext> context3d(
|
| ResourceProviderContext::Create(shared_data_.get()));
|
| context3d_ = context3d.get();
|
| @@ -401,13 +401,13 @@ class ResourceProviderTest
|
| FakeOutputSurface::Create3d(child_context_owned.Pass());
|
| break;
|
| }
|
| - case ResourceProvider::RESOURCE_TYPE_BITMAP:
|
| + case ResourceProvider::Bitmap:
|
| output_surface_ = FakeOutputSurface::CreateSoftware(
|
| make_scoped_ptr(new SoftwareOutputDevice));
|
| child_output_surface_ = FakeOutputSurface::CreateSoftware(
|
| make_scoped_ptr(new SoftwareOutputDevice));
|
| break;
|
| - case ResourceProvider::RESOURCE_TYPE_INVALID:
|
| + case ResourceProvider::InvalidType:
|
| NOTREACHED();
|
| break;
|
| }
|
| @@ -458,7 +458,7 @@ class ResourceProviderTest
|
| bool* lost_resource,
|
| bool* release_called,
|
| uint32* sync_point) {
|
| - if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
|
| + if (GetParam() == ResourceProvider::GLTexture) {
|
| unsigned texture = child_context_->createTexture();
|
| gpu::Mailbox gpu_mailbox;
|
| child_context_->bindTexture(GL_TEXTURE_2D, texture);
|
| @@ -516,14 +516,15 @@ void CheckCreateResource(ResourceProvider::ResourceType expected_default_type,
|
| ASSERT_EQ(4U, pixel_size);
|
|
|
| ResourceProvider::ResourceId id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| EXPECT_EQ(1, static_cast<int>(resource_provider->num_resources()));
|
| - if (expected_default_type == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (expected_default_type == ResourceProvider::GLTexture)
|
| EXPECT_EQ(0u, context->NumTextures());
|
|
|
| uint8_t data[4] = { 1, 2, 3, 4 };
|
| - resource_provider->CopyToResource(id, data, size);
|
| - if (expected_default_type == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + gfx::Rect rect(size);
|
| + resource_provider->SetPixels(id, data, rect, rect, gfx::Vector2d());
|
| + if (expected_default_type == ResourceProvider::GLTexture)
|
| EXPECT_EQ(1u, context->NumTextures());
|
|
|
| uint8_t result[4] = { 0 };
|
| @@ -532,7 +533,7 @@ void CheckCreateResource(ResourceProvider::ResourceType expected_default_type,
|
|
|
| resource_provider->DeleteResource(id);
|
| EXPECT_EQ(0, static_cast<int>(resource_provider->num_resources()));
|
| - if (expected_default_type == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (expected_default_type == ResourceProvider::GLTexture)
|
| EXPECT_EQ(0u, context->NumTextures());
|
| }
|
|
|
| @@ -547,7 +548,7 @@ TEST_P(ResourceProviderTest, Upload) {
|
| ASSERT_EQ(16U, pixel_size);
|
|
|
| ResourceProvider::ResourceId id = resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
|
|
| uint8_t image[16] = { 0 };
|
| gfx::Rect image_rect(size);
|
| @@ -607,40 +608,8 @@ TEST_P(ResourceProviderTest, Upload) {
|
| resource_provider_->DeleteResource(id);
|
| }
|
|
|
| -TEST_P(ResourceProviderTest, SimpleUpload) {
|
| - gfx::Size size(2, 2);
|
| - ResourceFormat format = RGBA_8888;
|
| - size_t pixel_size = TextureSizeBytes(size, format);
|
| - ASSERT_EQ(16U, pixel_size);
|
| -
|
| - ResourceProvider::ResourceId id = resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| -
|
| - uint8_t image[16] = {0};
|
| - resource_provider_->CopyToResource(id, image, size);
|
| - {
|
| - uint8_t result[16] = {0};
|
| - uint8_t expected[16] = {0};
|
| - GetResourcePixels(resource_provider_.get(), context(), id, size, format,
|
| - result);
|
| - EXPECT_EQ(0, memcmp(expected, result, pixel_size));
|
| - }
|
| -
|
| - for (uint8_t i = 0; i < pixel_size; ++i)
|
| - image[i] = i;
|
| - resource_provider_->CopyToResource(id, image, size);
|
| - {
|
| - uint8_t result[16] = {0};
|
| - uint8_t expected[16] = {
|
| - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
| - GetResourcePixels(resource_provider_.get(), context(), id, size, format,
|
| - result);
|
| - EXPECT_EQ(0, memcmp(expected, result, pixel_size));
|
| - }
|
| -}
|
| -
|
| TEST_P(ResourceProviderTest, TransferGLResources) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| gfx::Size size(1, 1);
|
| ResourceFormat format = RGBA_8888;
|
| @@ -648,17 +617,18 @@ TEST_P(ResourceProviderTest, TransferGLResources) {
|
| ASSERT_EQ(4U, pixel_size);
|
|
|
| ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data1[4] = { 1, 2, 3, 4 };
|
| - child_resource_provider_->CopyToResource(id1, data1, size);
|
| + gfx::Rect rect(size);
|
| + child_resource_provider_->SetPixels(id1, data1, rect, rect, gfx::Vector2d());
|
|
|
| ResourceProvider::ResourceId id2 = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data2[4] = { 5, 5, 5, 5 };
|
| - child_resource_provider_->CopyToResource(id2, data2, size);
|
| + child_resource_provider_->SetPixels(id2, data2, rect, rect, gfx::Vector2d());
|
|
|
| ResourceProvider::ResourceId id3 = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| {
|
| ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock(
|
| child_resource_provider_.get(), id3);
|
| @@ -885,15 +855,16 @@ TEST_P(ResourceProviderTest, TransferGLResources) {
|
| }
|
|
|
| TEST_P(ResourceProviderTest, ReadLockCountStopsReturnToChildOrDelete) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| gfx::Size size(1, 1);
|
| ResourceFormat format = RGBA_8888;
|
|
|
| ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data1[4] = {1, 2, 3, 4};
|
| - child_resource_provider_->CopyToResource(id1, data1, size);
|
| + gfx::Rect rect(size);
|
| + child_resource_provider_->SetPixels(id1, data1, rect, rect, gfx::Vector2d());
|
|
|
| ReturnedResourceArray returned_to_child;
|
| int child_id =
|
| @@ -937,7 +908,7 @@ TEST_P(ResourceProviderTest, ReadLockCountStopsReturnToChildOrDelete) {
|
|
|
| TEST_P(ResourceProviderTest, AllowOverlayTransfersToParent) {
|
| // Overlays only supported on the GL path.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| uint32 sync_point = 0;
|
| @@ -987,7 +958,7 @@ TEST_P(ResourceProviderTest, AllowOverlayTransfersToParent) {
|
| }
|
|
|
| TEST_P(ResourceProviderTest, TransferSoftwareResources) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_BITMAP)
|
| + if (GetParam() != ResourceProvider::Bitmap)
|
| return;
|
|
|
| gfx::Size size(1, 1);
|
| @@ -996,14 +967,15 @@ TEST_P(ResourceProviderTest, TransferSoftwareResources) {
|
| ASSERT_EQ(4U, pixel_size);
|
|
|
| ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data1[4] = { 1, 2, 3, 4 };
|
| - child_resource_provider_->CopyToResource(id1, data1, size);
|
| + gfx::Rect rect(size);
|
| + child_resource_provider_->SetPixels(id1, data1, rect, rect, gfx::Vector2d());
|
|
|
| ResourceProvider::ResourceId id2 = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data2[4] = { 5, 5, 5, 5 };
|
| - child_resource_provider_->CopyToResource(id2, data2, size);
|
| + child_resource_provider_->SetPixels(id2, data2, rect, rect, gfx::Vector2d());
|
|
|
| scoped_ptr<SharedBitmap> shared_bitmap(CreateAndFillSharedBitmap(
|
| shared_bitmap_manager_.get(), gfx::Size(1, 1), 0));
|
| @@ -1171,7 +1143,7 @@ TEST_P(ResourceProviderTest, TransferSoftwareResources) {
|
| }
|
|
|
| TEST_P(ResourceProviderTest, TransferGLToSoftware) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_BITMAP)
|
| + if (GetParam() != ResourceProvider::Bitmap)
|
| return;
|
|
|
| scoped_ptr<ResourceProviderContext> child_context_owned(
|
| @@ -1197,9 +1169,10 @@ TEST_P(ResourceProviderTest, TransferGLToSoftware) {
|
| ASSERT_EQ(4U, pixel_size);
|
|
|
| ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data1[4] = { 1, 2, 3, 4 };
|
| - child_resource_provider->CopyToResource(id1, data1, size);
|
| + gfx::Rect rect(size);
|
| + child_resource_provider->SetPixels(id1, data1, rect, rect, gfx::Vector2d());
|
|
|
| ReturnedResourceArray returned_to_child;
|
| int child_id =
|
| @@ -1234,7 +1207,7 @@ TEST_P(ResourceProviderTest, TransferGLToSoftware) {
|
| }
|
|
|
| TEST_P(ResourceProviderTest, TransferInvalidSoftware) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_BITMAP)
|
| + if (GetParam() != ResourceProvider::Bitmap)
|
| return;
|
|
|
| gfx::Size size(1, 1);
|
| @@ -1243,9 +1216,10 @@ TEST_P(ResourceProviderTest, TransferInvalidSoftware) {
|
| ASSERT_EQ(4U, pixel_size);
|
|
|
| ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data1[4] = { 1, 2, 3, 4 };
|
| - child_resource_provider_->CopyToResource(id1, data1, size);
|
| + gfx::Rect rect(size);
|
| + child_resource_provider_->SetPixels(id1, data1, rect, rect, gfx::Vector2d());
|
|
|
| ReturnedResourceArray returned_to_child;
|
| int child_id =
|
| @@ -1290,14 +1264,15 @@ TEST_P(ResourceProviderTest, DeleteExportedResources) {
|
| ASSERT_EQ(4U, pixel_size);
|
|
|
| ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data1[4] = { 1, 2, 3, 4 };
|
| - child_resource_provider_->CopyToResource(id1, data1, size);
|
| + gfx::Rect rect(size);
|
| + child_resource_provider_->SetPixels(id1, data1, rect, rect, gfx::Vector2d());
|
|
|
| ResourceProvider::ResourceId id2 = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data2[4] = {5, 5, 5, 5};
|
| - child_resource_provider_->CopyToResource(id2, data2, size);
|
| + child_resource_provider_->SetPixels(id2, data2, rect, rect, gfx::Vector2d());
|
|
|
| ReturnedResourceArray returned_to_child;
|
| int child_id =
|
| @@ -1311,7 +1286,7 @@ TEST_P(ResourceProviderTest, DeleteExportedResources) {
|
| child_resource_provider_->PrepareSendToParent(resource_ids_to_transfer,
|
| &list);
|
| ASSERT_EQ(2u, list.size());
|
| - if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
|
| + if (GetParam() == ResourceProvider::GLTexture) {
|
| EXPECT_NE(0u, list[0].mailbox_holder.sync_point);
|
| EXPECT_NE(0u, list[1].mailbox_holder.sync_point);
|
| }
|
| @@ -1341,7 +1316,7 @@ TEST_P(ResourceProviderTest, DeleteExportedResources) {
|
| resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list);
|
|
|
| ASSERT_EQ(2u, list.size());
|
| - if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
|
| + if (GetParam() == ResourceProvider::GLTexture) {
|
| EXPECT_NE(0u, list[0].mailbox_holder.sync_point);
|
| EXPECT_NE(0u, list[1].mailbox_holder.sync_point);
|
| }
|
| @@ -1367,7 +1342,7 @@ TEST_P(ResourceProviderTest, DeleteExportedResources) {
|
|
|
| EXPECT_EQ(0u, resource_provider_->num_resources());
|
| ASSERT_EQ(2u, returned_to_child.size());
|
| - if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
|
| + if (GetParam() == ResourceProvider::GLTexture) {
|
| EXPECT_NE(0u, returned_to_child[0].sync_point);
|
| EXPECT_NE(0u, returned_to_child[1].sync_point);
|
| }
|
| @@ -1383,14 +1358,15 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) {
|
| ASSERT_EQ(4U, pixel_size);
|
|
|
| ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data1[4] = {1, 2, 3, 4};
|
| - child_resource_provider_->CopyToResource(id1, data1, size);
|
| + gfx::Rect rect(size);
|
| + child_resource_provider_->SetPixels(id1, data1, rect, rect, gfx::Vector2d());
|
|
|
| ResourceProvider::ResourceId id2 = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data2[4] = {5, 5, 5, 5};
|
| - child_resource_provider_->CopyToResource(id2, data2, size);
|
| + child_resource_provider_->SetPixels(id2, data2, rect, rect, gfx::Vector2d());
|
|
|
| ReturnedResourceArray returned_to_child;
|
| int child_id =
|
| @@ -1404,7 +1380,7 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) {
|
| child_resource_provider_->PrepareSendToParent(resource_ids_to_transfer,
|
| &list);
|
| ASSERT_EQ(2u, list.size());
|
| - if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
|
| + if (GetParam() == ResourceProvider::GLTexture) {
|
| EXPECT_NE(0u, list[0].mailbox_holder.sync_point);
|
| EXPECT_NE(0u, list[1].mailbox_holder.sync_point);
|
| }
|
| @@ -1434,7 +1410,7 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) {
|
| resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list);
|
|
|
| ASSERT_EQ(2u, list.size());
|
| - if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
|
| + if (GetParam() == ResourceProvider::GLTexture) {
|
| EXPECT_NE(0u, list[0].mailbox_holder.sync_point);
|
| EXPECT_NE(0u, list[1].mailbox_holder.sync_point);
|
| }
|
| @@ -1469,7 +1445,7 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) {
|
|
|
| EXPECT_EQ(1u, resource_provider_->num_resources());
|
| ASSERT_EQ(1u, returned_to_child.size());
|
| - if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
|
| + if (GetParam() == ResourceProvider::GLTexture) {
|
| EXPECT_NE(0u, returned_to_child[0].sync_point);
|
| }
|
| EXPECT_FALSE(returned_to_child[0].lost);
|
| @@ -1479,7 +1455,7 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) {
|
| // lost at this point, and returned.
|
| resource_provider_ = nullptr;
|
| ASSERT_EQ(1u, returned_to_child.size());
|
| - if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
|
| + if (GetParam() == ResourceProvider::GLTexture) {
|
| EXPECT_NE(0u, returned_to_child[0].sync_point);
|
| }
|
| EXPECT_TRUE(returned_to_child[0].lost);
|
| @@ -1493,9 +1469,10 @@ TEST_P(ResourceProviderTest, DeleteTransferredResources) {
|
| ASSERT_EQ(4U, pixel_size);
|
|
|
| ResourceProvider::ResourceId id = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data[4] = { 1, 2, 3, 4 };
|
| - child_resource_provider_->CopyToResource(id, data, size);
|
| + gfx::Rect rect(size);
|
| + child_resource_provider_->SetPixels(id, data, rect, rect, gfx::Vector2d());
|
|
|
| ReturnedResourceArray returned_to_child;
|
| int child_id =
|
| @@ -1508,7 +1485,7 @@ TEST_P(ResourceProviderTest, DeleteTransferredResources) {
|
| child_resource_provider_->PrepareSendToParent(resource_ids_to_transfer,
|
| &list);
|
| ASSERT_EQ(1u, list.size());
|
| - if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() == ResourceProvider::GLTexture)
|
| EXPECT_NE(0u, list[0].mailbox_holder.sync_point);
|
| EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id));
|
| resource_provider_->ReceiveFromChild(child_id, list);
|
| @@ -1528,7 +1505,7 @@ TEST_P(ResourceProviderTest, DeleteTransferredResources) {
|
| resource_provider_->DeclareUsedResourcesFromChild(child_id, no_resources);
|
|
|
| ASSERT_EQ(1u, returned_to_child.size());
|
| - if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() == ResourceProvider::GLTexture)
|
| EXPECT_NE(0u, returned_to_child[0].sync_point);
|
| child_resource_provider_->ReceiveReturnsFromParent(returned_to_child);
|
| }
|
| @@ -1542,9 +1519,10 @@ TEST_P(ResourceProviderTest, UnuseTransferredResources) {
|
| ASSERT_EQ(4U, pixel_size);
|
|
|
| ResourceProvider::ResourceId id = child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| uint8_t data[4] = {1, 2, 3, 4};
|
| - child_resource_provider_->CopyToResource(id, data, size);
|
| + gfx::Rect rect(size);
|
| + child_resource_provider_->SetPixels(id, data, rect, rect, gfx::Vector2d());
|
|
|
| ReturnedResourceArray returned_to_child;
|
| int child_id =
|
| @@ -1694,8 +1672,7 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest {
|
| ASSERT_EQ(4U, pixel_size);
|
|
|
| ResourceProvider::ResourceId id = child_resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
|
| - format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
|
|
| // The new texture is created with GL_LINEAR.
|
| EXPECT_CALL(*child_context, bindTexture(GL_TEXTURE_2D, child_texture_id))
|
| @@ -1718,9 +1695,10 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest {
|
| Mock::VerifyAndClearExpectations(child_context);
|
|
|
| uint8_t data[4] = { 1, 2, 3, 4 };
|
| + gfx::Rect rect(size);
|
|
|
| EXPECT_CALL(*child_context, bindTexture(GL_TEXTURE_2D, child_texture_id));
|
| - child_resource_provider->CopyToResource(id, data, size);
|
| + child_resource_provider->SetPixels(id, data, rect, rect, gfx::Vector2d());
|
| Mock::VerifyAndClearExpectations(child_context);
|
|
|
| // The texture is set to |child_filter| in the child.
|
| @@ -1820,20 +1798,20 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest {
|
| };
|
|
|
| TEST_P(ResourceProviderTest, TextureFilters_ChildNearestParentLinear) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| ResourceProviderTestTextureFilters::RunTest(GL_NEAREST, GL_LINEAR);
|
| }
|
|
|
| TEST_P(ResourceProviderTest, TextureFilters_ChildLinearParentNearest) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| ResourceProviderTestTextureFilters::RunTest(GL_LINEAR, GL_NEAREST);
|
| }
|
|
|
| TEST_P(ResourceProviderTest, TransferMailboxResources) {
|
| // Other mailbox transfers tested elsewhere.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| unsigned texture = context()->createTexture();
|
| context()->bindTexture(GL_TEXTURE_2D, texture);
|
| @@ -1965,12 +1943,13 @@ TEST_P(ResourceProviderTest, LostResourceInParent) {
|
| ResourceFormat format = RGBA_8888;
|
| ResourceProvider::ResourceId resource =
|
| child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
|
| + size,
|
| + GL_CLAMP_TO_EDGE,
|
| + ResourceProvider::TextureHintImmutable,
|
| format);
|
| child_resource_provider_->AllocateForTesting(resource);
|
| // Expect a GL resource to be lost.
|
| - bool should_lose_resource =
|
| - GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE;
|
| + bool should_lose_resource = GetParam() == ResourceProvider::GLTexture;
|
|
|
| ReturnedResourceArray returned_to_child;
|
| int child_id =
|
| @@ -2020,7 +1999,9 @@ TEST_P(ResourceProviderTest, LostResourceInGrandParent) {
|
| ResourceFormat format = RGBA_8888;
|
| ResourceProvider::ResourceId resource =
|
| child_resource_provider_->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
|
| + size,
|
| + GL_CLAMP_TO_EDGE,
|
| + ResourceProvider::TextureHintImmutable,
|
| format);
|
| child_resource_provider_->AllocateForTesting(resource);
|
|
|
| @@ -2131,7 +2112,7 @@ TEST_P(ResourceProviderTest, LostMailboxInParent) {
|
| ASSERT_EQ(1u, returned_to_child.size());
|
| // Losing an output surface only loses hardware resources.
|
| EXPECT_EQ(returned_to_child[0].lost,
|
| - GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE);
|
| + GetParam() == ResourceProvider::GLTexture);
|
| child_resource_provider_->ReceiveReturnsFromParent(returned_to_child);
|
| returned_to_child.clear();
|
| }
|
| @@ -2139,8 +2120,7 @@ TEST_P(ResourceProviderTest, LostMailboxInParent) {
|
| // Delete the resource in the child. Expect the resource to be lost if it's
|
| // a GL texture.
|
| child_resource_provider_->DeleteResource(resource);
|
| - EXPECT_EQ(lost_resource,
|
| - GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE);
|
| + EXPECT_EQ(lost_resource, GetParam() == ResourceProvider::GLTexture);
|
| }
|
|
|
| TEST_P(ResourceProviderTest, LostMailboxInGrandParent) {
|
| @@ -2224,7 +2204,7 @@ TEST_P(ResourceProviderTest, Shutdown) {
|
|
|
| child_resource_provider_ = nullptr;
|
|
|
| - if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
|
| + if (GetParam() == ResourceProvider::GLTexture) {
|
| EXPECT_LE(sync_point, release_sync_point);
|
| }
|
| EXPECT_TRUE(release_called);
|
| @@ -2258,7 +2238,7 @@ TEST_P(ResourceProviderTest, ShutdownWithExportedResource) {
|
|
|
| TEST_P(ResourceProviderTest, LostContext) {
|
| // TextureMailbox callbacks only exist for GL textures for now.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| unsigned texture = context()->createTexture();
|
| context()->bindTexture(GL_TEXTURE_2D, texture);
|
| @@ -2294,7 +2274,7 @@ TEST_P(ResourceProviderTest, LostContext) {
|
|
|
| TEST_P(ResourceProviderTest, ScopedSampler) {
|
| // Sampling is only supported for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| scoped_ptr<TextureStateTrackingContext> context_owned(
|
| @@ -2320,7 +2300,7 @@ TEST_P(ResourceProviderTest, ScopedSampler) {
|
| int texture_id = 1;
|
|
|
| ResourceProvider::ResourceId id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
|
|
| // Check that the texture gets created with the right sampler settings.
|
| EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id))
|
| @@ -2381,7 +2361,7 @@ TEST_P(ResourceProviderTest, ScopedSampler) {
|
|
|
| TEST_P(ResourceProviderTest, ManagedResource) {
|
| // Sampling is only supported for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| scoped_ptr<TextureStateTrackingContext> context_owned(
|
| @@ -2408,8 +2388,11 @@ TEST_P(ResourceProviderTest, ManagedResource) {
|
|
|
| // Check that the texture gets created with the right sampler settings.
|
| ResourceProvider::ResourceId id = resource_provider->CreateManagedResource(
|
| - size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE,
|
| - ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size,
|
| + GL_TEXTURE_2D,
|
| + GL_CLAMP_TO_EDGE,
|
| + ResourceProvider::TextureHintImmutable,
|
| + format);
|
| EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id));
|
| EXPECT_CALL(*context,
|
| texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
| @@ -2433,7 +2416,7 @@ TEST_P(ResourceProviderTest, ManagedResource) {
|
|
|
| TEST_P(ResourceProviderTest, TextureWrapMode) {
|
| // Sampling is only supported for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| scoped_ptr<TextureStateTrackingContext> context_owned(
|
| @@ -2462,8 +2445,12 @@ TEST_P(ResourceProviderTest, TextureWrapMode) {
|
| GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT;
|
| // Check that the texture gets created with the right sampler settings.
|
| ResourceProvider::ResourceId id = resource_provider->CreateGLTexture(
|
| - size, GL_TEXTURE_2D, texture_pool, wrap_mode,
|
| - ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size,
|
| + GL_TEXTURE_2D,
|
| + texture_pool,
|
| + wrap_mode,
|
| + ResourceProvider::TextureHintImmutable,
|
| + format);
|
| EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id));
|
| EXPECT_CALL(*context,
|
| texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
| @@ -2486,7 +2473,7 @@ TEST_P(ResourceProviderTest, TextureWrapMode) {
|
|
|
| TEST_P(ResourceProviderTest, TextureHint) {
|
| // Sampling is only supported for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| scoped_ptr<TextureStateTrackingContext> context_owned(
|
| @@ -2514,10 +2501,10 @@ TEST_P(ResourceProviderTest, TextureHint) {
|
| GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM;
|
|
|
| const ResourceProvider::TextureHint hints[4] = {
|
| - ResourceProvider::TEXTURE_HINT_DEFAULT,
|
| - ResourceProvider::TEXTURE_HINT_IMMUTABLE,
|
| - ResourceProvider::TEXTURE_HINT_FRAMEBUFFER,
|
| - ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
|
| + ResourceProvider::TextureHintDefault,
|
| + ResourceProvider::TextureHintImmutable,
|
| + ResourceProvider::TextureHintFramebuffer,
|
| + ResourceProvider::TextureHintImmutableFramebuffer,
|
| };
|
| for (GLuint texture_id = 1; texture_id <= arraysize(hints); ++texture_id) {
|
| // Check that the texture gets created with the right sampler settings.
|
| @@ -2543,9 +2530,9 @@ TEST_P(ResourceProviderTest, TextureHint) {
|
| texParameteri(GL_TEXTURE_2D,
|
| GL_TEXTURE_POOL_CHROMIUM,
|
| GL_TEXTURE_POOL_UNMANAGED_CHROMIUM));
|
| - // Check only TEXTURE_HINT_FRAMEBUFFER set GL_TEXTURE_USAGE_ANGLE.
|
| + // Check only TextureHintFramebuffer set GL_TEXTURE_USAGE_ANGLE.
|
| bool is_framebuffer_hint =
|
| - hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_FRAMEBUFFER;
|
| + hints[texture_id - 1] & ResourceProvider::TextureHintFramebuffer;
|
| EXPECT_CALL(*context,
|
| texParameteri(GL_TEXTURE_2D,
|
| GL_TEXTURE_USAGE_ANGLE,
|
| @@ -2559,7 +2546,7 @@ TEST_P(ResourceProviderTest, TextureHint) {
|
| }
|
|
|
| TEST_P(ResourceProviderTest, TextureMailbox_SharedMemory) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_BITMAP)
|
| + if (GetParam() != ResourceProvider::Bitmap)
|
| return;
|
|
|
| gfx::Size size(64, 64);
|
| @@ -2713,7 +2700,7 @@ class ResourceProviderTestTextureMailboxGLFilters
|
|
|
| TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToLinear) {
|
| // Mailboxing is only supported for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| ResourceProviderTestTextureMailboxGLFilters::RunTest(
|
| @@ -2726,7 +2713,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToLinear) {
|
|
|
| TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_NearestToNearest) {
|
| // Mailboxing is only supported for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| ResourceProviderTestTextureMailboxGLFilters::RunTest(
|
| @@ -2739,7 +2726,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_NearestToNearest) {
|
|
|
| TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_NearestToLinear) {
|
| // Mailboxing is only supported for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| ResourceProviderTestTextureMailboxGLFilters::RunTest(
|
| @@ -2752,7 +2739,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_NearestToLinear) {
|
|
|
| TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToNearest) {
|
| // Mailboxing is only supported for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| ResourceProviderTestTextureMailboxGLFilters::RunTest(
|
| @@ -2765,7 +2752,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToNearest) {
|
|
|
| TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) {
|
| // Mailboxing is only supported for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| scoped_ptr<TextureStateTrackingContext> context_owned(
|
| @@ -2840,7 +2827,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) {
|
| TEST_P(ResourceProviderTest,
|
| TextureMailbox_WaitSyncPointIfNeeded_WithSyncPoint) {
|
| // Mailboxing is only supported for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| scoped_ptr<TextureStateTrackingContext> context_owned(
|
| @@ -2899,7 +2886,7 @@ TEST_P(ResourceProviderTest,
|
|
|
| TEST_P(ResourceProviderTest, TextureMailbox_WaitSyncPointIfNeeded_NoSyncPoint) {
|
| // Mailboxing is only supported for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| scoped_ptr<TextureStateTrackingContext> context_owned(
|
| @@ -3026,7 +3013,7 @@ class AllocationTrackingContext3D : public TestWebGraphicsContext3D {
|
|
|
| TEST_P(ResourceProviderTest, TextureAllocation) {
|
| // Only for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| scoped_ptr<AllocationTrackingContext3D> context_owned(
|
| new StrictMock<AllocationTrackingContext3D>);
|
| @@ -3048,6 +3035,7 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
|
|
|
| gfx::Size size(2, 2);
|
| gfx::Vector2d offset(0, 0);
|
| + gfx::Rect rect(0, 0, 2, 2);
|
| ResourceFormat format = RGBA_8888;
|
| ResourceProvider::ResourceId id = 0;
|
| uint8_t pixels[16] = { 0 };
|
| @@ -3055,7 +3043,7 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
|
|
|
| // Lazy allocation. Don't allocate when creating the resource.
|
| id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
|
|
| EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
|
| EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(1);
|
| @@ -3068,13 +3056,13 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
|
|
|
| // Do allocate when we set the pixels.
|
| id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
|
|
| EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
|
| EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3);
|
| EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _)).Times(1);
|
| EXPECT_CALL(*context, texSubImage2D(_, _, _, _, 2, 2, _, _, _)).Times(1);
|
| - resource_provider->CopyToResource(id, pixels, size);
|
| + resource_provider->SetPixels(id, pixels, rect, rect, offset);
|
|
|
| EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1);
|
| resource_provider->DeleteResource(id);
|
| @@ -3083,7 +3071,7 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
|
|
|
| // Same for async version.
|
| id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| resource_provider->AcquirePixelBuffer(id);
|
|
|
| EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
|
| @@ -3103,7 +3091,7 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
|
|
|
| TEST_P(ResourceProviderTest, TextureAllocationHint) {
|
| // Only for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| scoped_ptr<AllocationTrackingContext3D> context_owned(
|
| new StrictMock<AllocationTrackingContext3D>);
|
| @@ -3129,10 +3117,10 @@ TEST_P(ResourceProviderTest, TextureAllocationHint) {
|
|
|
| const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888};
|
| const ResourceProvider::TextureHint hints[4] = {
|
| - ResourceProvider::TEXTURE_HINT_DEFAULT,
|
| - ResourceProvider::TEXTURE_HINT_IMMUTABLE,
|
| - ResourceProvider::TEXTURE_HINT_FRAMEBUFFER,
|
| - ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
|
| + ResourceProvider::TextureHintDefault,
|
| + ResourceProvider::TextureHintImmutable,
|
| + ResourceProvider::TextureHintFramebuffer,
|
| + ResourceProvider::TextureHintImmutableFramebuffer,
|
| };
|
| for (size_t i = 0; i < arraysize(formats); ++i) {
|
| for (GLuint texture_id = 1; texture_id <= arraysize(hints); ++texture_id) {
|
| @@ -3143,7 +3131,7 @@ TEST_P(ResourceProviderTest, TextureAllocationHint) {
|
| EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
|
| EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
|
| bool is_immutable_hint =
|
| - hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE;
|
| + hints[texture_id - 1] & ResourceProvider::TextureHintImmutable;
|
| bool support_immutable_texture =
|
| is_immutable_hint && formats[i] == RGBA_8888;
|
| EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2))
|
| @@ -3162,7 +3150,7 @@ TEST_P(ResourceProviderTest, TextureAllocationHint) {
|
|
|
| TEST_P(ResourceProviderTest, TextureAllocationHint_BGRA) {
|
| // Only for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| scoped_ptr<AllocationTrackingContext3D> context_owned(
|
| new StrictMock<AllocationTrackingContext3D>);
|
| @@ -3189,10 +3177,10 @@ TEST_P(ResourceProviderTest, TextureAllocationHint_BGRA) {
|
| const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888};
|
|
|
| const ResourceProvider::TextureHint hints[4] = {
|
| - ResourceProvider::TEXTURE_HINT_DEFAULT,
|
| - ResourceProvider::TEXTURE_HINT_IMMUTABLE,
|
| - ResourceProvider::TEXTURE_HINT_FRAMEBUFFER,
|
| - ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
|
| + ResourceProvider::TextureHintDefault,
|
| + ResourceProvider::TextureHintImmutable,
|
| + ResourceProvider::TextureHintFramebuffer,
|
| + ResourceProvider::TextureHintImmutableFramebuffer,
|
| };
|
| for (size_t i = 0; i < arraysize(formats); ++i) {
|
| for (GLuint texture_id = 1; texture_id <= arraysize(hints); ++texture_id) {
|
| @@ -3203,7 +3191,7 @@ TEST_P(ResourceProviderTest, TextureAllocationHint_BGRA) {
|
| EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
|
| EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
|
| bool is_immutable_hint =
|
| - hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE;
|
| + hints[texture_id - 1] & ResourceProvider::TextureHintImmutable;
|
| EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2))
|
| .Times(is_immutable_hint ? 1 : 0);
|
| EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _))
|
| @@ -3219,7 +3207,7 @@ TEST_P(ResourceProviderTest, TextureAllocationHint_BGRA) {
|
| }
|
|
|
| TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| scoped_ptr<AllocationTrackingContext3D> context_owned(
|
| new StrictMock<AllocationTrackingContext3D>);
|
| @@ -3245,7 +3233,7 @@ TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) {
|
| 1));
|
|
|
| id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| resource_provider->AcquirePixelBuffer(id);
|
|
|
| EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
|
| @@ -3266,7 +3254,7 @@ TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) {
|
|
|
| TEST_P(ResourceProviderTest, ForcingAsyncUploadToComplete) {
|
| // Only for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| scoped_ptr<AllocationTrackingContext3D> context_owned(
|
| new StrictMock<AllocationTrackingContext3D>);
|
| @@ -3292,7 +3280,7 @@ TEST_P(ResourceProviderTest, ForcingAsyncUploadToComplete) {
|
| 1));
|
|
|
| id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| resource_provider->AcquirePixelBuffer(id);
|
|
|
| EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
|
| @@ -3341,7 +3329,7 @@ TEST_P(ResourceProviderTest, PixelBufferLostContext) {
|
| EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id));
|
|
|
| id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
|
| GL_INNOCENT_CONTEXT_RESET_ARB);
|
|
|
| @@ -3355,7 +3343,7 @@ TEST_P(ResourceProviderTest, PixelBufferLostContext) {
|
|
|
| TEST_P(ResourceProviderTest, Image_GLTexture) {
|
| // Only for GL textures.
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| scoped_ptr<AllocationTrackingContext3D> context_owned(
|
| new StrictMock<AllocationTrackingContext3D>);
|
| @@ -3384,7 +3372,7 @@ TEST_P(ResourceProviderTest, Image_GLTexture) {
|
| 1));
|
|
|
| id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
|
|
| EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA))
|
| .WillOnce(Return(kImageId))
|
| @@ -3439,7 +3427,7 @@ TEST_P(ResourceProviderTest, Image_GLTexture) {
|
| }
|
|
|
| TEST_P(ResourceProviderTest, CopyResource_GLTexture) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
| scoped_ptr<AllocationTrackingContext3D> context_owned(
|
| new StrictMock<AllocationTrackingContext3D>);
|
| @@ -3471,7 +3459,7 @@ TEST_P(ResourceProviderTest, CopyResource_GLTexture) {
|
| 1));
|
|
|
| source_id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
|
|
| EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA))
|
| .WillOnce(Return(kImageId))
|
| @@ -3484,7 +3472,7 @@ TEST_P(ResourceProviderTest, CopyResource_GLTexture) {
|
| Mock::VerifyAndClearExpectations(context);
|
|
|
| dest_id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
|
|
| EXPECT_CALL(*context, NextTextureId())
|
| .WillOnce(Return(kDestTextureId))
|
| @@ -3533,8 +3521,7 @@ void InitializeGLAndCheck(ContextSharedData* shared_data,
|
| output_surface->InitializeAndSetContext3d(context_provider, nullptr);
|
| resource_provider->InitializeGL();
|
|
|
| - CheckCreateResource(ResourceProvider::RESOURCE_TYPE_GL_TEXTURE,
|
| - resource_provider, context);
|
| + CheckCreateResource(ResourceProvider::GLTexture, resource_provider, context);
|
| }
|
|
|
| TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
|
| @@ -3557,8 +3544,7 @@ TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
|
| false,
|
| 1));
|
|
|
| - CheckCreateResource(ResourceProvider::RESOURCE_TYPE_BITMAP,
|
| - resource_provider.get(), NULL);
|
| + CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL);
|
|
|
| InitializeGLAndCheck(shared_data.get(),
|
| resource_provider.get(),
|
| @@ -3566,8 +3552,7 @@ TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
|
|
|
| resource_provider->InitializeSoftware();
|
| output_surface->ReleaseGL();
|
| - CheckCreateResource(ResourceProvider::RESOURCE_TYPE_BITMAP,
|
| - resource_provider.get(), NULL);
|
| + CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL);
|
|
|
| InitializeGLAndCheck(shared_data.get(),
|
| resource_provider.get(),
|
| @@ -3575,7 +3560,7 @@ TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
|
| }
|
|
|
| TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| scoped_ptr<AllocationTrackingContext3D> context_owned(
|
| @@ -3600,7 +3585,7 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) {
|
| int texture_id = 123;
|
|
|
| ResourceProvider::ResourceId id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1);
|
| EXPECT_NE(0u, id);
|
| EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
|
| EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
|
| @@ -3610,8 +3595,8 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) {
|
| resource_provider->DeleteResource(id);
|
| }
|
|
|
| -TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) {
|
| - if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
|
| +TEST_P(ResourceProviderTest, CompressedTextureETC1SetPixels) {
|
| + if (GetParam() != ResourceProvider::GLTexture)
|
| return;
|
|
|
| scoped_ptr<AllocationTrackingContext3D> context_owned(
|
| @@ -3637,14 +3622,15 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) {
|
| uint8_t pixels[8];
|
|
|
| ResourceProvider::ResourceId id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1);
|
| EXPECT_NE(0u, id);
|
| EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
|
| EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3);
|
| EXPECT_CALL(*context,
|
| compressedTexImage2D(
|
| _, 0, _, size.width(), size.height(), _, _, _)).Times(1);
|
| - resource_provider->CopyToResource(id, pixels, size);
|
| + resource_provider->SetPixels(
|
| + id, pixels, gfx::Rect(size), gfx::Rect(size), gfx::Vector2d(0, 0));
|
|
|
| EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1);
|
| resource_provider->DeleteResource(id);
|
| @@ -3653,8 +3639,7 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) {
|
| INSTANTIATE_TEST_CASE_P(
|
| ResourceProviderTests,
|
| ResourceProviderTest,
|
| - ::testing::Values(ResourceProvider::RESOURCE_TYPE_GL_TEXTURE,
|
| - ResourceProvider::RESOURCE_TYPE_BITMAP));
|
| + ::testing::Values(ResourceProvider::GLTexture, ResourceProvider::Bitmap));
|
|
|
| class TextureIdAllocationTrackingContext : public TestWebGraphicsContext3D {
|
| public:
|
| @@ -3696,8 +3681,7 @@ TEST(ResourceProviderTest, TextureAllocationChunkSize) {
|
| kTextureAllocationChunkSize));
|
|
|
| ResourceProvider::ResourceId id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
|
| - format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| resource_provider->AllocateForTesting(id);
|
| Mock::VerifyAndClearExpectations(context);
|
|
|
| @@ -3717,8 +3701,7 @@ TEST(ResourceProviderTest, TextureAllocationChunkSize) {
|
| kTextureAllocationChunkSize));
|
|
|
| ResourceProvider::ResourceId id = resource_provider->CreateResource(
|
| - size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
|
| - format);
|
| + size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
|
| resource_provider->AllocateForTesting(id);
|
| Mock::VerifyAndClearExpectations(context);
|
|
|
|
|