| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 3273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3284 GLenum internalformat, | 3284 GLenum internalformat, |
| 3285 GLsizei width, | 3285 GLsizei width, |
| 3286 GLsizei height, | 3286 GLsizei height, |
| 3287 GLint border, | 3287 GLint border, |
| 3288 GLsizei image_size, | 3288 GLsizei image_size, |
| 3289 const void* data)); | 3289 const void* data)); |
| 3290 MOCK_METHOD1(waitAsyncTexImage2DCHROMIUM, void(GLenum)); | 3290 MOCK_METHOD1(waitAsyncTexImage2DCHROMIUM, void(GLenum)); |
| 3291 MOCK_METHOD4(createImageCHROMIUM, | 3291 MOCK_METHOD4(createImageCHROMIUM, |
| 3292 GLuint(ClientBuffer, GLsizei, GLsizei, GLenum)); | 3292 GLuint(ClientBuffer, GLsizei, GLsizei, GLenum)); |
| 3293 MOCK_METHOD1(destroyImageCHROMIUM, void(GLuint)); | 3293 MOCK_METHOD1(destroyImageCHROMIUM, void(GLuint)); |
| 3294 MOCK_METHOD2(bindTexImage2DCHROMIUM, void(GLenum, GLint)); | 3294 MOCK_METHOD3(bindTexImage2DCHROMIUM, void(GLenum, GLint, GLint)); |
| 3295 MOCK_METHOD2(releaseTexImage2DCHROMIUM, void(GLenum, GLint)); | 3295 MOCK_METHOD2(releaseTexImage2DCHROMIUM, void(GLenum, GLint)); |
| 3296 | 3296 |
| 3297 // We're mocking bindTexture, so we override | 3297 // We're mocking bindTexture, so we override |
| 3298 // TestWebGraphicsContext3D::texParameteri to avoid assertions related to the | 3298 // TestWebGraphicsContext3D::texParameteri to avoid assertions related to the |
| 3299 // currently bound texture. | 3299 // currently bound texture. |
| 3300 virtual void texParameteri(GLenum target, GLenum pname, GLint param) {} | 3300 virtual void texParameteri(GLenum target, GLenum pname, GLint param) {} |
| 3301 }; | 3301 }; |
| 3302 | 3302 |
| 3303 TEST_P(ResourceProviderTest, TextureAllocation) { | 3303 TEST_P(ResourceProviderTest, TextureAllocation) { |
| 3304 // Only for GL textures. | 3304 // Only for GL textures. |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3506 .RetiresOnSaturation(); | 3506 .RetiresOnSaturation(); |
| 3507 { | 3507 { |
| 3508 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( | 3508 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( |
| 3509 resource_provider.get(), id); | 3509 resource_provider.get(), id); |
| 3510 EXPECT_TRUE(lock.GetGpuMemoryBuffer()); | 3510 EXPECT_TRUE(lock.GetGpuMemoryBuffer()); |
| 3511 } | 3511 } |
| 3512 | 3512 |
| 3513 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) | 3513 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) |
| 3514 .Times(1) | 3514 .Times(1) |
| 3515 .RetiresOnSaturation(); | 3515 .RetiresOnSaturation(); |
| 3516 EXPECT_CALL(*context, bindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId)) | 3516 EXPECT_CALL(*context, bindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId, 0)) |
| 3517 .Times(1) | 3517 .Times(1) |
| 3518 .RetiresOnSaturation(); | 3518 .RetiresOnSaturation(); |
| 3519 { | 3519 { |
| 3520 ResourceProvider::ScopedSamplerGL lock_gl( | 3520 ResourceProvider::ScopedSamplerGL lock_gl( |
| 3521 resource_provider.get(), id, GL_TEXTURE_2D, GL_LINEAR); | 3521 resource_provider.get(), id, GL_TEXTURE_2D, GL_LINEAR); |
| 3522 EXPECT_EQ(kTextureId, lock_gl.texture_id()); | 3522 EXPECT_EQ(kTextureId, lock_gl.texture_id()); |
| 3523 } | 3523 } |
| 3524 | 3524 |
| 3525 { | 3525 { |
| 3526 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( | 3526 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( |
| 3527 resource_provider.get(), id); | 3527 resource_provider.get(), id); |
| 3528 EXPECT_TRUE(lock.GetGpuMemoryBuffer()); | 3528 EXPECT_TRUE(lock.GetGpuMemoryBuffer()); |
| 3529 } | 3529 } |
| 3530 | 3530 |
| 3531 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)).Times(1) | 3531 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)).Times(1) |
| 3532 .RetiresOnSaturation(); | 3532 .RetiresOnSaturation(); |
| 3533 EXPECT_CALL(*context, releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId)) | 3533 EXPECT_CALL(*context, releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId)) |
| 3534 .Times(1) | 3534 .Times(1) |
| 3535 .RetiresOnSaturation(); | 3535 .RetiresOnSaturation(); |
| 3536 EXPECT_CALL(*context, bindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId)) | 3536 EXPECT_CALL(*context, bindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId, 0)) |
| 3537 .Times(1) | 3537 .Times(1) |
| 3538 .RetiresOnSaturation(); | 3538 .RetiresOnSaturation(); |
| 3539 EXPECT_CALL(*context, RetireTextureId(kTextureId)) | 3539 EXPECT_CALL(*context, RetireTextureId(kTextureId)) |
| 3540 .Times(1) | 3540 .Times(1) |
| 3541 .RetiresOnSaturation(); | 3541 .RetiresOnSaturation(); |
| 3542 { | 3542 { |
| 3543 ResourceProvider::ScopedSamplerGL lock_gl( | 3543 ResourceProvider::ScopedSamplerGL lock_gl( |
| 3544 resource_provider.get(), id, GL_TEXTURE_2D, GL_LINEAR); | 3544 resource_provider.get(), id, GL_TEXTURE_2D, GL_LINEAR); |
| 3545 EXPECT_EQ(kTextureId, lock_gl.texture_id()); | 3545 EXPECT_EQ(kTextureId, lock_gl.texture_id()); |
| 3546 } | 3546 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3684 resource_provider->AllocateForTesting(id); | 3684 resource_provider->AllocateForTesting(id); |
| 3685 Mock::VerifyAndClearExpectations(context); | 3685 Mock::VerifyAndClearExpectations(context); |
| 3686 | 3686 |
| 3687 DCHECK_EQ(10u, context->PeekTextureId()); | 3687 DCHECK_EQ(10u, context->PeekTextureId()); |
| 3688 resource_provider->DeleteResource(id); | 3688 resource_provider->DeleteResource(id); |
| 3689 } | 3689 } |
| 3690 } | 3690 } |
| 3691 | 3691 |
| 3692 } // namespace | 3692 } // namespace |
| 3693 } // namespace cc | 3693 } // namespace cc |
| OLD | NEW |