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

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

Issue 2555743004: Delay activation/draw on GPU tile work completion (Closed)
Patch Set: cleanup Created 4 years 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
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 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, 3682 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format,
3683 gfx::ColorSpace()); 3683 gfx::ColorSpace());
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, GetSyncTokenForResources) {
3693 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
3694 return;
3695
3696 gfx::Size size(1, 1);
3697 ResourceFormat format = RGBA_8888;
3698
3699 // ~Random set of |release_count|s to set on sync tokens.
3700 uint64_t release_counts[5] = {7, 3, 10, 2, 5};
3701
3702 ResourceProvider::ResourceIdArray array;
3703 for (uint32_t i = 0; i < arraysize(release_counts); ++i) {
3704 ResourceId id = resource_provider_->CreateResource(
3705 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format,
3706 gfx::ColorSpace());
3707 array.push_back(id);
3708
3709 ResourceProvider::ScopedWriteLockGL lock(resource_provider_.get(), id,
3710 false);
3711 gpu::SyncToken token;
3712 token.Set(gpu::CommandBufferNamespace::INVALID, 0, gpu::CommandBufferId(),
3713 release_counts[i]);
3714 lock.set_sync_token(token);
3715 }
3716
3717 gpu::SyncToken last_token =
3718 resource_provider_->GetSyncTokenForResources(array);
3719 EXPECT_EQ(last_token.release_count(), 10u);
3720 }
3721
3692 } // namespace 3722 } // namespace
3693 } // namespace cc 3723 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698