Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: cc/resources/resource_provider_unittest.cc

Issue 2000323004: cc: Remove InUseByMacOSWindowServer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@video2
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | media/video/gpu_memory_buffer_video_frame_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3671 matching lines...) Expand 10 before | Expand all | Expand 10 after
3682 ResourceId id = resource_provider->CreateResource( 3682 ResourceId id = resource_provider->CreateResource(
3683 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); 3683 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
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 TEST_P(ResourceProviderTest, GpuMemoryBufferInUse) {
3693 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
3694 return;
3695
3696 gfx::Size size(1, 1);
3697 ResourceFormat format = RGBA_8888;
3698 size_t pixel_size = TextureSizeBytes(size, format);
3699 ASSERT_EQ(4U, pixel_size);
3700
3701 ResourceId id = resource_provider_->CreateResource(
3702 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
3703
3704 gfx::GpuMemoryBuffer* gpu_memory_buffer = nullptr;
3705 {
3706 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock(
3707 resource_provider_.get(), id);
3708 gpu_memory_buffer = lock.GetGpuMemoryBuffer();
3709 EXPECT_TRUE(lock.GetGpuMemoryBuffer());
3710 }
3711 EXPECT_TRUE(resource_provider_->CanLockForWrite(id));
3712 EXPECT_FALSE(resource_provider_->InUseByConsumer(id));
3713 gpu_memory_buffer_manager_->SetGpuMemoryBufferIsInUseByMacOSWindowServer(
3714 gpu_memory_buffer, true);
3715 EXPECT_FALSE(resource_provider_->CanLockForWrite(id));
3716 EXPECT_TRUE(resource_provider_->InUseByConsumer(id));
3717 }
3718
3719 TEST_P(ResourceProviderTest, GpuMemoryBufferReadLockFail) { 3692 TEST_P(ResourceProviderTest, GpuMemoryBufferReadLockFail) {
3720 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) 3693 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
3721 return; 3694 return;
3722 3695
3723 gfx::Size size(1, 1); 3696 gfx::Size size(1, 1);
3724 ResourceFormat format = RGBA_8888; 3697 ResourceFormat format = RGBA_8888;
3725 size_t pixel_size = TextureSizeBytes(size, format); 3698 size_t pixel_size = TextureSizeBytes(size, format);
3726 ASSERT_EQ(4U, pixel_size); 3699 ASSERT_EQ(4U, pixel_size);
3727 3700
3728 ResourceId id = resource_provider_->CreateResource( 3701 ResourceId id = resource_provider_->CreateResource(
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
3843 resource_provider_->DeclareUsedResourcesFromChild(child_id, 3816 resource_provider_->DeclareUsedResourcesFromChild(child_id,
3844 resource_ids_to_receive); 3817 resource_ids_to_receive);
3845 } 3818 }
3846 resource_provider_->DestroyChild(child_id); 3819 resource_provider_->DestroyChild(child_id);
3847 3820
3848 EXPECT_EQ(0u, resource_provider_->num_resources()); 3821 EXPECT_EQ(0u, resource_provider_->num_resources());
3849 } 3822 }
3850 3823
3851 } // namespace 3824 } // namespace
3852 } // namespace cc 3825 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | media/video/gpu_memory_buffer_video_frame_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698