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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 shared_bitmap_manager_.reset(new TestSharedBitmapManager); | 418 shared_bitmap_manager_.reset(new TestSharedBitmapManager); |
419 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); | 419 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); |
420 | 420 |
421 resource_provider_ = | 421 resource_provider_ = |
422 ResourceProvider::Create(output_surface_.get(), | 422 ResourceProvider::Create(output_surface_.get(), |
423 shared_bitmap_manager_.get(), | 423 shared_bitmap_manager_.get(), |
424 gpu_memory_buffer_manager_.get(), | 424 gpu_memory_buffer_manager_.get(), |
425 main_thread_task_runner_.get(), | 425 main_thread_task_runner_.get(), |
426 0, | 426 0, |
427 false, | 427 false, |
428 1, | 428 1); |
429 false); | |
430 child_resource_provider_ = | 429 child_resource_provider_ = |
431 ResourceProvider::Create(child_output_surface_.get(), | 430 ResourceProvider::Create(child_output_surface_.get(), |
432 shared_bitmap_manager_.get(), | 431 shared_bitmap_manager_.get(), |
433 gpu_memory_buffer_manager_.get(), | 432 gpu_memory_buffer_manager_.get(), |
434 main_thread_task_runner_.get(), | 433 main_thread_task_runner_.get(), |
435 0, | 434 0, |
436 false, | 435 false, |
437 1, | 436 1); |
438 false); | |
439 } | 437 } |
440 | 438 |
441 static void CollectResources(ReturnedResourceArray* array, | 439 static void CollectResources(ReturnedResourceArray* array, |
442 const ReturnedResourceArray& returned, | 440 const ReturnedResourceArray& returned, |
443 BlockingTaskRunner* main_thread_task_runner) { | 441 BlockingTaskRunner* main_thread_task_runner) { |
444 array->insert(array->end(), returned.begin(), returned.end()); | 442 array->insert(array->end(), returned.begin(), returned.end()); |
445 } | 443 } |
446 | 444 |
447 static ReturnCallback GetReturnCallback(ReturnedResourceArray* array) { | 445 static ReturnCallback GetReturnCallback(ReturnedResourceArray* array) { |
448 return base::Bind(&ResourceProviderTest::CollectResources, array); | 446 return base::Bind(&ResourceProviderTest::CollectResources, array); |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1161 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
1164 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1162 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
1165 | 1163 |
1166 scoped_ptr<ResourceProvider> child_resource_provider( | 1164 scoped_ptr<ResourceProvider> child_resource_provider( |
1167 ResourceProvider::Create(child_output_surface.get(), | 1165 ResourceProvider::Create(child_output_surface.get(), |
1168 shared_bitmap_manager_.get(), | 1166 shared_bitmap_manager_.get(), |
1169 gpu_memory_buffer_manager_.get(), | 1167 gpu_memory_buffer_manager_.get(), |
1170 NULL, | 1168 NULL, |
1171 0, | 1169 0, |
1172 false, | 1170 false, |
1173 1, | 1171 1)); |
1174 false)); | |
1175 | 1172 |
1176 gfx::Size size(1, 1); | 1173 gfx::Size size(1, 1); |
1177 ResourceFormat format = RGBA_8888; | 1174 ResourceFormat format = RGBA_8888; |
1178 size_t pixel_size = TextureSizeBytes(size, format); | 1175 size_t pixel_size = TextureSizeBytes(size, format); |
1179 ASSERT_EQ(4U, pixel_size); | 1176 ASSERT_EQ(4U, pixel_size); |
1180 | 1177 |
1181 ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource( | 1178 ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource( |
1182 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 1179 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
1183 uint8_t data1[4] = { 1, 2, 3, 4 }; | 1180 uint8_t data1[4] = { 1, 2, 3, 4 }; |
1184 gfx::Rect rect(size); | 1181 gfx::Rect rect(size); |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1643 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1647 new TestSharedBitmapManager()); | 1644 new TestSharedBitmapManager()); |
1648 | 1645 |
1649 scoped_ptr<ResourceProvider> child_resource_provider( | 1646 scoped_ptr<ResourceProvider> child_resource_provider( |
1650 ResourceProvider::Create(child_output_surface.get(), | 1647 ResourceProvider::Create(child_output_surface.get(), |
1651 shared_bitmap_manager.get(), | 1648 shared_bitmap_manager.get(), |
1652 NULL, | 1649 NULL, |
1653 NULL, | 1650 NULL, |
1654 0, | 1651 0, |
1655 false, | 1652 false, |
1656 1, | 1653 1)); |
1657 false)); | |
1658 | 1654 |
1659 scoped_ptr<TextureStateTrackingContext> parent_context_owned( | 1655 scoped_ptr<TextureStateTrackingContext> parent_context_owned( |
1660 new TextureStateTrackingContext); | 1656 new TextureStateTrackingContext); |
1661 TextureStateTrackingContext* parent_context = parent_context_owned.get(); | 1657 TextureStateTrackingContext* parent_context = parent_context_owned.get(); |
1662 | 1658 |
1663 FakeOutputSurfaceClient parent_output_surface_client; | 1659 FakeOutputSurfaceClient parent_output_surface_client; |
1664 scoped_ptr<OutputSurface> parent_output_surface( | 1660 scoped_ptr<OutputSurface> parent_output_surface( |
1665 FakeOutputSurface::Create3d(parent_context_owned.Pass())); | 1661 FakeOutputSurface::Create3d(parent_context_owned.Pass())); |
1666 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); | 1662 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); |
1667 | 1663 |
1668 scoped_ptr<ResourceProvider> parent_resource_provider( | 1664 scoped_ptr<ResourceProvider> parent_resource_provider( |
1669 ResourceProvider::Create(parent_output_surface.get(), | 1665 ResourceProvider::Create(parent_output_surface.get(), |
1670 shared_bitmap_manager.get(), | 1666 shared_bitmap_manager.get(), |
1671 NULL, | 1667 NULL, |
1672 NULL, | 1668 NULL, |
1673 0, | 1669 0, |
1674 false, | 1670 false, |
1675 1, | 1671 1)); |
1676 false)); | |
1677 | 1672 |
1678 gfx::Size size(1, 1); | 1673 gfx::Size size(1, 1); |
1679 ResourceFormat format = RGBA_8888; | 1674 ResourceFormat format = RGBA_8888; |
1680 int child_texture_id = 1; | 1675 int child_texture_id = 1; |
1681 int parent_texture_id = 2; | 1676 int parent_texture_id = 2; |
1682 | 1677 |
1683 size_t pixel_size = TextureSizeBytes(size, format); | 1678 size_t pixel_size = TextureSizeBytes(size, format); |
1684 ASSERT_EQ(4U, pixel_size); | 1679 ASSERT_EQ(4U, pixel_size); |
1685 | 1680 |
1686 ResourceProvider::ResourceId id = child_resource_provider->CreateResource( | 1681 ResourceProvider::ResourceId id = child_resource_provider->CreateResource( |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2298 FakeOutputSurface::Create3d(context_owned.Pass())); | 2293 FakeOutputSurface::Create3d(context_owned.Pass())); |
2299 CHECK(output_surface->BindToClient(&output_surface_client)); | 2294 CHECK(output_surface->BindToClient(&output_surface_client)); |
2300 | 2295 |
2301 scoped_ptr<ResourceProvider> resource_provider( | 2296 scoped_ptr<ResourceProvider> resource_provider( |
2302 ResourceProvider::Create(output_surface.get(), | 2297 ResourceProvider::Create(output_surface.get(), |
2303 shared_bitmap_manager_.get(), | 2298 shared_bitmap_manager_.get(), |
2304 gpu_memory_buffer_manager_.get(), | 2299 gpu_memory_buffer_manager_.get(), |
2305 NULL, | 2300 NULL, |
2306 0, | 2301 0, |
2307 false, | 2302 false, |
2308 1, | 2303 1)); |
2309 false)); | |
2310 | 2304 |
2311 gfx::Size size(1, 1); | 2305 gfx::Size size(1, 1); |
2312 ResourceFormat format = RGBA_8888; | 2306 ResourceFormat format = RGBA_8888; |
2313 int texture_id = 1; | 2307 int texture_id = 1; |
2314 | 2308 |
2315 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 2309 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
2316 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 2310 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
2317 | 2311 |
2318 // Check that the texture gets created with the right sampler settings. | 2312 // Check that the texture gets created with the right sampler settings. |
2319 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) | 2313 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2386 FakeOutputSurface::Create3d(context_owned.Pass())); | 2380 FakeOutputSurface::Create3d(context_owned.Pass())); |
2387 CHECK(output_surface->BindToClient(&output_surface_client)); | 2381 CHECK(output_surface->BindToClient(&output_surface_client)); |
2388 | 2382 |
2389 scoped_ptr<ResourceProvider> resource_provider( | 2383 scoped_ptr<ResourceProvider> resource_provider( |
2390 ResourceProvider::Create(output_surface.get(), | 2384 ResourceProvider::Create(output_surface.get(), |
2391 shared_bitmap_manager_.get(), | 2385 shared_bitmap_manager_.get(), |
2392 gpu_memory_buffer_manager_.get(), | 2386 gpu_memory_buffer_manager_.get(), |
2393 NULL, | 2387 NULL, |
2394 0, | 2388 0, |
2395 false, | 2389 false, |
2396 1, | 2390 1)); |
2397 false)); | |
2398 | 2391 |
2399 gfx::Size size(1, 1); | 2392 gfx::Size size(1, 1); |
2400 ResourceFormat format = RGBA_8888; | 2393 ResourceFormat format = RGBA_8888; |
2401 int texture_id = 1; | 2394 int texture_id = 1; |
2402 | 2395 |
2403 // Check that the texture gets created with the right sampler settings. | 2396 // Check that the texture gets created with the right sampler settings. |
2404 ResourceProvider::ResourceId id = resource_provider->CreateManagedResource( | 2397 ResourceProvider::ResourceId id = resource_provider->CreateManagedResource( |
2405 size, | 2398 size, |
2406 GL_TEXTURE_2D, | 2399 GL_TEXTURE_2D, |
2407 GL_CLAMP_TO_EDGE, | 2400 GL_CLAMP_TO_EDGE, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2442 FakeOutputSurface::Create3d(context_owned.Pass())); | 2435 FakeOutputSurface::Create3d(context_owned.Pass())); |
2443 CHECK(output_surface->BindToClient(&output_surface_client)); | 2436 CHECK(output_surface->BindToClient(&output_surface_client)); |
2444 | 2437 |
2445 scoped_ptr<ResourceProvider> resource_provider( | 2438 scoped_ptr<ResourceProvider> resource_provider( |
2446 ResourceProvider::Create(output_surface.get(), | 2439 ResourceProvider::Create(output_surface.get(), |
2447 shared_bitmap_manager_.get(), | 2440 shared_bitmap_manager_.get(), |
2448 gpu_memory_buffer_manager_.get(), | 2441 gpu_memory_buffer_manager_.get(), |
2449 NULL, | 2442 NULL, |
2450 0, | 2443 0, |
2451 false, | 2444 false, |
2452 1, | 2445 1)); |
2453 false)); | |
2454 | 2446 |
2455 gfx::Size size(1, 1); | 2447 gfx::Size size(1, 1); |
2456 ResourceFormat format = RGBA_8888; | 2448 ResourceFormat format = RGBA_8888; |
2457 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2449 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
2458 | 2450 |
2459 for (int texture_id = 1; texture_id <= 2; ++texture_id) { | 2451 for (int texture_id = 1; texture_id <= 2; ++texture_id) { |
2460 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; | 2452 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; |
2461 // Check that the texture gets created with the right sampler settings. | 2453 // Check that the texture gets created with the right sampler settings. |
2462 ResourceProvider::ResourceId id = resource_provider->CreateGLTexture( | 2454 ResourceProvider::ResourceId id = resource_provider->CreateGLTexture( |
2463 size, | 2455 size, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2502 FakeOutputSurface::Create3d(context_owned.Pass())); | 2494 FakeOutputSurface::Create3d(context_owned.Pass())); |
2503 CHECK(output_surface->BindToClient(&output_surface_client)); | 2495 CHECK(output_surface->BindToClient(&output_surface_client)); |
2504 | 2496 |
2505 scoped_ptr<ResourceProvider> resource_provider( | 2497 scoped_ptr<ResourceProvider> resource_provider( |
2506 ResourceProvider::Create(output_surface.get(), | 2498 ResourceProvider::Create(output_surface.get(), |
2507 shared_bitmap_manager_.get(), | 2499 shared_bitmap_manager_.get(), |
2508 gpu_memory_buffer_manager_.get(), | 2500 gpu_memory_buffer_manager_.get(), |
2509 NULL, | 2501 NULL, |
2510 0, | 2502 0, |
2511 false, | 2503 false, |
2512 1, | 2504 1)); |
2513 false)); | |
2514 | 2505 |
2515 gfx::Size size(1, 1); | 2506 gfx::Size size(1, 1); |
2516 ResourceFormat format = RGBA_8888; | 2507 ResourceFormat format = RGBA_8888; |
2517 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2508 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
2518 | 2509 |
2519 const ResourceProvider::TextureHint hints[4] = { | 2510 const ResourceProvider::TextureHint hints[4] = { |
2520 ResourceProvider::TextureHintDefault, | 2511 ResourceProvider::TextureHintDefault, |
2521 ResourceProvider::TextureHintImmutable, | 2512 ResourceProvider::TextureHintImmutable, |
2522 ResourceProvider::TextureHintFramebuffer, | 2513 ResourceProvider::TextureHintFramebuffer, |
2523 ResourceProvider::TextureHintImmutableFramebuffer, | 2514 ResourceProvider::TextureHintImmutableFramebuffer, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2576 new SoftwareOutputDevice))); | 2567 new SoftwareOutputDevice))); |
2577 CHECK(output_surface->BindToClient(&output_surface_client)); | 2568 CHECK(output_surface->BindToClient(&output_surface_client)); |
2578 | 2569 |
2579 scoped_ptr<ResourceProvider> resource_provider( | 2570 scoped_ptr<ResourceProvider> resource_provider( |
2580 ResourceProvider::Create(output_surface.get(), | 2571 ResourceProvider::Create(output_surface.get(), |
2581 shared_bitmap_manager_.get(), | 2572 shared_bitmap_manager_.get(), |
2582 gpu_memory_buffer_manager_.get(), | 2573 gpu_memory_buffer_manager_.get(), |
2583 main_thread_task_runner_.get(), | 2574 main_thread_task_runner_.get(), |
2584 0, | 2575 0, |
2585 false, | 2576 false, |
2586 1, | 2577 1)); |
2587 false)); | |
2588 | 2578 |
2589 uint32 release_sync_point = 0; | 2579 uint32 release_sync_point = 0; |
2590 bool lost_resource = false; | 2580 bool lost_resource = false; |
2591 BlockingTaskRunner* main_thread_task_runner = NULL; | 2581 BlockingTaskRunner* main_thread_task_runner = NULL; |
2592 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2582 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2593 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, | 2583 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, |
2594 &release_sync_point, | 2584 &release_sync_point, |
2595 &lost_resource, | 2585 &lost_resource, |
2596 &main_thread_task_runner)); | 2586 &main_thread_task_runner)); |
2597 TextureMailbox mailbox(shared_memory.get(), size); | 2587 TextureMailbox mailbox(shared_memory.get(), size); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 FakeOutputSurface::Create3d(context_owned.Pass())); | 2619 FakeOutputSurface::Create3d(context_owned.Pass())); |
2630 CHECK(output_surface->BindToClient(&output_surface_client)); | 2620 CHECK(output_surface->BindToClient(&output_surface_client)); |
2631 | 2621 |
2632 scoped_ptr<ResourceProvider> resource_provider( | 2622 scoped_ptr<ResourceProvider> resource_provider( |
2633 ResourceProvider::Create(output_surface.get(), | 2623 ResourceProvider::Create(output_surface.get(), |
2634 shared_bitmap_manager_.get(), | 2624 shared_bitmap_manager_.get(), |
2635 gpu_memory_buffer_manager_.get(), | 2625 gpu_memory_buffer_manager_.get(), |
2636 main_thread_task_runner_.get(), | 2626 main_thread_task_runner_.get(), |
2637 0, | 2627 0, |
2638 false, | 2628 false, |
2639 1, | 2629 1)); |
2640 false)); | |
2641 | 2630 |
2642 unsigned texture_id = 1; | 2631 unsigned texture_id = 1; |
2643 uint32 sync_point = 30; | 2632 uint32 sync_point = 30; |
2644 unsigned target = GL_TEXTURE_2D; | 2633 unsigned target = GL_TEXTURE_2D; |
2645 | 2634 |
2646 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2635 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2647 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2636 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2648 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2637 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2649 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2638 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2650 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2639 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2715 FakeOutputSurface::Create3d(context_owned.Pass())); | 2704 FakeOutputSurface::Create3d(context_owned.Pass())); |
2716 CHECK(output_surface->BindToClient(&output_surface_client)); | 2705 CHECK(output_surface->BindToClient(&output_surface_client)); |
2717 | 2706 |
2718 scoped_ptr<ResourceProvider> resource_provider( | 2707 scoped_ptr<ResourceProvider> resource_provider( |
2719 ResourceProvider::Create(output_surface.get(), | 2708 ResourceProvider::Create(output_surface.get(), |
2720 shared_bitmap_manager_.get(), | 2709 shared_bitmap_manager_.get(), |
2721 gpu_memory_buffer_manager_.get(), | 2710 gpu_memory_buffer_manager_.get(), |
2722 NULL, | 2711 NULL, |
2723 0, | 2712 0, |
2724 false, | 2713 false, |
2725 1, | 2714 1)); |
2726 false)); | |
2727 | 2715 |
2728 unsigned texture_id = 1; | 2716 unsigned texture_id = 1; |
2729 uint32 sync_point = 30; | 2717 uint32 sync_point = 30; |
2730 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 2718 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
2731 | 2719 |
2732 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2720 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2733 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2721 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2734 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2722 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2735 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2723 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2736 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2724 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2791 FakeOutputSurface::Create3d(context_owned.Pass())); | 2779 FakeOutputSurface::Create3d(context_owned.Pass())); |
2792 CHECK(output_surface->BindToClient(&output_surface_client)); | 2780 CHECK(output_surface->BindToClient(&output_surface_client)); |
2793 | 2781 |
2794 scoped_ptr<ResourceProvider> resource_provider( | 2782 scoped_ptr<ResourceProvider> resource_provider( |
2795 ResourceProvider::Create(output_surface.get(), | 2783 ResourceProvider::Create(output_surface.get(), |
2796 shared_bitmap_manager_.get(), | 2784 shared_bitmap_manager_.get(), |
2797 gpu_memory_buffer_manager_.get(), | 2785 gpu_memory_buffer_manager_.get(), |
2798 NULL, | 2786 NULL, |
2799 0, | 2787 0, |
2800 false, | 2788 false, |
2801 1, | 2789 1)); |
2802 false)); | |
2803 | 2790 |
2804 uint32 sync_point = 30; | 2791 uint32 sync_point = 30; |
2805 unsigned target = GL_TEXTURE_2D; | 2792 unsigned target = GL_TEXTURE_2D; |
2806 | 2793 |
2807 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2794 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2808 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2795 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2809 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2796 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2810 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2797 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2811 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2798 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
2812 | 2799 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2851 FakeOutputSurface::Create3d(context_owned.Pass())); | 2838 FakeOutputSurface::Create3d(context_owned.Pass())); |
2852 CHECK(output_surface->BindToClient(&output_surface_client)); | 2839 CHECK(output_surface->BindToClient(&output_surface_client)); |
2853 | 2840 |
2854 scoped_ptr<ResourceProvider> resource_provider( | 2841 scoped_ptr<ResourceProvider> resource_provider( |
2855 ResourceProvider::Create(output_surface.get(), | 2842 ResourceProvider::Create(output_surface.get(), |
2856 shared_bitmap_manager_.get(), | 2843 shared_bitmap_manager_.get(), |
2857 gpu_memory_buffer_manager_.get(), | 2844 gpu_memory_buffer_manager_.get(), |
2858 NULL, | 2845 NULL, |
2859 0, | 2846 0, |
2860 false, | 2847 false, |
2861 1, | 2848 1)); |
2862 false)); | |
2863 | 2849 |
2864 uint32 sync_point = 0; | 2850 uint32 sync_point = 0; |
2865 unsigned target = GL_TEXTURE_2D; | 2851 unsigned target = GL_TEXTURE_2D; |
2866 | 2852 |
2867 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2853 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2868 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2854 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2869 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2855 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2870 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2856 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2871 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2857 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
2872 | 2858 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2978 FakeOutputSurface::Create3d(context_owned.Pass())); | 2964 FakeOutputSurface::Create3d(context_owned.Pass())); |
2979 CHECK(output_surface->BindToClient(&output_surface_client)); | 2965 CHECK(output_surface->BindToClient(&output_surface_client)); |
2980 | 2966 |
2981 scoped_ptr<ResourceProvider> resource_provider( | 2967 scoped_ptr<ResourceProvider> resource_provider( |
2982 ResourceProvider::Create(output_surface.get(), | 2968 ResourceProvider::Create(output_surface.get(), |
2983 shared_bitmap_manager_.get(), | 2969 shared_bitmap_manager_.get(), |
2984 gpu_memory_buffer_manager_.get(), | 2970 gpu_memory_buffer_manager_.get(), |
2985 NULL, | 2971 NULL, |
2986 0, | 2972 0, |
2987 false, | 2973 false, |
2988 1, | 2974 1)); |
2989 false)); | |
2990 | 2975 |
2991 gfx::Size size(2, 2); | 2976 gfx::Size size(2, 2); |
2992 gfx::Vector2d offset(0, 0); | 2977 gfx::Vector2d offset(0, 0); |
2993 gfx::Rect rect(0, 0, 2, 2); | 2978 gfx::Rect rect(0, 0, 2, 2); |
2994 ResourceFormat format = RGBA_8888; | 2979 ResourceFormat format = RGBA_8888; |
2995 ResourceProvider::ResourceId id = 0; | 2980 ResourceProvider::ResourceId id = 0; |
2996 uint8_t pixels[16] = { 0 }; | 2981 uint8_t pixels[16] = { 0 }; |
2997 int texture_id = 123; | 2982 int texture_id = 123; |
2998 | 2983 |
2999 // Lazy allocation. Don't allocate when creating the resource. | 2984 // Lazy allocation. Don't allocate when creating the resource. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3059 FakeOutputSurface::Create3d(context_owned.Pass())); | 3044 FakeOutputSurface::Create3d(context_owned.Pass())); |
3060 CHECK(output_surface->BindToClient(&output_surface_client)); | 3045 CHECK(output_surface->BindToClient(&output_surface_client)); |
3061 | 3046 |
3062 scoped_ptr<ResourceProvider> resource_provider( | 3047 scoped_ptr<ResourceProvider> resource_provider( |
3063 ResourceProvider::Create(output_surface.get(), | 3048 ResourceProvider::Create(output_surface.get(), |
3064 shared_bitmap_manager_.get(), | 3049 shared_bitmap_manager_.get(), |
3065 gpu_memory_buffer_manager_.get(), | 3050 gpu_memory_buffer_manager_.get(), |
3066 NULL, | 3051 NULL, |
3067 0, | 3052 0, |
3068 false, | 3053 false, |
3069 1, | 3054 1)); |
3070 false)); | |
3071 | 3055 |
3072 gfx::Size size(2, 2); | 3056 gfx::Size size(2, 2); |
3073 | 3057 |
3074 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3058 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
3075 const ResourceProvider::TextureHint hints[4] = { | 3059 const ResourceProvider::TextureHint hints[4] = { |
3076 ResourceProvider::TextureHintDefault, | 3060 ResourceProvider::TextureHintDefault, |
3077 ResourceProvider::TextureHintImmutable, | 3061 ResourceProvider::TextureHintImmutable, |
3078 ResourceProvider::TextureHintFramebuffer, | 3062 ResourceProvider::TextureHintFramebuffer, |
3079 ResourceProvider::TextureHintImmutableFramebuffer, | 3063 ResourceProvider::TextureHintImmutableFramebuffer, |
3080 }; | 3064 }; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3120 FakeOutputSurface::Create3d(context_owned.Pass())); | 3104 FakeOutputSurface::Create3d(context_owned.Pass())); |
3121 CHECK(output_surface->BindToClient(&output_surface_client)); | 3105 CHECK(output_surface->BindToClient(&output_surface_client)); |
3122 | 3106 |
3123 scoped_ptr<ResourceProvider> resource_provider( | 3107 scoped_ptr<ResourceProvider> resource_provider( |
3124 ResourceProvider::Create(output_surface.get(), | 3108 ResourceProvider::Create(output_surface.get(), |
3125 shared_bitmap_manager_.get(), | 3109 shared_bitmap_manager_.get(), |
3126 gpu_memory_buffer_manager_.get(), | 3110 gpu_memory_buffer_manager_.get(), |
3127 NULL, | 3111 NULL, |
3128 0, | 3112 0, |
3129 false, | 3113 false, |
3130 1, | 3114 1)); |
3131 false)); | |
3132 | 3115 |
3133 gfx::Size size(2, 2); | 3116 gfx::Size size(2, 2); |
3134 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3117 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
3135 | 3118 |
3136 const ResourceProvider::TextureHint hints[4] = { | 3119 const ResourceProvider::TextureHint hints[4] = { |
3137 ResourceProvider::TextureHintDefault, | 3120 ResourceProvider::TextureHintDefault, |
3138 ResourceProvider::TextureHintImmutable, | 3121 ResourceProvider::TextureHintImmutable, |
3139 ResourceProvider::TextureHintFramebuffer, | 3122 ResourceProvider::TextureHintFramebuffer, |
3140 ResourceProvider::TextureHintImmutableFramebuffer, | 3123 ResourceProvider::TextureHintImmutableFramebuffer, |
3141 }; | 3124 }; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3180 ResourceProvider::ResourceId id = 0; | 3163 ResourceProvider::ResourceId id = 0; |
3181 int texture_id = 123; | 3164 int texture_id = 123; |
3182 | 3165 |
3183 scoped_ptr<ResourceProvider> resource_provider( | 3166 scoped_ptr<ResourceProvider> resource_provider( |
3184 ResourceProvider::Create(output_surface.get(), | 3167 ResourceProvider::Create(output_surface.get(), |
3185 shared_bitmap_manager_.get(), | 3168 shared_bitmap_manager_.get(), |
3186 gpu_memory_buffer_manager_.get(), | 3169 gpu_memory_buffer_manager_.get(), |
3187 NULL, | 3170 NULL, |
3188 0, | 3171 0, |
3189 false, | 3172 false, |
3190 1, | 3173 1)); |
3191 false)); | |
3192 | 3174 |
3193 id = resource_provider->CreateResource( | 3175 id = resource_provider->CreateResource( |
3194 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3176 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3195 resource_provider->AcquirePixelBuffer(id); | 3177 resource_provider->AcquirePixelBuffer(id); |
3196 | 3178 |
3197 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3179 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3198 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3180 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
3199 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) | 3181 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) |
3200 .Times(1); | 3182 .Times(1); |
3201 resource_provider->BeginSetPixels(id); | 3183 resource_provider->BeginSetPixels(id); |
(...skipping 26 matching lines...) Expand all Loading... |
3228 ResourceProvider::ResourceId id = 0; | 3210 ResourceProvider::ResourceId id = 0; |
3229 int texture_id = 123; | 3211 int texture_id = 123; |
3230 | 3212 |
3231 scoped_ptr<ResourceProvider> resource_provider( | 3213 scoped_ptr<ResourceProvider> resource_provider( |
3232 ResourceProvider::Create(output_surface.get(), | 3214 ResourceProvider::Create(output_surface.get(), |
3233 shared_bitmap_manager_.get(), | 3215 shared_bitmap_manager_.get(), |
3234 gpu_memory_buffer_manager_.get(), | 3216 gpu_memory_buffer_manager_.get(), |
3235 NULL, | 3217 NULL, |
3236 0, | 3218 0, |
3237 false, | 3219 false, |
3238 1, | 3220 1)); |
3239 false)); | |
3240 | 3221 |
3241 id = resource_provider->CreateResource( | 3222 id = resource_provider->CreateResource( |
3242 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3223 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3243 resource_provider->AcquirePixelBuffer(id); | 3224 resource_provider->AcquirePixelBuffer(id); |
3244 | 3225 |
3245 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3226 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3246 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3227 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
3247 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) | 3228 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) |
3248 .Times(1); | 3229 .Times(1); |
3249 resource_provider->BeginSetPixels(id); | 3230 resource_provider->BeginSetPixels(id); |
(...skipping 26 matching lines...) Expand all Loading... |
3276 ResourceProvider::ResourceId id = 0; | 3257 ResourceProvider::ResourceId id = 0; |
3277 int texture_id = 123; | 3258 int texture_id = 123; |
3278 | 3259 |
3279 scoped_ptr<ResourceProvider> resource_provider( | 3260 scoped_ptr<ResourceProvider> resource_provider( |
3280 ResourceProvider::Create(output_surface.get(), | 3261 ResourceProvider::Create(output_surface.get(), |
3281 shared_bitmap_manager_.get(), | 3262 shared_bitmap_manager_.get(), |
3282 gpu_memory_buffer_manager_.get(), | 3263 gpu_memory_buffer_manager_.get(), |
3283 NULL, | 3264 NULL, |
3284 0, | 3265 0, |
3285 false, | 3266 false, |
3286 1, | 3267 1)); |
3287 false)); | |
3288 | 3268 |
3289 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); | 3269 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); |
3290 | 3270 |
3291 id = resource_provider->CreateResource( | 3271 id = resource_provider->CreateResource( |
3292 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3272 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3293 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 3273 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
3294 GL_INNOCENT_CONTEXT_RESET_ARB); | 3274 GL_INNOCENT_CONTEXT_RESET_ARB); |
3295 | 3275 |
3296 resource_provider->AcquirePixelBuffer(id); | 3276 resource_provider->AcquirePixelBuffer(id); |
3297 int stride; | 3277 int stride; |
(...skipping 24 matching lines...) Expand all Loading... |
3322 const unsigned kTextureId = 123u; | 3302 const unsigned kTextureId = 123u; |
3323 const unsigned kImageId = 234u; | 3303 const unsigned kImageId = 234u; |
3324 | 3304 |
3325 scoped_ptr<ResourceProvider> resource_provider( | 3305 scoped_ptr<ResourceProvider> resource_provider( |
3326 ResourceProvider::Create(output_surface.get(), | 3306 ResourceProvider::Create(output_surface.get(), |
3327 shared_bitmap_manager_.get(), | 3307 shared_bitmap_manager_.get(), |
3328 gpu_memory_buffer_manager_.get(), | 3308 gpu_memory_buffer_manager_.get(), |
3329 NULL, | 3309 NULL, |
3330 0, | 3310 0, |
3331 false, | 3311 false, |
3332 1, | 3312 1)); |
3333 false)); | |
3334 | 3313 |
3335 id = resource_provider->CreateResource( | 3314 id = resource_provider->CreateResource( |
3336 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3315 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3337 | 3316 |
3338 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) | 3317 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) |
3339 .WillOnce(Return(kImageId)) | 3318 .WillOnce(Return(kImageId)) |
3340 .RetiresOnSaturation(); | 3319 .RetiresOnSaturation(); |
3341 { | 3320 { |
3342 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( | 3321 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( |
3343 resource_provider.get(), id); | 3322 resource_provider.get(), id); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3410 const unsigned kDestTextureId = 321u; | 3389 const unsigned kDestTextureId = 321u; |
3411 const unsigned kImageId = 234u; | 3390 const unsigned kImageId = 234u; |
3412 | 3391 |
3413 scoped_ptr<ResourceProvider> resource_provider( | 3392 scoped_ptr<ResourceProvider> resource_provider( |
3414 ResourceProvider::Create(output_surface.get(), | 3393 ResourceProvider::Create(output_surface.get(), |
3415 shared_bitmap_manager_.get(), | 3394 shared_bitmap_manager_.get(), |
3416 gpu_memory_buffer_manager_.get(), | 3395 gpu_memory_buffer_manager_.get(), |
3417 NULL, | 3396 NULL, |
3418 0, | 3397 0, |
3419 false, | 3398 false, |
3420 1, | 3399 1)); |
3421 false)); | |
3422 | 3400 |
3423 source_id = resource_provider->CreateResource( | 3401 source_id = resource_provider->CreateResource( |
3424 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3402 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3425 | 3403 |
3426 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) | 3404 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) |
3427 .WillOnce(Return(kImageId)) | 3405 .WillOnce(Return(kImageId)) |
3428 .RetiresOnSaturation(); | 3406 .RetiresOnSaturation(); |
3429 { | 3407 { |
3430 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( | 3408 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( |
3431 resource_provider.get(), source_id); | 3409 resource_provider.get(), source_id); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3493 EXPECT_TRUE(output_surface->BindToClient(&client)); | 3471 EXPECT_TRUE(output_surface->BindToClient(&client)); |
3494 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 3472 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
3495 new TestSharedBitmapManager()); | 3473 new TestSharedBitmapManager()); |
3496 scoped_ptr<ResourceProvider> resource_provider( | 3474 scoped_ptr<ResourceProvider> resource_provider( |
3497 ResourceProvider::Create(output_surface.get(), | 3475 ResourceProvider::Create(output_surface.get(), |
3498 shared_bitmap_manager.get(), | 3476 shared_bitmap_manager.get(), |
3499 NULL, | 3477 NULL, |
3500 NULL, | 3478 NULL, |
3501 0, | 3479 0, |
3502 false, | 3480 false, |
3503 1, | 3481 1)); |
3504 false)); | |
3505 | 3482 |
3506 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); | 3483 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); |
3507 | 3484 |
3508 InitializeGLAndCheck(shared_data.get(), | 3485 InitializeGLAndCheck(shared_data.get(), |
3509 resource_provider.get(), | 3486 resource_provider.get(), |
3510 output_surface.get()); | 3487 output_surface.get()); |
3511 | 3488 |
3512 resource_provider->InitializeSoftware(); | 3489 resource_provider->InitializeSoftware(); |
3513 output_surface->ReleaseGL(); | 3490 output_surface->ReleaseGL(); |
3514 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); | 3491 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); |
(...skipping 18 matching lines...) Expand all Loading... |
3533 CHECK(output_surface->BindToClient(&output_surface_client)); | 3510 CHECK(output_surface->BindToClient(&output_surface_client)); |
3534 | 3511 |
3535 gfx::Size size(4, 4); | 3512 gfx::Size size(4, 4); |
3536 scoped_ptr<ResourceProvider> resource_provider( | 3513 scoped_ptr<ResourceProvider> resource_provider( |
3537 ResourceProvider::Create(output_surface.get(), | 3514 ResourceProvider::Create(output_surface.get(), |
3538 shared_bitmap_manager_.get(), | 3515 shared_bitmap_manager_.get(), |
3539 gpu_memory_buffer_manager_.get(), | 3516 gpu_memory_buffer_manager_.get(), |
3540 NULL, | 3517 NULL, |
3541 0, | 3518 0, |
3542 false, | 3519 false, |
3543 1, | 3520 1)); |
3544 false)); | |
3545 int texture_id = 123; | 3521 int texture_id = 123; |
3546 | 3522 |
3547 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3523 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
3548 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); | 3524 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); |
3549 EXPECT_NE(0u, id); | 3525 EXPECT_NE(0u, id); |
3550 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3526 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3551 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3527 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
3552 resource_provider->AllocateForTesting(id); | 3528 resource_provider->AllocateForTesting(id); |
3553 | 3529 |
3554 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3530 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
(...skipping 15 matching lines...) Expand all Loading... |
3570 CHECK(output_surface->BindToClient(&output_surface_client)); | 3546 CHECK(output_surface->BindToClient(&output_surface_client)); |
3571 | 3547 |
3572 gfx::Size size(4, 4); | 3548 gfx::Size size(4, 4); |
3573 scoped_ptr<ResourceProvider> resource_provider( | 3549 scoped_ptr<ResourceProvider> resource_provider( |
3574 ResourceProvider::Create(output_surface.get(), | 3550 ResourceProvider::Create(output_surface.get(), |
3575 shared_bitmap_manager_.get(), | 3551 shared_bitmap_manager_.get(), |
3576 gpu_memory_buffer_manager_.get(), | 3552 gpu_memory_buffer_manager_.get(), |
3577 NULL, | 3553 NULL, |
3578 0, | 3554 0, |
3579 false, | 3555 false, |
3580 1, | 3556 1)); |
3581 false)); | |
3582 int texture_id = 123; | 3557 int texture_id = 123; |
3583 uint8_t pixels[8]; | 3558 uint8_t pixels[8]; |
3584 | 3559 |
3585 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3560 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
3586 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); | 3561 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); |
3587 EXPECT_NE(0u, id); | 3562 EXPECT_NE(0u, id); |
3588 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3563 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3589 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); | 3564 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); |
3590 EXPECT_CALL(*context, | 3565 EXPECT_CALL(*context, |
3591 compressedTexImage2D( | 3566 compressedTexImage2D( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3632 | 3607 |
3633 { | 3608 { |
3634 size_t kTextureAllocationChunkSize = 1; | 3609 size_t kTextureAllocationChunkSize = 1; |
3635 scoped_ptr<ResourceProvider> resource_provider( | 3610 scoped_ptr<ResourceProvider> resource_provider( |
3636 ResourceProvider::Create(output_surface.get(), | 3611 ResourceProvider::Create(output_surface.get(), |
3637 shared_bitmap_manager.get(), | 3612 shared_bitmap_manager.get(), |
3638 NULL, | 3613 NULL, |
3639 NULL, | 3614 NULL, |
3640 0, | 3615 0, |
3641 false, | 3616 false, |
3642 kTextureAllocationChunkSize, | 3617 kTextureAllocationChunkSize)); |
3643 false)); | |
3644 | 3618 |
3645 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3619 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
3646 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3620 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3647 resource_provider->AllocateForTesting(id); | 3621 resource_provider->AllocateForTesting(id); |
3648 Mock::VerifyAndClearExpectations(context); | 3622 Mock::VerifyAndClearExpectations(context); |
3649 | 3623 |
3650 DCHECK_EQ(2u, context->PeekTextureId()); | 3624 DCHECK_EQ(2u, context->PeekTextureId()); |
3651 resource_provider->DeleteResource(id); | 3625 resource_provider->DeleteResource(id); |
3652 } | 3626 } |
3653 | 3627 |
3654 { | 3628 { |
3655 size_t kTextureAllocationChunkSize = 8; | 3629 size_t kTextureAllocationChunkSize = 8; |
3656 scoped_ptr<ResourceProvider> resource_provider( | 3630 scoped_ptr<ResourceProvider> resource_provider( |
3657 ResourceProvider::Create(output_surface.get(), | 3631 ResourceProvider::Create(output_surface.get(), |
3658 shared_bitmap_manager.get(), | 3632 shared_bitmap_manager.get(), |
3659 NULL, | 3633 NULL, |
3660 NULL, | 3634 NULL, |
3661 0, | 3635 0, |
3662 false, | 3636 false, |
3663 kTextureAllocationChunkSize, | 3637 kTextureAllocationChunkSize)); |
3664 false)); | |
3665 | 3638 |
3666 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3639 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
3667 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3640 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3668 resource_provider->AllocateForTesting(id); | 3641 resource_provider->AllocateForTesting(id); |
3669 Mock::VerifyAndClearExpectations(context); | 3642 Mock::VerifyAndClearExpectations(context); |
3670 | 3643 |
3671 DCHECK_EQ(10u, context->PeekTextureId()); | 3644 DCHECK_EQ(10u, context->PeekTextureId()); |
3672 resource_provider->DeleteResource(id); | 3645 resource_provider->DeleteResource(id); |
3673 } | 3646 } |
3674 } | 3647 } |
3675 | 3648 |
3676 } // namespace | 3649 } // namespace |
3677 } // namespace cc | 3650 } // namespace cc |
OLD | NEW |