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

Side by Side Diff: cc/CCResourceProviderTest.cpp

Issue 10961008: cc: Remove TextureUploaderOption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Settle for removing TextureUploaderOption in this CL. I'll figure out what to do with the uploader … Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « cc/CCResourceProvider.cpp ('k') | cc/CCScopedTextureTest.cpp » ('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 "config.h" 5 #include "config.h"
6 6
7 #include "CCResourceProvider.h" 7 #include "CCResourceProvider.h"
8 8
9 #include "CCGraphicsContext.h" 9 #include "CCGraphicsContext.h"
10 #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread 10 #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 TextureMap m_textures; 264 TextureMap m_textures;
265 unsigned m_lastWaitedSyncPoint; 265 unsigned m_lastWaitedSyncPoint;
266 PendingProduceTextureList m_pendingProduceTextures; 266 PendingProduceTextureList m_pendingProduceTextures;
267 }; 267 };
268 268
269 class CCResourceProviderTest : public testing::TestWithParam<CCResourceProvider: :ResourceType> { 269 class CCResourceProviderTest : public testing::TestWithParam<CCResourceProvider: :ResourceType> {
270 public: 270 public:
271 CCResourceProviderTest() 271 CCResourceProviderTest()
272 : m_sharedData(ContextSharedData::create()) 272 : m_sharedData(ContextSharedData::create())
273 , m_context(FakeWebCompositorOutputSurface::create(ResourceProviderConte xt::create(m_sharedData.get()))) 273 , m_context(FakeWebCompositorOutputSurface::create(ResourceProviderConte xt::create(m_sharedData.get())))
274 , m_resourceProvider(CCResourceProvider::create(m_context.get(), Unthrot tledUploader)) 274 , m_resourceProvider(CCResourceProvider::create(m_context.get()))
275 { 275 {
276 m_resourceProvider->setDefaultResourceType(GetParam()); 276 m_resourceProvider->setDefaultResourceType(GetParam());
277 } 277 }
278 278
279 ResourceProviderContext* context() { return static_cast<ResourceProviderCont ext*>(m_context->context3D()); } 279 ResourceProviderContext* context() { return static_cast<ResourceProviderCont ext*>(m_context->context3D()); }
280 280
281 void getResourcePixels(CCResourceProvider::ResourceId id, const IntSize& siz e, WGC3Denum format, uint8_t* pixels) 281 void getResourcePixels(CCResourceProvider::ResourceId id, const IntSize& siz e, WGC3Denum format, uint8_t* pixels)
282 { 282 {
283 if (GetParam() == CCResourceProvider::GLTexture) { 283 if (GetParam() == CCResourceProvider::GLTexture) {
284 CCResourceProvider::ScopedReadLockGL lockGL(m_resourceProvider.get() , id); 284 CCResourceProvider::ScopedReadLockGL lockGL(m_resourceProvider.get() , id);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 m_resourceProvider->deleteResource(id); 410 m_resourceProvider->deleteResource(id);
411 } 411 }
412 412
413 TEST_P(CCResourceProviderTest, TransferResources) 413 TEST_P(CCResourceProviderTest, TransferResources)
414 { 414 {
415 // Resource transfer is only supported with GL textures for now. 415 // Resource transfer is only supported with GL textures for now.
416 if (GetParam() != CCResourceProvider::GLTexture) 416 if (GetParam() != CCResourceProvider::GLTexture)
417 return; 417 return;
418 418
419 OwnPtr<CCGraphicsContext> childContext(FakeWebCompositorOutputSurface::creat e(ResourceProviderContext::create(m_sharedData.get()))); 419 OwnPtr<CCGraphicsContext> childContext(FakeWebCompositorOutputSurface::creat e(ResourceProviderContext::create(m_sharedData.get())));
420 OwnPtr<CCResourceProvider> childResourceProvider(CCResourceProvider::create( childContext.get(), UnthrottledUploader)); 420 OwnPtr<CCResourceProvider> childResourceProvider(CCResourceProvider::create( childContext.get()));
421 421
422 IntSize size(1, 1); 422 IntSize size(1, 1);
423 WGC3Denum format = GraphicsContext3D::RGBA; 423 WGC3Denum format = GraphicsContext3D::RGBA;
424 int pool = 1; 424 int pool = 1;
425 size_t pixelSize = textureSize(size, format); 425 size_t pixelSize = textureSize(size, format);
426 ASSERT_EQ(4U, pixelSize); 426 ASSERT_EQ(4U, pixelSize);
427 427
428 CCResourceProvider::ResourceId id1 = childResourceProvider->createResource(p ool, size, format, CCResourceProvider::TextureUsageAny); 428 CCResourceProvider::ResourceId id1 = childResourceProvider->createResource(p ool, size, format, CCResourceProvider::TextureUsageAny);
429 uint8_t data1[4] = {1, 2, 3, 4}; 429 uint8_t data1[4] = {1, 2, 3, 4};
430 IntRect rect(IntPoint(), size); 430 IntRect rect(IntPoint(), size);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 EXPECT_EQ(0u, m_resourceProvider->numResources()); 526 EXPECT_EQ(0u, m_resourceProvider->numResources());
527 EXPECT_EQ(0u, m_resourceProvider->mailboxCount()); 527 EXPECT_EQ(0u, m_resourceProvider->mailboxCount());
528 } 528 }
529 529
530 INSTANTIATE_TEST_CASE_P(CCResourceProviderTests, 530 INSTANTIATE_TEST_CASE_P(CCResourceProviderTests,
531 CCResourceProviderTest, 531 CCResourceProviderTest,
532 ::testing::Values(CCResourceProvider::GLTexture, 532 ::testing::Values(CCResourceProvider::GLTexture,
533 CCResourceProvider::Bitmap)); 533 CCResourceProvider::Bitmap));
534 534
535 } // namespace 535 } // namespace
OLDNEW
« no previous file with comments | « cc/CCResourceProvider.cpp ('k') | cc/CCScopedTextureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698