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