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

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

Issue 266743003: Add flag to enable rendering of text using signed distance fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix uses of ResourceProvider::Create() outside of Chrome proper. Created 6 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') | cc/resources/resource_update_controller_unittest.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 <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 case ResourceProvider::InvalidType: 396 case ResourceProvider::InvalidType:
397 NOTREACHED(); 397 NOTREACHED();
398 break; 398 break;
399 } 399 }
400 CHECK(output_surface_->BindToClient(&output_surface_client_)); 400 CHECK(output_surface_->BindToClient(&output_surface_client_));
401 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); 401 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_));
402 402
403 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); 403 shared_bitmap_manager_.reset(new TestSharedBitmapManager());
404 404
405 resource_provider_ = ResourceProvider::Create( 405 resource_provider_ = ResourceProvider::Create(
406 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1); 406 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1,
407 false);
407 child_resource_provider_ = ResourceProvider::Create( 408 child_resource_provider_ = ResourceProvider::Create(
408 child_output_surface_.get(), 409 child_output_surface_.get(),
409 shared_bitmap_manager_.get(), 410 shared_bitmap_manager_.get(),
410 0, 411 0,
411 false, 412 false,
412 1); 413 1,
414 false);
413 } 415 }
414 416
415 static void CollectResources(ReturnedResourceArray* array, 417 static void CollectResources(ReturnedResourceArray* array,
416 const ReturnedResourceArray& returned) { 418 const ReturnedResourceArray& returned) {
417 array->insert(array->end(), returned.begin(), returned.end()); 419 array->insert(array->end(), returned.begin(), returned.end());
418 } 420 }
419 421
420 static ReturnCallback GetReturnCallback(ReturnedResourceArray* array) { 422 static ReturnCallback GetReturnCallback(ReturnedResourceArray* array) {
421 return base::Bind(&ResourceProviderTest::CollectResources, array); 423 return base::Bind(&ResourceProviderTest::CollectResources, array);
422 } 424 }
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 1107
1106 scoped_ptr<ResourceProviderContext> child_context_owned( 1108 scoped_ptr<ResourceProviderContext> child_context_owned(
1107 ResourceProviderContext::Create(shared_data_.get())); 1109 ResourceProviderContext::Create(shared_data_.get()));
1108 1110
1109 FakeOutputSurfaceClient child_output_surface_client; 1111 FakeOutputSurfaceClient child_output_surface_client;
1110 scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d( 1112 scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d(
1111 child_context_owned.PassAs<TestWebGraphicsContext3D>())); 1113 child_context_owned.PassAs<TestWebGraphicsContext3D>()));
1112 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); 1114 CHECK(child_output_surface->BindToClient(&child_output_surface_client));
1113 1115
1114 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create( 1116 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create(
1115 child_output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 1117 child_output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1,
1118 false));
1116 1119
1117 gfx::Size size(1, 1); 1120 gfx::Size size(1, 1);
1118 ResourceFormat format = RGBA_8888; 1121 ResourceFormat format = RGBA_8888;
1119 size_t pixel_size = TextureSizeBytes(size, format); 1122 size_t pixel_size = TextureSizeBytes(size, format);
1120 ASSERT_EQ(4U, pixel_size); 1123 ASSERT_EQ(4U, pixel_size);
1121 1124
1122 ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource( 1125 ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource(
1123 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 1126 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
1124 uint8_t data1[4] = { 1, 2, 3, 4 }; 1127 uint8_t data1[4] = { 1, 2, 3, 4 };
1125 gfx::Rect rect(size); 1128 gfx::Rect rect(size);
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 child_context_owned.PassAs<TestWebGraphicsContext3D>())); 1588 child_context_owned.PassAs<TestWebGraphicsContext3D>()));
1586 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); 1589 CHECK(child_output_surface->BindToClient(&child_output_surface_client));
1587 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 1590 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
1588 new TestSharedBitmapManager()); 1591 new TestSharedBitmapManager());
1589 1592
1590 scoped_ptr<ResourceProvider> child_resource_provider( 1593 scoped_ptr<ResourceProvider> child_resource_provider(
1591 ResourceProvider::Create(child_output_surface.get(), 1594 ResourceProvider::Create(child_output_surface.get(),
1592 shared_bitmap_manager.get(), 1595 shared_bitmap_manager.get(),
1593 0, 1596 0,
1594 false, 1597 false,
1595 1)); 1598 1,
1599 false));
1596 1600
1597 scoped_ptr<TextureStateTrackingContext> parent_context_owned( 1601 scoped_ptr<TextureStateTrackingContext> parent_context_owned(
1598 new TextureStateTrackingContext); 1602 new TextureStateTrackingContext);
1599 TextureStateTrackingContext* parent_context = parent_context_owned.get(); 1603 TextureStateTrackingContext* parent_context = parent_context_owned.get();
1600 1604
1601 FakeOutputSurfaceClient parent_output_surface_client; 1605 FakeOutputSurfaceClient parent_output_surface_client;
1602 scoped_ptr<OutputSurface> parent_output_surface(FakeOutputSurface::Create3d( 1606 scoped_ptr<OutputSurface> parent_output_surface(FakeOutputSurface::Create3d(
1603 parent_context_owned.PassAs<TestWebGraphicsContext3D>())); 1607 parent_context_owned.PassAs<TestWebGraphicsContext3D>()));
1604 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); 1608 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client));
1605 1609
1606 scoped_ptr<ResourceProvider> parent_resource_provider( 1610 scoped_ptr<ResourceProvider> parent_resource_provider(
1607 ResourceProvider::Create(parent_output_surface.get(), 1611 ResourceProvider::Create(parent_output_surface.get(),
1608 shared_bitmap_manager.get(), 1612 shared_bitmap_manager.get(),
1609 0, 1613 0,
1610 false, 1614 false,
1611 1)); 1615 1,
1616 false));
1612 1617
1613 gfx::Size size(1, 1); 1618 gfx::Size size(1, 1);
1614 ResourceFormat format = RGBA_8888; 1619 ResourceFormat format = RGBA_8888;
1615 int child_texture_id = 1; 1620 int child_texture_id = 1;
1616 int parent_texture_id = 2; 1621 int parent_texture_id = 2;
1617 1622
1618 size_t pixel_size = TextureSizeBytes(size, format); 1623 size_t pixel_size = TextureSizeBytes(size, format);
1619 ASSERT_EQ(4U, pixel_size); 1624 ASSERT_EQ(4U, pixel_size);
1620 1625
1621 ResourceProvider::ResourceId id = child_resource_provider->CreateResource( 1626 ResourceProvider::ResourceId id = child_resource_provider->CreateResource(
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 scoped_ptr<TextureStateTrackingContext> context_owned( 2214 scoped_ptr<TextureStateTrackingContext> context_owned(
2210 new TextureStateTrackingContext); 2215 new TextureStateTrackingContext);
2211 TextureStateTrackingContext* context = context_owned.get(); 2216 TextureStateTrackingContext* context = context_owned.get();
2212 2217
2213 FakeOutputSurfaceClient output_surface_client; 2218 FakeOutputSurfaceClient output_surface_client;
2214 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 2219 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2215 context_owned.PassAs<TestWebGraphicsContext3D>())); 2220 context_owned.PassAs<TestWebGraphicsContext3D>()));
2216 CHECK(output_surface->BindToClient(&output_surface_client)); 2221 CHECK(output_surface->BindToClient(&output_surface_client));
2217 2222
2218 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2223 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2219 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2224 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2220 2225
2221 gfx::Size size(1, 1); 2226 gfx::Size size(1, 1);
2222 ResourceFormat format = RGBA_8888; 2227 ResourceFormat format = RGBA_8888;
2223 int texture_id = 1; 2228 int texture_id = 1;
2224 2229
2225 ResourceProvider::ResourceId id = resource_provider->CreateResource( 2230 ResourceProvider::ResourceId id = resource_provider->CreateResource(
2226 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 2231 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
2227 2232
2228 // Check that the texture gets created with the right sampler settings. 2233 // Check that the texture gets created with the right sampler settings.
2229 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) 2234 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id))
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 scoped_ptr<TextureStateTrackingContext> context_owned( 2295 scoped_ptr<TextureStateTrackingContext> context_owned(
2291 new TextureStateTrackingContext); 2296 new TextureStateTrackingContext);
2292 TextureStateTrackingContext* context = context_owned.get(); 2297 TextureStateTrackingContext* context = context_owned.get();
2293 2298
2294 FakeOutputSurfaceClient output_surface_client; 2299 FakeOutputSurfaceClient output_surface_client;
2295 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 2300 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2296 context_owned.PassAs<TestWebGraphicsContext3D>())); 2301 context_owned.PassAs<TestWebGraphicsContext3D>()));
2297 CHECK(output_surface->BindToClient(&output_surface_client)); 2302 CHECK(output_surface->BindToClient(&output_surface_client));
2298 2303
2299 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2304 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2300 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2305 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2301 2306
2302 gfx::Size size(1, 1); 2307 gfx::Size size(1, 1);
2303 ResourceFormat format = RGBA_8888; 2308 ResourceFormat format = RGBA_8888;
2304 int texture_id = 1; 2309 int texture_id = 1;
2305 2310
2306 // Check that the texture gets created with the right sampler settings. 2311 // Check that the texture gets created with the right sampler settings.
2307 ResourceProvider::ResourceId id = resource_provider->CreateManagedResource( 2312 ResourceProvider::ResourceId id = resource_provider->CreateManagedResource(
2308 size, 2313 size,
2309 GL_TEXTURE_2D, 2314 GL_TEXTURE_2D,
2310 GL_CLAMP_TO_EDGE, 2315 GL_CLAMP_TO_EDGE,
(...skipping 28 matching lines...) Expand all
2339 scoped_ptr<TextureStateTrackingContext> context_owned( 2344 scoped_ptr<TextureStateTrackingContext> context_owned(
2340 new TextureStateTrackingContext); 2345 new TextureStateTrackingContext);
2341 TextureStateTrackingContext* context = context_owned.get(); 2346 TextureStateTrackingContext* context = context_owned.get();
2342 2347
2343 FakeOutputSurfaceClient output_surface_client; 2348 FakeOutputSurfaceClient output_surface_client;
2344 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 2349 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2345 context_owned.PassAs<TestWebGraphicsContext3D>())); 2350 context_owned.PassAs<TestWebGraphicsContext3D>()));
2346 CHECK(output_surface->BindToClient(&output_surface_client)); 2351 CHECK(output_surface->BindToClient(&output_surface_client));
2347 2352
2348 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2353 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2349 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2354 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2350 2355
2351 gfx::Size size(1, 1); 2356 gfx::Size size(1, 1);
2352 ResourceFormat format = RGBA_8888; 2357 ResourceFormat format = RGBA_8888;
2353 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; 2358 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM;
2354 2359
2355 for (int texture_id = 1; texture_id <= 2; ++texture_id) { 2360 for (int texture_id = 1; texture_id <= 2; ++texture_id) {
2356 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; 2361 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT;
2357 // Check that the texture gets created with the right sampler settings. 2362 // Check that the texture gets created with the right sampler settings.
2358 ResourceProvider::ResourceId id = 2363 ResourceProvider::ResourceId id =
2359 resource_provider->CreateGLTexture(size, 2364 resource_provider->CreateGLTexture(size,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 scoped_ptr<base::SharedMemory> shared_memory( 2398 scoped_ptr<base::SharedMemory> shared_memory(
2394 CreateAndFillSharedMemory(size, kBadBeef)); 2399 CreateAndFillSharedMemory(size, kBadBeef));
2395 2400
2396 FakeOutputSurfaceClient output_surface_client; 2401 FakeOutputSurfaceClient output_surface_client;
2397 scoped_ptr<OutputSurface> output_surface( 2402 scoped_ptr<OutputSurface> output_surface(
2398 FakeOutputSurface::CreateSoftware(make_scoped_ptr( 2403 FakeOutputSurface::CreateSoftware(make_scoped_ptr(
2399 new SoftwareOutputDevice))); 2404 new SoftwareOutputDevice)));
2400 CHECK(output_surface->BindToClient(&output_surface_client)); 2405 CHECK(output_surface->BindToClient(&output_surface_client));
2401 2406
2402 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2407 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2403 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2408 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2404 2409
2405 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( 2410 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
2406 base::Bind(&EmptyReleaseCallback)); 2411 base::Bind(&EmptyReleaseCallback));
2407 TextureMailbox mailbox(shared_memory.get(), size); 2412 TextureMailbox mailbox(shared_memory.get(), size);
2408 2413
2409 ResourceProvider::ResourceId id = 2414 ResourceProvider::ResourceId id =
2410 resource_provider->CreateResourceFromTextureMailbox( 2415 resource_provider->CreateResourceFromTextureMailbox(
2411 mailbox, callback.Pass()); 2416 mailbox, callback.Pass());
2412 EXPECT_NE(0u, id); 2417 EXPECT_NE(0u, id);
2413 2418
(...skipping 14 matching lines...) Expand all
2428 scoped_ptr<TextureStateTrackingContext> context_owned( 2433 scoped_ptr<TextureStateTrackingContext> context_owned(
2429 new TextureStateTrackingContext); 2434 new TextureStateTrackingContext);
2430 TextureStateTrackingContext* context = context_owned.get(); 2435 TextureStateTrackingContext* context = context_owned.get();
2431 2436
2432 FakeOutputSurfaceClient output_surface_client; 2437 FakeOutputSurfaceClient output_surface_client;
2433 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 2438 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2434 context_owned.PassAs<TestWebGraphicsContext3D>())); 2439 context_owned.PassAs<TestWebGraphicsContext3D>()));
2435 CHECK(output_surface->BindToClient(&output_surface_client)); 2440 CHECK(output_surface->BindToClient(&output_surface_client));
2436 2441
2437 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2442 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2438 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2443 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2439 2444
2440 unsigned texture_id = 1; 2445 unsigned texture_id = 1;
2441 uint32 sync_point = 30; 2446 uint32 sync_point = 30;
2442 unsigned target = GL_TEXTURE_2D; 2447 unsigned target = GL_TEXTURE_2D;
2443 2448
2444 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 2449 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
2445 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 2450 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
2446 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 2451 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
2447 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 2452 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0);
2448 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); 2453 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 scoped_ptr<TextureStateTrackingContext> context_owned( 2497 scoped_ptr<TextureStateTrackingContext> context_owned(
2493 new TextureStateTrackingContext); 2498 new TextureStateTrackingContext);
2494 TextureStateTrackingContext* context = context_owned.get(); 2499 TextureStateTrackingContext* context = context_owned.get();
2495 2500
2496 FakeOutputSurfaceClient output_surface_client; 2501 FakeOutputSurfaceClient output_surface_client;
2497 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 2502 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2498 context_owned.PassAs<TestWebGraphicsContext3D>())); 2503 context_owned.PassAs<TestWebGraphicsContext3D>()));
2499 CHECK(output_surface->BindToClient(&output_surface_client)); 2504 CHECK(output_surface->BindToClient(&output_surface_client));
2500 2505
2501 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2506 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2502 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2507 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2503 2508
2504 unsigned texture_id = 1; 2509 unsigned texture_id = 1;
2505 uint32 sync_point = 30; 2510 uint32 sync_point = 30;
2506 unsigned target = GL_TEXTURE_EXTERNAL_OES; 2511 unsigned target = GL_TEXTURE_EXTERNAL_OES;
2507 2512
2508 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 2513 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
2509 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 2514 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
2510 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 2515 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
2511 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 2516 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0);
2512 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); 2517 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 scoped_ptr<AllocationTrackingContext3D> context_owned( 2635 scoped_ptr<AllocationTrackingContext3D> context_owned(
2631 new StrictMock<AllocationTrackingContext3D>); 2636 new StrictMock<AllocationTrackingContext3D>);
2632 AllocationTrackingContext3D* context = context_owned.get(); 2637 AllocationTrackingContext3D* context = context_owned.get();
2633 2638
2634 FakeOutputSurfaceClient output_surface_client; 2639 FakeOutputSurfaceClient output_surface_client;
2635 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 2640 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2636 context_owned.PassAs<TestWebGraphicsContext3D>())); 2641 context_owned.PassAs<TestWebGraphicsContext3D>()));
2637 CHECK(output_surface->BindToClient(&output_surface_client)); 2642 CHECK(output_surface->BindToClient(&output_surface_client));
2638 2643
2639 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2644 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2640 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2645 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2641 2646
2642 gfx::Size size(2, 2); 2647 gfx::Size size(2, 2);
2643 gfx::Vector2d offset(0, 0); 2648 gfx::Vector2d offset(0, 0);
2644 gfx::Rect rect(0, 0, 2, 2); 2649 gfx::Rect rect(0, 0, 2, 2);
2645 ResourceFormat format = RGBA_8888; 2650 ResourceFormat format = RGBA_8888;
2646 ResourceProvider::ResourceId id = 0; 2651 ResourceProvider::ResourceId id = 0;
2647 uint8_t pixels[16] = { 0 }; 2652 uint8_t pixels[16] = { 0 };
2648 int texture_id = 123; 2653 int texture_id = 123;
2649 2654
2650 // Lazy allocation. Don't allocate when creating the resource. 2655 // Lazy allocation. Don't allocate when creating the resource.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 new StrictMock<AllocationTrackingContext3D>); 2708 new StrictMock<AllocationTrackingContext3D>);
2704 AllocationTrackingContext3D* context = context_owned.get(); 2709 AllocationTrackingContext3D* context = context_owned.get();
2705 context->set_support_texture_storage(true); 2710 context->set_support_texture_storage(true);
2706 2711
2707 FakeOutputSurfaceClient output_surface_client; 2712 FakeOutputSurfaceClient output_surface_client;
2708 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 2713 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2709 context_owned.PassAs<TestWebGraphicsContext3D>())); 2714 context_owned.PassAs<TestWebGraphicsContext3D>()));
2710 CHECK(output_surface->BindToClient(&output_surface_client)); 2715 CHECK(output_surface->BindToClient(&output_surface_client));
2711 2716
2712 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2717 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2713 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2718 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2714 2719
2715 gfx::Size size(2, 2); 2720 gfx::Size size(2, 2);
2716 ResourceFormat format = RGBA_8888; 2721 ResourceFormat format = RGBA_8888;
2717 ResourceProvider::ResourceId id = 0; 2722 ResourceProvider::ResourceId id = 0;
2718 int texture_id = 123; 2723 int texture_id = 123;
2719 2724
2720 // Lazy allocation. Don't allocate when creating the resource. 2725 // Lazy allocation. Don't allocate when creating the resource.
2721 id = resource_provider->CreateResource( 2726 id = resource_provider->CreateResource(
2722 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 2727 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
2723 2728
(...skipping 16 matching lines...) Expand all
2740 new StrictMock<AllocationTrackingContext3D>); 2745 new StrictMock<AllocationTrackingContext3D>);
2741 AllocationTrackingContext3D* context = context_owned.get(); 2746 AllocationTrackingContext3D* context = context_owned.get();
2742 context->set_support_texture_storage(true); 2747 context->set_support_texture_storage(true);
2743 2748
2744 FakeOutputSurfaceClient output_surface_client; 2749 FakeOutputSurfaceClient output_surface_client;
2745 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 2750 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2746 context_owned.PassAs<TestWebGraphicsContext3D>())); 2751 context_owned.PassAs<TestWebGraphicsContext3D>()));
2747 CHECK(output_surface->BindToClient(&output_surface_client)); 2752 CHECK(output_surface->BindToClient(&output_surface_client));
2748 2753
2749 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2754 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2750 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2755 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2751 2756
2752 gfx::Size size(2, 2); 2757 gfx::Size size(2, 2);
2753 ResourceFormat format = RGBA_8888; 2758 ResourceFormat format = RGBA_8888;
2754 ResourceProvider::ResourceId id = 0; 2759 ResourceProvider::ResourceId id = 0;
2755 int texture_id = 123; 2760 int texture_id = 123;
2756 2761
2757 // Lazy allocation. Don't allocate when creating the resource. 2762 // Lazy allocation. Don't allocate when creating the resource.
2758 id = resource_provider->CreateResource( 2763 id = resource_provider->CreateResource(
2759 size, 2764 size,
2760 GL_CLAMP_TO_EDGE, 2765 GL_CLAMP_TO_EDGE,
(...skipping 22 matching lines...) Expand all
2783 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 2788 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2784 context_owned.PassAs<TestWebGraphicsContext3D>())); 2789 context_owned.PassAs<TestWebGraphicsContext3D>()));
2785 CHECK(output_surface->BindToClient(&output_surface_client)); 2790 CHECK(output_surface->BindToClient(&output_surface_client));
2786 2791
2787 gfx::Size size(2, 2); 2792 gfx::Size size(2, 2);
2788 ResourceFormat format = RGBA_8888; 2793 ResourceFormat format = RGBA_8888;
2789 ResourceProvider::ResourceId id = 0; 2794 ResourceProvider::ResourceId id = 0;
2790 int texture_id = 123; 2795 int texture_id = 123;
2791 2796
2792 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2797 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2793 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2798 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2794 2799
2795 id = resource_provider->CreateResource( 2800 id = resource_provider->CreateResource(
2796 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 2801 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
2797 resource_provider->AcquirePixelRasterBuffer(id); 2802 resource_provider->AcquirePixelRasterBuffer(id);
2798 2803
2799 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); 2804 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
2800 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); 2805 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
2801 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) 2806 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _))
2802 .Times(1); 2807 .Times(1);
2803 resource_provider->BeginSetPixels(id); 2808 resource_provider->BeginSetPixels(id);
(...skipping 20 matching lines...) Expand all
2824 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 2829 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2825 context_owned.PassAs<TestWebGraphicsContext3D>())); 2830 context_owned.PassAs<TestWebGraphicsContext3D>()));
2826 CHECK(output_surface->BindToClient(&output_surface_client)); 2831 CHECK(output_surface->BindToClient(&output_surface_client));
2827 2832
2828 gfx::Size size(2, 2); 2833 gfx::Size size(2, 2);
2829 ResourceFormat format = RGBA_8888; 2834 ResourceFormat format = RGBA_8888;
2830 ResourceProvider::ResourceId id = 0; 2835 ResourceProvider::ResourceId id = 0;
2831 int texture_id = 123; 2836 int texture_id = 123;
2832 2837
2833 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2838 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2834 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2839 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2835 2840
2836 id = resource_provider->CreateResource( 2841 id = resource_provider->CreateResource(
2837 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 2842 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
2838 resource_provider->AcquirePixelRasterBuffer(id); 2843 resource_provider->AcquirePixelRasterBuffer(id);
2839 2844
2840 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); 2845 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
2841 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); 2846 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
2842 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) 2847 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _))
2843 .Times(1); 2848 .Times(1);
2844 resource_provider->BeginSetPixels(id); 2849 resource_provider->BeginSetPixels(id);
(...skipping 20 matching lines...) Expand all
2865 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 2870 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2866 context_owned.PassAs<TestWebGraphicsContext3D>())); 2871 context_owned.PassAs<TestWebGraphicsContext3D>()));
2867 CHECK(output_surface->BindToClient(&output_surface_client)); 2872 CHECK(output_surface->BindToClient(&output_surface_client));
2868 2873
2869 gfx::Size size(2, 2); 2874 gfx::Size size(2, 2);
2870 ResourceFormat format = RGBA_8888; 2875 ResourceFormat format = RGBA_8888;
2871 ResourceProvider::ResourceId id = 0; 2876 ResourceProvider::ResourceId id = 0;
2872 int texture_id = 123; 2877 int texture_id = 123;
2873 2878
2874 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2879 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2875 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2880 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2876 2881
2877 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); 2882 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id));
2878 2883
2879 id = resource_provider->CreateResource( 2884 id = resource_provider->CreateResource(
2880 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 2885 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
2881 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, 2886 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
2882 GL_INNOCENT_CONTEXT_RESET_ARB); 2887 GL_INNOCENT_CONTEXT_RESET_ARB);
2883 2888
2884 resource_provider->AcquirePixelRasterBuffer(id); 2889 resource_provider->AcquirePixelRasterBuffer(id);
2885 SkCanvas* raster_canvas = resource_provider->MapPixelRasterBuffer(id); 2890 SkCanvas* raster_canvas = resource_provider->MapPixelRasterBuffer(id);
(...skipping 18 matching lines...) Expand all
2904 2909
2905 const int kWidth = 2; 2910 const int kWidth = 2;
2906 const int kHeight = 2; 2911 const int kHeight = 2;
2907 gfx::Size size(kWidth, kHeight); 2912 gfx::Size size(kWidth, kHeight);
2908 ResourceFormat format = RGBA_8888; 2913 ResourceFormat format = RGBA_8888;
2909 ResourceProvider::ResourceId id = 0; 2914 ResourceProvider::ResourceId id = 0;
2910 const unsigned kTextureId = 123u; 2915 const unsigned kTextureId = 123u;
2911 const unsigned kImageId = 234u; 2916 const unsigned kImageId = 234u;
2912 2917
2913 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2918 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2914 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 2919 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
2915 2920
2916 id = resource_provider->CreateResource( 2921 id = resource_provider->CreateResource(
2917 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 2922 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
2918 2923
2919 const int kStride = 4; 2924 const int kStride = 4;
2920 void* dummy_mapped_buffer_address = NULL; 2925 void* dummy_mapped_buffer_address = NULL;
2921 EXPECT_CALL(*context, createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES)) 2926 EXPECT_CALL(*context, createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES))
2922 .WillOnce(Return(kImageId)) 2927 .WillOnce(Return(kImageId))
2923 .RetiresOnSaturation(); 2928 .RetiresOnSaturation();
2924 EXPECT_CALL(*context, getImageParameterivCHROMIUM(kImageId, 2929 EXPECT_CALL(*context, getImageParameterivCHROMIUM(kImageId,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2996 FakeOutputSurface::CreateSoftware(make_scoped_ptr( 3001 FakeOutputSurface::CreateSoftware(make_scoped_ptr(
2997 new SoftwareOutputDevice))); 3002 new SoftwareOutputDevice)));
2998 CHECK(output_surface->BindToClient(&output_surface_client)); 3003 CHECK(output_surface->BindToClient(&output_surface_client));
2999 3004
3000 gfx::Size size(1, 1); 3005 gfx::Size size(1, 1);
3001 ResourceFormat format = RGBA_8888; 3006 ResourceFormat format = RGBA_8888;
3002 ResourceProvider::ResourceId id = 0; 3007 ResourceProvider::ResourceId id = 0;
3003 const uint32_t kBadBeef = 0xbadbeef; 3008 const uint32_t kBadBeef = 0xbadbeef;
3004 3009
3005 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3010 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3006 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 3011 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
3007 3012
3008 id = resource_provider->CreateResource( 3013 id = resource_provider->CreateResource(
3009 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 3014 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
3010 3015
3011 SkBitmap bitmap; 3016 SkBitmap bitmap;
3012 bitmap.allocN32Pixels(size.width(), size.height()); 3017 bitmap.allocN32Pixels(size.width(), size.height());
3013 *(bitmap.getAddr32(0, 0)) = kBadBeef; 3018 *(bitmap.getAddr32(0, 0)) = kBadBeef;
3014 SkCanvas* canvas = resource_provider->MapImageRasterBuffer(id); 3019 SkCanvas* canvas = resource_provider->MapImageRasterBuffer(id);
3015 ASSERT_TRUE(!!canvas); 3020 ASSERT_TRUE(!!canvas);
3016 canvas->writePixels(bitmap, 0, 0); 3021 canvas->writePixels(bitmap, 0, 0);
(...skipping 27 matching lines...) Expand all
3044 const int kHeight = 2; 3049 const int kHeight = 2;
3045 gfx::Size size(kWidth, kHeight); 3050 gfx::Size size(kWidth, kHeight);
3046 ResourceFormat format = RGBA_8888; 3051 ResourceFormat format = RGBA_8888;
3047 ResourceProvider::ResourceId source_id = 0; 3052 ResourceProvider::ResourceId source_id = 0;
3048 ResourceProvider::ResourceId dest_id = 0; 3053 ResourceProvider::ResourceId dest_id = 0;
3049 const unsigned kSourceTextureId = 123u; 3054 const unsigned kSourceTextureId = 123u;
3050 const unsigned kDestTextureId = 321u; 3055 const unsigned kDestTextureId = 321u;
3051 const unsigned kImageId = 234u; 3056 const unsigned kImageId = 234u;
3052 3057
3053 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3058 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3054 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 3059 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
3055 3060
3056 source_id = resource_provider->CreateResource( 3061 source_id = resource_provider->CreateResource(
3057 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 3062 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
3058 3063
3059 const int kStride = 4; 3064 const int kStride = 4;
3060 void* dummy_mapped_buffer_address = NULL; 3065 void* dummy_mapped_buffer_address = NULL;
3061 EXPECT_CALL(*context, createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES)) 3066 EXPECT_CALL(*context, createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES))
3062 .WillOnce(Return(kImageId)) 3067 .WillOnce(Return(kImageId))
3063 .RetiresOnSaturation(); 3068 .RetiresOnSaturation();
3064 EXPECT_CALL( 3069 EXPECT_CALL(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3120 make_scoped_ptr(new SoftwareOutputDevice))); 3125 make_scoped_ptr(new SoftwareOutputDevice)));
3121 CHECK(output_surface->BindToClient(&output_surface_client)); 3126 CHECK(output_surface->BindToClient(&output_surface_client));
3122 3127
3123 gfx::Size size(1, 1); 3128 gfx::Size size(1, 1);
3124 ResourceFormat format = RGBA_8888; 3129 ResourceFormat format = RGBA_8888;
3125 ResourceProvider::ResourceId source_id = 0; 3130 ResourceProvider::ResourceId source_id = 0;
3126 ResourceProvider::ResourceId dest_id = 0; 3131 ResourceProvider::ResourceId dest_id = 0;
3127 const uint32_t kBadBeef = 0xbadbeef; 3132 const uint32_t kBadBeef = 0xbadbeef;
3128 3133
3129 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3134 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3130 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1)); 3135 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false));
3131 3136
3132 source_id = resource_provider->CreateResource( 3137 source_id = resource_provider->CreateResource(
3133 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 3138 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
3134 3139
3135 SkBitmap bitmap; 3140 SkBitmap bitmap;
3136 bitmap.allocN32Pixels(size.width(), size.height()); 3141 bitmap.allocN32Pixels(size.width(), size.height());
3137 *(bitmap.getAddr32(0, 0)) = kBadBeef; 3142 *(bitmap.getAddr32(0, 0)) = kBadBeef;
3138 SkCanvas* canvas = resource_provider->MapImageRasterBuffer(source_id); 3143 SkCanvas* canvas = resource_provider->MapImageRasterBuffer(source_id);
3139 ASSERT_TRUE(!!canvas); 3144 ASSERT_TRUE(!!canvas);
3140 canvas->writePixels(bitmap, 0, 0); 3145 canvas->writePixels(bitmap, 0, 0);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3177 TEST(ResourceProviderTest, BasicInitializeGLSoftware) { 3182 TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
3178 scoped_ptr<ContextSharedData> shared_data = ContextSharedData::Create(); 3183 scoped_ptr<ContextSharedData> shared_data = ContextSharedData::Create();
3179 FakeOutputSurfaceClient client; 3184 FakeOutputSurfaceClient client;
3180 scoped_ptr<FakeOutputSurface> output_surface( 3185 scoped_ptr<FakeOutputSurface> output_surface(
3181 FakeOutputSurface::CreateDeferredGL( 3186 FakeOutputSurface::CreateDeferredGL(
3182 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice))); 3187 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice)));
3183 EXPECT_TRUE(output_surface->BindToClient(&client)); 3188 EXPECT_TRUE(output_surface->BindToClient(&client));
3184 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 3189 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
3185 new TestSharedBitmapManager()); 3190 new TestSharedBitmapManager());
3186 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3191 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3187 output_surface.get(), shared_bitmap_manager.get(), 0, false, 1)); 3192 output_surface.get(), shared_bitmap_manager.get(), 0, false, 1, false));
3188 3193
3189 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); 3194 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL);
3190 3195
3191 InitializeGLAndCheck(shared_data.get(), 3196 InitializeGLAndCheck(shared_data.get(),
3192 resource_provider.get(), 3197 resource_provider.get(),
3193 output_surface.get()); 3198 output_surface.get());
3194 3199
3195 resource_provider->InitializeSoftware(); 3200 resource_provider->InitializeSoftware();
3196 output_surface->ReleaseGL(); 3201 output_surface->ReleaseGL();
3197 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); 3202 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL);
(...skipping 16 matching lines...) Expand all
3214 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 3219 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3215 context_owned.PassAs<TestWebGraphicsContext3D>())); 3220 context_owned.PassAs<TestWebGraphicsContext3D>()));
3216 CHECK(output_surface->BindToClient(&output_surface_client)); 3221 CHECK(output_surface->BindToClient(&output_surface_client));
3217 3222
3218 gfx::Size size(4, 4); 3223 gfx::Size size(4, 4);
3219 scoped_ptr<ResourceProvider> resource_provider( 3224 scoped_ptr<ResourceProvider> resource_provider(
3220 ResourceProvider::Create(output_surface.get(), 3225 ResourceProvider::Create(output_surface.get(),
3221 shared_bitmap_manager_.get(), 3226 shared_bitmap_manager_.get(),
3222 0, 3227 0,
3223 false, 3228 false,
3224 1)); 3229 1,
3230 false));
3225 int texture_id = 123; 3231 int texture_id = 123;
3226 3232
3227 ResourceProvider::ResourceId id = resource_provider->CreateResource( 3233 ResourceProvider::ResourceId id = resource_provider->CreateResource(
3228 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, ETC1); 3234 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, ETC1);
3229 EXPECT_NE(0u, id); 3235 EXPECT_NE(0u, id);
3230 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); 3236 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
3231 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); 3237 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
3232 resource_provider->AllocateForTesting(id); 3238 resource_provider->AllocateForTesting(id);
3233 3239
3234 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); 3240 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1);
(...skipping 13 matching lines...) Expand all
3248 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 3254 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3249 context_owned.PassAs<TestWebGraphicsContext3D>())); 3255 context_owned.PassAs<TestWebGraphicsContext3D>()));
3250 CHECK(output_surface->BindToClient(&output_surface_client)); 3256 CHECK(output_surface->BindToClient(&output_surface_client));
3251 3257
3252 gfx::Size size(4, 4); 3258 gfx::Size size(4, 4);
3253 scoped_ptr<ResourceProvider> resource_provider( 3259 scoped_ptr<ResourceProvider> resource_provider(
3254 ResourceProvider::Create(output_surface.get(), 3260 ResourceProvider::Create(output_surface.get(),
3255 shared_bitmap_manager_.get(), 3261 shared_bitmap_manager_.get(),
3256 0, 3262 0,
3257 false, 3263 false,
3258 1)); 3264 1,
3265 false));
3259 int texture_id = 123; 3266 int texture_id = 123;
3260 uint8_t pixels[8]; 3267 uint8_t pixels[8];
3261 3268
3262 ResourceProvider::ResourceId id = resource_provider->CreateResource( 3269 ResourceProvider::ResourceId id = resource_provider->CreateResource(
3263 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, ETC1); 3270 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, ETC1);
3264 EXPECT_NE(0u, id); 3271 EXPECT_NE(0u, id);
3265 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); 3272 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
3266 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); 3273 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3);
3267 EXPECT_CALL(*context, 3274 EXPECT_CALL(*context,
3268 compressedTexImage2D( 3275 compressedTexImage2D(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 gfx::Size size(1, 1); 3314 gfx::Size size(1, 1);
3308 ResourceFormat format = RGBA_8888; 3315 ResourceFormat format = RGBA_8888;
3309 3316
3310 { 3317 {
3311 size_t kTextureAllocationChunkSize = 1; 3318 size_t kTextureAllocationChunkSize = 1;
3312 scoped_ptr<ResourceProvider> resource_provider( 3319 scoped_ptr<ResourceProvider> resource_provider(
3313 ResourceProvider::Create(output_surface.get(), 3320 ResourceProvider::Create(output_surface.get(),
3314 shared_bitmap_manager.get(), 3321 shared_bitmap_manager.get(),
3315 0, 3322 0,
3316 false, 3323 false,
3317 kTextureAllocationChunkSize)); 3324 kTextureAllocationChunkSize,
3325 false));
3318 3326
3319 ResourceProvider::ResourceId id = resource_provider->CreateResource( 3327 ResourceProvider::ResourceId id = resource_provider->CreateResource(
3320 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 3328 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
3321 resource_provider->AllocateForTesting(id); 3329 resource_provider->AllocateForTesting(id);
3322 Mock::VerifyAndClearExpectations(context); 3330 Mock::VerifyAndClearExpectations(context);
3323 3331
3324 DCHECK_EQ(2u, context->PeekTextureId()); 3332 DCHECK_EQ(2u, context->PeekTextureId());
3325 resource_provider->DeleteResource(id); 3333 resource_provider->DeleteResource(id);
3326 } 3334 }
3327 3335
3328 { 3336 {
3329 size_t kTextureAllocationChunkSize = 8; 3337 size_t kTextureAllocationChunkSize = 8;
3330 scoped_ptr<ResourceProvider> resource_provider( 3338 scoped_ptr<ResourceProvider> resource_provider(
3331 ResourceProvider::Create(output_surface.get(), 3339 ResourceProvider::Create(output_surface.get(),
3332 shared_bitmap_manager.get(), 3340 shared_bitmap_manager.get(),
3333 0, 3341 0,
3334 false, 3342 false,
3335 kTextureAllocationChunkSize)); 3343 kTextureAllocationChunkSize,
3344 false));
3336 3345
3337 ResourceProvider::ResourceId id = resource_provider->CreateResource( 3346 ResourceProvider::ResourceId id = resource_provider->CreateResource(
3338 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 3347 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
3339 resource_provider->AllocateForTesting(id); 3348 resource_provider->AllocateForTesting(id);
3340 Mock::VerifyAndClearExpectations(context); 3349 Mock::VerifyAndClearExpectations(context);
3341 3350
3342 DCHECK_EQ(10u, context->PeekTextureId()); 3351 DCHECK_EQ(10u, context->PeekTextureId());
3343 resource_provider->DeleteResource(id); 3352 resource_provider->DeleteResource(id);
3344 } 3353 }
3345 } 3354 }
3346 3355
3347 } // namespace 3356 } // namespace
3348 } // namespace cc 3357 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/resource_update_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698