| 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 3766 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3777         size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 3777         size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 
| 3778         gfx::ColorSpace()); | 3778         gfx::ColorSpace()); | 
| 3779     resource_provider->AllocateForTesting(id); | 3779     resource_provider->AllocateForTesting(id); | 
| 3780     Mock::VerifyAndClearExpectations(context); | 3780     Mock::VerifyAndClearExpectations(context); | 
| 3781 | 3781 | 
| 3782     DCHECK_EQ(10u, context->PeekTextureId()); | 3782     DCHECK_EQ(10u, context->PeekTextureId()); | 
| 3783     resource_provider->DeleteResource(id); | 3783     resource_provider->DeleteResource(id); | 
| 3784   } | 3784   } | 
| 3785 } | 3785 } | 
| 3786 | 3786 | 
|  | 3787 TEST_P(ResourceProviderTest, GetSyncTokenForResources) { | 
|  | 3788   if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 
|  | 3789     return; | 
|  | 3790 | 
|  | 3791   gfx::Size size(1, 1); | 
|  | 3792   ResourceFormat format = RGBA_8888; | 
|  | 3793 | 
|  | 3794   // ~Random set of |release_count|s to set on sync tokens. | 
|  | 3795   uint64_t release_counts[5] = {7, 3, 10, 2, 5}; | 
|  | 3796 | 
|  | 3797   ResourceProvider::ResourceIdArray array; | 
|  | 3798   for (uint32_t i = 0; i < arraysize(release_counts); ++i) { | 
|  | 3799     ResourceId id = resource_provider_->CreateResource( | 
|  | 3800         size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 
|  | 3801         gfx::ColorSpace()); | 
|  | 3802     array.push_back(id); | 
|  | 3803 | 
|  | 3804     ResourceProvider::ScopedWriteLockGL lock(resource_provider_.get(), id, | 
|  | 3805                                              false); | 
|  | 3806     gpu::SyncToken token; | 
|  | 3807     token.Set(gpu::CommandBufferNamespace::INVALID, 0, gpu::CommandBufferId(), | 
|  | 3808               release_counts[i]); | 
|  | 3809     lock.set_sync_token(token); | 
|  | 3810   } | 
|  | 3811 | 
|  | 3812   gpu::SyncToken last_token = | 
|  | 3813       resource_provider_->GetSyncTokenForResources(array); | 
|  | 3814   EXPECT_EQ(last_token.release_count(), 10u); | 
|  | 3815 } | 
|  | 3816 | 
| 3787 }  // namespace | 3817 }  // namespace | 
| 3788 }  // namespace cc | 3818 }  // namespace cc | 
| OLD | NEW | 
|---|