| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 NOTREACHED(); | 372 NOTREACHED(); |
| 373 break; | 373 break; |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 | 376 |
| 377 class ResourceProviderTest | 377 class ResourceProviderTest |
| 378 : public testing::TestWithParam<ResourceProvider::ResourceType> { | 378 : public testing::TestWithParam<ResourceProvider::ResourceType> { |
| 379 public: | 379 public: |
| 380 ResourceProviderTest() | 380 ResourceProviderTest() |
| 381 : shared_data_(ContextSharedData::Create()), | 381 : shared_data_(ContextSharedData::Create()), |
| 382 context3d_(NULL), | 382 context3d_(nullptr), |
| 383 child_context_(NULL), | 383 child_context_(nullptr), |
| 384 main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) { | 384 main_thread_task_runner_(BlockingTaskRunner::Create(nullptr)) { |
| 385 switch (GetParam()) { | 385 switch (GetParam()) { |
| 386 case ResourceProvider::GLTexture: { | 386 case ResourceProvider::GLTexture: { |
| 387 scoped_ptr<ResourceProviderContext> context3d( | 387 scoped_ptr<ResourceProviderContext> context3d( |
| 388 ResourceProviderContext::Create(shared_data_.get())); | 388 ResourceProviderContext::Create(shared_data_.get())); |
| 389 context3d_ = context3d.get(); | 389 context3d_ = context3d.get(); |
| 390 | 390 |
| 391 scoped_refptr<TestContextProvider> context_provider = | 391 scoped_refptr<TestContextProvider> context_provider = |
| 392 TestContextProvider::Create(context3d.Pass()); | 392 TestContextProvider::Create(context3d.Pass()); |
| 393 | 393 |
| 394 output_surface_ = FakeOutputSurface::Create3d(context_provider); | 394 output_surface_ = FakeOutputSurface::Create3d(context_provider); |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 ResourceProviderContext::Create(shared_data_.get())); | 1153 ResourceProviderContext::Create(shared_data_.get())); |
| 1154 | 1154 |
| 1155 FakeOutputSurfaceClient child_output_surface_client; | 1155 FakeOutputSurfaceClient child_output_surface_client; |
| 1156 scoped_ptr<OutputSurface> child_output_surface( | 1156 scoped_ptr<OutputSurface> child_output_surface( |
| 1157 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1157 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
| 1158 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1158 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
| 1159 | 1159 |
| 1160 scoped_ptr<ResourceProvider> child_resource_provider( | 1160 scoped_ptr<ResourceProvider> child_resource_provider( |
| 1161 ResourceProvider::Create(child_output_surface.get(), | 1161 ResourceProvider::Create(child_output_surface.get(), |
| 1162 shared_bitmap_manager_.get(), | 1162 shared_bitmap_manager_.get(), |
| 1163 NULL, | 1163 nullptr, |
| 1164 0, | 1164 0, |
| 1165 false, | 1165 false, |
| 1166 1, | 1166 1, |
| 1167 false)); | 1167 false)); |
| 1168 | 1168 |
| 1169 gfx::Size size(1, 1); | 1169 gfx::Size size(1, 1); |
| 1170 ResourceFormat format = RGBA_8888; | 1170 ResourceFormat format = RGBA_8888; |
| 1171 size_t pixel_size = TextureSizeBytes(size, format); | 1171 size_t pixel_size = TextureSizeBytes(size, format); |
| 1172 ASSERT_EQ(4U, pixel_size); | 1172 ASSERT_EQ(4U, pixel_size); |
| 1173 | 1173 |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 FakeOutputSurfaceClient child_output_surface_client; | 1635 FakeOutputSurfaceClient child_output_surface_client; |
| 1636 scoped_ptr<OutputSurface> child_output_surface( | 1636 scoped_ptr<OutputSurface> child_output_surface( |
| 1637 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1637 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
| 1638 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1638 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
| 1639 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1639 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 1640 new TestSharedBitmapManager()); | 1640 new TestSharedBitmapManager()); |
| 1641 | 1641 |
| 1642 scoped_ptr<ResourceProvider> child_resource_provider( | 1642 scoped_ptr<ResourceProvider> child_resource_provider( |
| 1643 ResourceProvider::Create(child_output_surface.get(), | 1643 ResourceProvider::Create(child_output_surface.get(), |
| 1644 shared_bitmap_manager.get(), | 1644 shared_bitmap_manager.get(), |
| 1645 NULL, | 1645 nullptr, |
| 1646 0, | 1646 0, |
| 1647 false, | 1647 false, |
| 1648 1, | 1648 1, |
| 1649 false)); | 1649 false)); |
| 1650 | 1650 |
| 1651 scoped_ptr<TextureStateTrackingContext> parent_context_owned( | 1651 scoped_ptr<TextureStateTrackingContext> parent_context_owned( |
| 1652 new TextureStateTrackingContext); | 1652 new TextureStateTrackingContext); |
| 1653 TextureStateTrackingContext* parent_context = parent_context_owned.get(); | 1653 TextureStateTrackingContext* parent_context = parent_context_owned.get(); |
| 1654 | 1654 |
| 1655 FakeOutputSurfaceClient parent_output_surface_client; | 1655 FakeOutputSurfaceClient parent_output_surface_client; |
| 1656 scoped_ptr<OutputSurface> parent_output_surface( | 1656 scoped_ptr<OutputSurface> parent_output_surface( |
| 1657 FakeOutputSurface::Create3d(parent_context_owned.Pass())); | 1657 FakeOutputSurface::Create3d(parent_context_owned.Pass())); |
| 1658 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); | 1658 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); |
| 1659 | 1659 |
| 1660 scoped_ptr<ResourceProvider> parent_resource_provider( | 1660 scoped_ptr<ResourceProvider> parent_resource_provider( |
| 1661 ResourceProvider::Create(parent_output_surface.get(), | 1661 ResourceProvider::Create(parent_output_surface.get(), |
| 1662 shared_bitmap_manager.get(), | 1662 shared_bitmap_manager.get(), |
| 1663 NULL, | 1663 nullptr, |
| 1664 0, | 1664 0, |
| 1665 false, | 1665 false, |
| 1666 1, | 1666 1, |
| 1667 false)); | 1667 false)); |
| 1668 | 1668 |
| 1669 gfx::Size size(1, 1); | 1669 gfx::Size size(1, 1); |
| 1670 ResourceFormat format = RGBA_8888; | 1670 ResourceFormat format = RGBA_8888; |
| 1671 int child_texture_id = 1; | 1671 int child_texture_id = 1; |
| 1672 int parent_texture_id = 2; | 1672 int parent_texture_id = 2; |
| 1673 | 1673 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 gpu::Mailbox mailbox; | 1824 gpu::Mailbox mailbox; |
| 1825 context()->genMailboxCHROMIUM(mailbox.name); | 1825 context()->genMailboxCHROMIUM(mailbox.name); |
| 1826 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 1826 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 1827 uint32 sync_point = context()->insertSyncPoint(); | 1827 uint32 sync_point = context()->insertSyncPoint(); |
| 1828 | 1828 |
| 1829 // All the logic below assumes that the sync points are all positive. | 1829 // All the logic below assumes that the sync points are all positive. |
| 1830 EXPECT_LT(0u, sync_point); | 1830 EXPECT_LT(0u, sync_point); |
| 1831 | 1831 |
| 1832 uint32 release_sync_point = 0; | 1832 uint32 release_sync_point = 0; |
| 1833 bool lost_resource = false; | 1833 bool lost_resource = false; |
| 1834 BlockingTaskRunner* main_thread_task_runner = NULL; | 1834 BlockingTaskRunner* main_thread_task_runner = nullptr; |
| 1835 ReleaseCallbackImpl callback = base::Bind(ReleaseCallback, | 1835 ReleaseCallbackImpl callback = base::Bind(ReleaseCallback, |
| 1836 &release_sync_point, | 1836 &release_sync_point, |
| 1837 &lost_resource, | 1837 &lost_resource, |
| 1838 &main_thread_task_runner); | 1838 &main_thread_task_runner); |
| 1839 ResourceProvider::ResourceId resource = | 1839 ResourceProvider::ResourceId resource = |
| 1840 resource_provider_->CreateResourceFromTextureMailbox( | 1840 resource_provider_->CreateResourceFromTextureMailbox( |
| 1841 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), | 1841 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), |
| 1842 SingleReleaseCallbackImpl::Create(callback)); | 1842 SingleReleaseCallbackImpl::Create(callback)); |
| 1843 EXPECT_EQ(1u, context()->NumTextures()); | 1843 EXPECT_EQ(1u, context()->NumTextures()); |
| 1844 EXPECT_EQ(0u, release_sync_point); | 1844 EXPECT_EQ(0u, release_sync_point); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2247 context()->bindTexture(GL_TEXTURE_2D, texture); | 2247 context()->bindTexture(GL_TEXTURE_2D, texture); |
| 2248 gpu::Mailbox mailbox; | 2248 gpu::Mailbox mailbox; |
| 2249 context()->genMailboxCHROMIUM(mailbox.name); | 2249 context()->genMailboxCHROMIUM(mailbox.name); |
| 2250 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 2250 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 2251 uint32 sync_point = context()->insertSyncPoint(); | 2251 uint32 sync_point = context()->insertSyncPoint(); |
| 2252 | 2252 |
| 2253 EXPECT_LT(0u, sync_point); | 2253 EXPECT_LT(0u, sync_point); |
| 2254 | 2254 |
| 2255 uint32 release_sync_point = 0; | 2255 uint32 release_sync_point = 0; |
| 2256 bool lost_resource = false; | 2256 bool lost_resource = false; |
| 2257 BlockingTaskRunner* main_thread_task_runner = NULL; | 2257 BlockingTaskRunner* main_thread_task_runner = nullptr; |
| 2258 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2258 scoped_ptr<SingleReleaseCallbackImpl> callback = |
| 2259 SingleReleaseCallbackImpl::Create(base::Bind(ReleaseCallback, | 2259 SingleReleaseCallbackImpl::Create(base::Bind(ReleaseCallback, |
| 2260 &release_sync_point, | 2260 &release_sync_point, |
| 2261 &lost_resource, | 2261 &lost_resource, |
| 2262 &main_thread_task_runner)); | 2262 &main_thread_task_runner)); |
| 2263 resource_provider_->CreateResourceFromTextureMailbox( | 2263 resource_provider_->CreateResourceFromTextureMailbox( |
| 2264 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), callback.Pass()); | 2264 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), callback.Pass()); |
| 2265 | 2265 |
| 2266 EXPECT_EQ(0u, release_sync_point); | 2266 EXPECT_EQ(0u, release_sync_point); |
| 2267 EXPECT_FALSE(lost_resource); | 2267 EXPECT_FALSE(lost_resource); |
| 2268 EXPECT_EQ(NULL, main_thread_task_runner); | 2268 EXPECT_EQ(nullptr, main_thread_task_runner); |
| 2269 | 2269 |
| 2270 resource_provider_->DidLoseOutputSurface(); | 2270 resource_provider_->DidLoseOutputSurface(); |
| 2271 resource_provider_ = nullptr; | 2271 resource_provider_ = nullptr; |
| 2272 | 2272 |
| 2273 EXPECT_LE(sync_point, release_sync_point); | 2273 EXPECT_LE(sync_point, release_sync_point); |
| 2274 EXPECT_TRUE(lost_resource); | 2274 EXPECT_TRUE(lost_resource); |
| 2275 EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner); | 2275 EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner); |
| 2276 } | 2276 } |
| 2277 | 2277 |
| 2278 TEST_P(ResourceProviderTest, ScopedSampler) { | 2278 TEST_P(ResourceProviderTest, ScopedSampler) { |
| 2279 // Sampling is only supported for GL textures. | 2279 // Sampling is only supported for GL textures. |
| 2280 if (GetParam() != ResourceProvider::GLTexture) | 2280 if (GetParam() != ResourceProvider::GLTexture) |
| 2281 return; | 2281 return; |
| 2282 | 2282 |
| 2283 scoped_ptr<TextureStateTrackingContext> context_owned( | 2283 scoped_ptr<TextureStateTrackingContext> context_owned( |
| 2284 new TextureStateTrackingContext); | 2284 new TextureStateTrackingContext); |
| 2285 TextureStateTrackingContext* context = context_owned.get(); | 2285 TextureStateTrackingContext* context = context_owned.get(); |
| 2286 | 2286 |
| 2287 FakeOutputSurfaceClient output_surface_client; | 2287 FakeOutputSurfaceClient output_surface_client; |
| 2288 scoped_ptr<OutputSurface> output_surface( | 2288 scoped_ptr<OutputSurface> output_surface( |
| 2289 FakeOutputSurface::Create3d(context_owned.Pass())); | 2289 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2290 CHECK(output_surface->BindToClient(&output_surface_client)); | 2290 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2291 | 2291 |
| 2292 scoped_ptr<ResourceProvider> resource_provider( | 2292 scoped_ptr<ResourceProvider> resource_provider( |
| 2293 ResourceProvider::Create(output_surface.get(), | 2293 ResourceProvider::Create(output_surface.get(), |
| 2294 shared_bitmap_manager_.get(), | 2294 shared_bitmap_manager_.get(), |
| 2295 NULL, | 2295 nullptr, |
| 2296 0, | 2296 0, |
| 2297 false, | 2297 false, |
| 2298 1, | 2298 1, |
| 2299 false)); | 2299 false)); |
| 2300 | 2300 |
| 2301 gfx::Size size(1, 1); | 2301 gfx::Size size(1, 1); |
| 2302 ResourceFormat format = RGBA_8888; | 2302 ResourceFormat format = RGBA_8888; |
| 2303 int texture_id = 1; | 2303 int texture_id = 1; |
| 2304 | 2304 |
| 2305 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 2305 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 TextureStateTrackingContext* context = context_owned.get(); | 2372 TextureStateTrackingContext* context = context_owned.get(); |
| 2373 | 2373 |
| 2374 FakeOutputSurfaceClient output_surface_client; | 2374 FakeOutputSurfaceClient output_surface_client; |
| 2375 scoped_ptr<OutputSurface> output_surface( | 2375 scoped_ptr<OutputSurface> output_surface( |
| 2376 FakeOutputSurface::Create3d(context_owned.Pass())); | 2376 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2377 CHECK(output_surface->BindToClient(&output_surface_client)); | 2377 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2378 | 2378 |
| 2379 scoped_ptr<ResourceProvider> resource_provider( | 2379 scoped_ptr<ResourceProvider> resource_provider( |
| 2380 ResourceProvider::Create(output_surface.get(), | 2380 ResourceProvider::Create(output_surface.get(), |
| 2381 shared_bitmap_manager_.get(), | 2381 shared_bitmap_manager_.get(), |
| 2382 NULL, | 2382 nullptr, |
| 2383 0, | 2383 0, |
| 2384 false, | 2384 false, |
| 2385 1, | 2385 1, |
| 2386 false)); | 2386 false)); |
| 2387 | 2387 |
| 2388 gfx::Size size(1, 1); | 2388 gfx::Size size(1, 1); |
| 2389 ResourceFormat format = RGBA_8888; | 2389 ResourceFormat format = RGBA_8888; |
| 2390 int texture_id = 1; | 2390 int texture_id = 1; |
| 2391 | 2391 |
| 2392 // Check that the texture gets created with the right sampler settings. | 2392 // Check that the texture gets created with the right sampler settings. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2427 TextureStateTrackingContext* context = context_owned.get(); | 2427 TextureStateTrackingContext* context = context_owned.get(); |
| 2428 | 2428 |
| 2429 FakeOutputSurfaceClient output_surface_client; | 2429 FakeOutputSurfaceClient output_surface_client; |
| 2430 scoped_ptr<OutputSurface> output_surface( | 2430 scoped_ptr<OutputSurface> output_surface( |
| 2431 FakeOutputSurface::Create3d(context_owned.Pass())); | 2431 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2432 CHECK(output_surface->BindToClient(&output_surface_client)); | 2432 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2433 | 2433 |
| 2434 scoped_ptr<ResourceProvider> resource_provider( | 2434 scoped_ptr<ResourceProvider> resource_provider( |
| 2435 ResourceProvider::Create(output_surface.get(), | 2435 ResourceProvider::Create(output_surface.get(), |
| 2436 shared_bitmap_manager_.get(), | 2436 shared_bitmap_manager_.get(), |
| 2437 NULL, | 2437 nullptr, |
| 2438 0, | 2438 0, |
| 2439 false, | 2439 false, |
| 2440 1, | 2440 1, |
| 2441 false)); | 2441 false)); |
| 2442 | 2442 |
| 2443 gfx::Size size(1, 1); | 2443 gfx::Size size(1, 1); |
| 2444 ResourceFormat format = RGBA_8888; | 2444 ResourceFormat format = RGBA_8888; |
| 2445 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2445 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
| 2446 | 2446 |
| 2447 for (int texture_id = 1; texture_id <= 2; ++texture_id) { | 2447 for (int texture_id = 1; texture_id <= 2; ++texture_id) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2486 context->set_support_texture_usage(true); | 2486 context->set_support_texture_usage(true); |
| 2487 | 2487 |
| 2488 FakeOutputSurfaceClient output_surface_client; | 2488 FakeOutputSurfaceClient output_surface_client; |
| 2489 scoped_ptr<OutputSurface> output_surface( | 2489 scoped_ptr<OutputSurface> output_surface( |
| 2490 FakeOutputSurface::Create3d(context_owned.Pass())); | 2490 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2491 CHECK(output_surface->BindToClient(&output_surface_client)); | 2491 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2492 | 2492 |
| 2493 scoped_ptr<ResourceProvider> resource_provider( | 2493 scoped_ptr<ResourceProvider> resource_provider( |
| 2494 ResourceProvider::Create(output_surface.get(), | 2494 ResourceProvider::Create(output_surface.get(), |
| 2495 shared_bitmap_manager_.get(), | 2495 shared_bitmap_manager_.get(), |
| 2496 NULL, | 2496 nullptr, |
| 2497 0, | 2497 0, |
| 2498 false, | 2498 false, |
| 2499 1, | 2499 1, |
| 2500 false)); | 2500 false)); |
| 2501 | 2501 |
| 2502 gfx::Size size(1, 1); | 2502 gfx::Size size(1, 1); |
| 2503 ResourceFormat format = RGBA_8888; | 2503 ResourceFormat format = RGBA_8888; |
| 2504 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2504 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
| 2505 | 2505 |
| 2506 const ResourceProvider::TextureHint hints[4] = { | 2506 const ResourceProvider::TextureHint hints[4] = { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2567 ResourceProvider::Create(output_surface.get(), | 2567 ResourceProvider::Create(output_surface.get(), |
| 2568 shared_bitmap_manager_.get(), | 2568 shared_bitmap_manager_.get(), |
| 2569 main_thread_task_runner_.get(), | 2569 main_thread_task_runner_.get(), |
| 2570 0, | 2570 0, |
| 2571 false, | 2571 false, |
| 2572 1, | 2572 1, |
| 2573 false)); | 2573 false)); |
| 2574 | 2574 |
| 2575 uint32 release_sync_point = 0; | 2575 uint32 release_sync_point = 0; |
| 2576 bool lost_resource = false; | 2576 bool lost_resource = false; |
| 2577 BlockingTaskRunner* main_thread_task_runner = NULL; | 2577 BlockingTaskRunner* main_thread_task_runner = nullptr; |
| 2578 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2578 scoped_ptr<SingleReleaseCallbackImpl> callback = |
| 2579 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, | 2579 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, |
| 2580 &release_sync_point, | 2580 &release_sync_point, |
| 2581 &lost_resource, | 2581 &lost_resource, |
| 2582 &main_thread_task_runner)); | 2582 &main_thread_task_runner)); |
| 2583 TextureMailbox mailbox(shared_memory.get(), size); | 2583 TextureMailbox mailbox(shared_memory.get(), size); |
| 2584 | 2584 |
| 2585 ResourceProvider::ResourceId id = | 2585 ResourceProvider::ResourceId id = |
| 2586 resource_provider->CreateResourceFromTextureMailbox( | 2586 resource_provider->CreateResourceFromTextureMailbox( |
| 2587 mailbox, callback.Pass()); | 2587 mailbox, callback.Pass()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2631 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2631 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2632 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2632 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| 2633 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2633 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| 2634 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2634 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
| 2635 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2635 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
| 2636 | 2636 |
| 2637 gpu::Mailbox gpu_mailbox; | 2637 gpu::Mailbox gpu_mailbox; |
| 2638 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2638 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
| 2639 uint32 release_sync_point = 0; | 2639 uint32 release_sync_point = 0; |
| 2640 bool lost_resource = false; | 2640 bool lost_resource = false; |
| 2641 BlockingTaskRunner* main_thread_task_runner = NULL; | 2641 BlockingTaskRunner* main_thread_task_runner = nullptr; |
| 2642 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2642 scoped_ptr<SingleReleaseCallbackImpl> callback = |
| 2643 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, | 2643 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, |
| 2644 &release_sync_point, | 2644 &release_sync_point, |
| 2645 &lost_resource, | 2645 &lost_resource, |
| 2646 &main_thread_task_runner)); | 2646 &main_thread_task_runner)); |
| 2647 | 2647 |
| 2648 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2648 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
| 2649 | 2649 |
| 2650 ResourceProvider::ResourceId id = | 2650 ResourceProvider::ResourceId id = |
| 2651 resource_provider->CreateResourceFromTextureMailbox( | 2651 resource_provider->CreateResourceFromTextureMailbox( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2696 TextureStateTrackingContext* context = context_owned.get(); | 2696 TextureStateTrackingContext* context = context_owned.get(); |
| 2697 | 2697 |
| 2698 FakeOutputSurfaceClient output_surface_client; | 2698 FakeOutputSurfaceClient output_surface_client; |
| 2699 scoped_ptr<OutputSurface> output_surface( | 2699 scoped_ptr<OutputSurface> output_surface( |
| 2700 FakeOutputSurface::Create3d(context_owned.Pass())); | 2700 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2701 CHECK(output_surface->BindToClient(&output_surface_client)); | 2701 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2702 | 2702 |
| 2703 scoped_ptr<ResourceProvider> resource_provider( | 2703 scoped_ptr<ResourceProvider> resource_provider( |
| 2704 ResourceProvider::Create(output_surface.get(), | 2704 ResourceProvider::Create(output_surface.get(), |
| 2705 shared_bitmap_manager_.get(), | 2705 shared_bitmap_manager_.get(), |
| 2706 NULL, | 2706 nullptr, |
| 2707 0, | 2707 0, |
| 2708 false, | 2708 false, |
| 2709 1, | 2709 1, |
| 2710 false)); | 2710 false)); |
| 2711 | 2711 |
| 2712 unsigned texture_id = 1; | 2712 unsigned texture_id = 1; |
| 2713 uint32 sync_point = 30; | 2713 uint32 sync_point = 30; |
| 2714 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 2714 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
| 2715 | 2715 |
| 2716 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2716 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2771 TextureStateTrackingContext* context = context_owned.get(); | 2771 TextureStateTrackingContext* context = context_owned.get(); |
| 2772 | 2772 |
| 2773 FakeOutputSurfaceClient output_surface_client; | 2773 FakeOutputSurfaceClient output_surface_client; |
| 2774 scoped_ptr<OutputSurface> output_surface( | 2774 scoped_ptr<OutputSurface> output_surface( |
| 2775 FakeOutputSurface::Create3d(context_owned.Pass())); | 2775 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2776 CHECK(output_surface->BindToClient(&output_surface_client)); | 2776 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2777 | 2777 |
| 2778 scoped_ptr<ResourceProvider> resource_provider( | 2778 scoped_ptr<ResourceProvider> resource_provider( |
| 2779 ResourceProvider::Create(output_surface.get(), | 2779 ResourceProvider::Create(output_surface.get(), |
| 2780 shared_bitmap_manager_.get(), | 2780 shared_bitmap_manager_.get(), |
| 2781 NULL, | 2781 nullptr, |
| 2782 0, | 2782 0, |
| 2783 false, | 2783 false, |
| 2784 1, | 2784 1, |
| 2785 false)); | 2785 false)); |
| 2786 | 2786 |
| 2787 uint32 sync_point = 30; | 2787 uint32 sync_point = 30; |
| 2788 unsigned target = GL_TEXTURE_2D; | 2788 unsigned target = GL_TEXTURE_2D; |
| 2789 | 2789 |
| 2790 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2790 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2791 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2791 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2830 TextureStateTrackingContext* context = context_owned.get(); | 2830 TextureStateTrackingContext* context = context_owned.get(); |
| 2831 | 2831 |
| 2832 FakeOutputSurfaceClient output_surface_client; | 2832 FakeOutputSurfaceClient output_surface_client; |
| 2833 scoped_ptr<OutputSurface> output_surface( | 2833 scoped_ptr<OutputSurface> output_surface( |
| 2834 FakeOutputSurface::Create3d(context_owned.Pass())); | 2834 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2835 CHECK(output_surface->BindToClient(&output_surface_client)); | 2835 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2836 | 2836 |
| 2837 scoped_ptr<ResourceProvider> resource_provider( | 2837 scoped_ptr<ResourceProvider> resource_provider( |
| 2838 ResourceProvider::Create(output_surface.get(), | 2838 ResourceProvider::Create(output_surface.get(), |
| 2839 shared_bitmap_manager_.get(), | 2839 shared_bitmap_manager_.get(), |
| 2840 NULL, | 2840 nullptr, |
| 2841 0, | 2841 0, |
| 2842 false, | 2842 false, |
| 2843 1, | 2843 1, |
| 2844 false)); | 2844 false)); |
| 2845 | 2845 |
| 2846 uint32 sync_point = 0; | 2846 uint32 sync_point = 0; |
| 2847 unsigned target = GL_TEXTURE_2D; | 2847 unsigned target = GL_TEXTURE_2D; |
| 2848 | 2848 |
| 2849 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2849 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2850 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2850 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2958 AllocationTrackingContext3D* context = context_owned.get(); | 2958 AllocationTrackingContext3D* context = context_owned.get(); |
| 2959 | 2959 |
| 2960 FakeOutputSurfaceClient output_surface_client; | 2960 FakeOutputSurfaceClient output_surface_client; |
| 2961 scoped_ptr<OutputSurface> output_surface( | 2961 scoped_ptr<OutputSurface> output_surface( |
| 2962 FakeOutputSurface::Create3d(context_owned.Pass())); | 2962 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2963 CHECK(output_surface->BindToClient(&output_surface_client)); | 2963 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2964 | 2964 |
| 2965 scoped_ptr<ResourceProvider> resource_provider( | 2965 scoped_ptr<ResourceProvider> resource_provider( |
| 2966 ResourceProvider::Create(output_surface.get(), | 2966 ResourceProvider::Create(output_surface.get(), |
| 2967 shared_bitmap_manager_.get(), | 2967 shared_bitmap_manager_.get(), |
| 2968 NULL, | 2968 nullptr, |
| 2969 0, | 2969 0, |
| 2970 false, | 2970 false, |
| 2971 1, | 2971 1, |
| 2972 false)); | 2972 false)); |
| 2973 | 2973 |
| 2974 gfx::Size size(2, 2); | 2974 gfx::Size size(2, 2); |
| 2975 gfx::Vector2d offset(0, 0); | 2975 gfx::Vector2d offset(0, 0); |
| 2976 gfx::Rect rect(0, 0, 2, 2); | 2976 gfx::Rect rect(0, 0, 2, 2); |
| 2977 ResourceFormat format = RGBA_8888; | 2977 ResourceFormat format = RGBA_8888; |
| 2978 ResourceProvider::ResourceId id = 0; | 2978 ResourceProvider::ResourceId id = 0; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3038 context->set_support_texture_usage(true); | 3038 context->set_support_texture_usage(true); |
| 3039 | 3039 |
| 3040 FakeOutputSurfaceClient output_surface_client; | 3040 FakeOutputSurfaceClient output_surface_client; |
| 3041 scoped_ptr<OutputSurface> output_surface( | 3041 scoped_ptr<OutputSurface> output_surface( |
| 3042 FakeOutputSurface::Create3d(context_owned.Pass())); | 3042 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3043 CHECK(output_surface->BindToClient(&output_surface_client)); | 3043 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3044 | 3044 |
| 3045 scoped_ptr<ResourceProvider> resource_provider( | 3045 scoped_ptr<ResourceProvider> resource_provider( |
| 3046 ResourceProvider::Create(output_surface.get(), | 3046 ResourceProvider::Create(output_surface.get(), |
| 3047 shared_bitmap_manager_.get(), | 3047 shared_bitmap_manager_.get(), |
| 3048 NULL, | 3048 nullptr, |
| 3049 0, | 3049 0, |
| 3050 false, | 3050 false, |
| 3051 1, | 3051 1, |
| 3052 false)); | 3052 false)); |
| 3053 | 3053 |
| 3054 gfx::Size size(2, 2); | 3054 gfx::Size size(2, 2); |
| 3055 | 3055 |
| 3056 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3056 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
| 3057 const ResourceProvider::TextureHint hints[4] = { | 3057 const ResourceProvider::TextureHint hints[4] = { |
| 3058 ResourceProvider::TextureHintDefault, | 3058 ResourceProvider::TextureHintDefault, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3098 context->set_support_texture_usage(true); | 3098 context->set_support_texture_usage(true); |
| 3099 | 3099 |
| 3100 FakeOutputSurfaceClient output_surface_client; | 3100 FakeOutputSurfaceClient output_surface_client; |
| 3101 scoped_ptr<OutputSurface> output_surface( | 3101 scoped_ptr<OutputSurface> output_surface( |
| 3102 FakeOutputSurface::Create3d(context_owned.Pass())); | 3102 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3103 CHECK(output_surface->BindToClient(&output_surface_client)); | 3103 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3104 | 3104 |
| 3105 scoped_ptr<ResourceProvider> resource_provider( | 3105 scoped_ptr<ResourceProvider> resource_provider( |
| 3106 ResourceProvider::Create(output_surface.get(), | 3106 ResourceProvider::Create(output_surface.get(), |
| 3107 shared_bitmap_manager_.get(), | 3107 shared_bitmap_manager_.get(), |
| 3108 NULL, | 3108 nullptr, |
| 3109 0, | 3109 0, |
| 3110 false, | 3110 false, |
| 3111 1, | 3111 1, |
| 3112 false)); | 3112 false)); |
| 3113 | 3113 |
| 3114 gfx::Size size(2, 2); | 3114 gfx::Size size(2, 2); |
| 3115 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3115 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
| 3116 | 3116 |
| 3117 const ResourceProvider::TextureHint hints[4] = { | 3117 const ResourceProvider::TextureHint hints[4] = { |
| 3118 ResourceProvider::TextureHintDefault, | 3118 ResourceProvider::TextureHintDefault, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3157 CHECK(output_surface->BindToClient(&output_surface_client)); | 3157 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3158 | 3158 |
| 3159 gfx::Size size(2, 2); | 3159 gfx::Size size(2, 2); |
| 3160 ResourceFormat format = RGBA_8888; | 3160 ResourceFormat format = RGBA_8888; |
| 3161 ResourceProvider::ResourceId id = 0; | 3161 ResourceProvider::ResourceId id = 0; |
| 3162 int texture_id = 123; | 3162 int texture_id = 123; |
| 3163 | 3163 |
| 3164 scoped_ptr<ResourceProvider> resource_provider( | 3164 scoped_ptr<ResourceProvider> resource_provider( |
| 3165 ResourceProvider::Create(output_surface.get(), | 3165 ResourceProvider::Create(output_surface.get(), |
| 3166 shared_bitmap_manager_.get(), | 3166 shared_bitmap_manager_.get(), |
| 3167 NULL, | 3167 nullptr, |
| 3168 0, | 3168 0, |
| 3169 false, | 3169 false, |
| 3170 1, | 3170 1, |
| 3171 false)); | 3171 false)); |
| 3172 | 3172 |
| 3173 id = resource_provider->CreateResource( | 3173 id = resource_provider->CreateResource( |
| 3174 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3174 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
| 3175 resource_provider->AcquirePixelBuffer(id); | 3175 resource_provider->AcquirePixelBuffer(id); |
| 3176 | 3176 |
| 3177 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3177 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 3204 CHECK(output_surface->BindToClient(&output_surface_client)); | 3204 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3205 | 3205 |
| 3206 gfx::Size size(2, 2); | 3206 gfx::Size size(2, 2); |
| 3207 ResourceFormat format = RGBA_8888; | 3207 ResourceFormat format = RGBA_8888; |
| 3208 ResourceProvider::ResourceId id = 0; | 3208 ResourceProvider::ResourceId id = 0; |
| 3209 int texture_id = 123; | 3209 int texture_id = 123; |
| 3210 | 3210 |
| 3211 scoped_ptr<ResourceProvider> resource_provider( | 3211 scoped_ptr<ResourceProvider> resource_provider( |
| 3212 ResourceProvider::Create(output_surface.get(), | 3212 ResourceProvider::Create(output_surface.get(), |
| 3213 shared_bitmap_manager_.get(), | 3213 shared_bitmap_manager_.get(), |
| 3214 NULL, | 3214 nullptr, |
| 3215 0, | 3215 0, |
| 3216 false, | 3216 false, |
| 3217 1, | 3217 1, |
| 3218 false)); | 3218 false)); |
| 3219 | 3219 |
| 3220 id = resource_provider->CreateResource( | 3220 id = resource_provider->CreateResource( |
| 3221 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3221 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
| 3222 resource_provider->AcquirePixelBuffer(id); | 3222 resource_provider->AcquirePixelBuffer(id); |
| 3223 | 3223 |
| 3224 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3224 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 3251 CHECK(output_surface->BindToClient(&output_surface_client)); | 3251 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3252 | 3252 |
| 3253 gfx::Size size(2, 2); | 3253 gfx::Size size(2, 2); |
| 3254 ResourceFormat format = RGBA_8888; | 3254 ResourceFormat format = RGBA_8888; |
| 3255 ResourceProvider::ResourceId id = 0; | 3255 ResourceProvider::ResourceId id = 0; |
| 3256 int texture_id = 123; | 3256 int texture_id = 123; |
| 3257 | 3257 |
| 3258 scoped_ptr<ResourceProvider> resource_provider( | 3258 scoped_ptr<ResourceProvider> resource_provider( |
| 3259 ResourceProvider::Create(output_surface.get(), | 3259 ResourceProvider::Create(output_surface.get(), |
| 3260 shared_bitmap_manager_.get(), | 3260 shared_bitmap_manager_.get(), |
| 3261 NULL, | 3261 nullptr, |
| 3262 0, | 3262 0, |
| 3263 false, | 3263 false, |
| 3264 1, | 3264 1, |
| 3265 false)); | 3265 false)); |
| 3266 | 3266 |
| 3267 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); | 3267 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); |
| 3268 | 3268 |
| 3269 id = resource_provider->CreateResource( | 3269 id = resource_provider->CreateResource( |
| 3270 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3270 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
| 3271 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 3271 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 3296 const int kHeight = 2; | 3296 const int kHeight = 2; |
| 3297 gfx::Size size(kWidth, kHeight); | 3297 gfx::Size size(kWidth, kHeight); |
| 3298 ResourceFormat format = RGBA_8888; | 3298 ResourceFormat format = RGBA_8888; |
| 3299 ResourceProvider::ResourceId id = 0; | 3299 ResourceProvider::ResourceId id = 0; |
| 3300 const unsigned kTextureId = 123u; | 3300 const unsigned kTextureId = 123u; |
| 3301 const unsigned kImageId = 234u; | 3301 const unsigned kImageId = 234u; |
| 3302 | 3302 |
| 3303 scoped_ptr<ResourceProvider> resource_provider( | 3303 scoped_ptr<ResourceProvider> resource_provider( |
| 3304 ResourceProvider::Create(output_surface.get(), | 3304 ResourceProvider::Create(output_surface.get(), |
| 3305 shared_bitmap_manager_.get(), | 3305 shared_bitmap_manager_.get(), |
| 3306 NULL, | 3306 nullptr, |
| 3307 0, | 3307 0, |
| 3308 false, | 3308 false, |
| 3309 1, | 3309 1, |
| 3310 false)); | 3310 false)); |
| 3311 | 3311 |
| 3312 id = resource_provider->CreateResource( | 3312 id = resource_provider->CreateResource( |
| 3313 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3313 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
| 3314 | 3314 |
| 3315 const int kStride = 8; | 3315 const int kStride = 8; |
| 3316 uint8 buffer_data[kStride * kHeight]; | 3316 uint8 buffer_data[kStride * kHeight]; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3409 ResourceFormat format = RGBA_8888; | 3409 ResourceFormat format = RGBA_8888; |
| 3410 ResourceProvider::ResourceId source_id = 0; | 3410 ResourceProvider::ResourceId source_id = 0; |
| 3411 ResourceProvider::ResourceId dest_id = 0; | 3411 ResourceProvider::ResourceId dest_id = 0; |
| 3412 const unsigned kSourceTextureId = 123u; | 3412 const unsigned kSourceTextureId = 123u; |
| 3413 const unsigned kDestTextureId = 321u; | 3413 const unsigned kDestTextureId = 321u; |
| 3414 const unsigned kImageId = 234u; | 3414 const unsigned kImageId = 234u; |
| 3415 | 3415 |
| 3416 scoped_ptr<ResourceProvider> resource_provider( | 3416 scoped_ptr<ResourceProvider> resource_provider( |
| 3417 ResourceProvider::Create(output_surface.get(), | 3417 ResourceProvider::Create(output_surface.get(), |
| 3418 shared_bitmap_manager_.get(), | 3418 shared_bitmap_manager_.get(), |
| 3419 NULL, | 3419 nullptr, |
| 3420 0, | 3420 0, |
| 3421 false, | 3421 false, |
| 3422 1, | 3422 1, |
| 3423 false)); | 3423 false)); |
| 3424 | 3424 |
| 3425 source_id = resource_provider->CreateResource( | 3425 source_id = resource_provider->CreateResource( |
| 3426 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3426 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
| 3427 | 3427 |
| 3428 const int kStride = 8; | 3428 const int kStride = 8; |
| 3429 uint8 buffer_data[kStride * kHeight]; | 3429 uint8 buffer_data[kStride * kHeight]; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3506 FakeOutputSurface::CreateDeferredGL( | 3506 FakeOutputSurface::CreateDeferredGL( |
| 3507 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice), | 3507 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice), |
| 3508 delegated_rendering)); | 3508 delegated_rendering)); |
| 3509 FakeOutputSurfaceClient client(output_surface.get()); | 3509 FakeOutputSurfaceClient client(output_surface.get()); |
| 3510 EXPECT_TRUE(output_surface->BindToClient(&client)); | 3510 EXPECT_TRUE(output_surface->BindToClient(&client)); |
| 3511 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 3511 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 3512 new TestSharedBitmapManager()); | 3512 new TestSharedBitmapManager()); |
| 3513 scoped_ptr<ResourceProvider> resource_provider( | 3513 scoped_ptr<ResourceProvider> resource_provider( |
| 3514 ResourceProvider::Create(output_surface.get(), | 3514 ResourceProvider::Create(output_surface.get(), |
| 3515 shared_bitmap_manager.get(), | 3515 shared_bitmap_manager.get(), |
| 3516 NULL, | 3516 nullptr, |
| 3517 0, | 3517 0, |
| 3518 false, | 3518 false, |
| 3519 1, | 3519 1, |
| 3520 false)); | 3520 false)); |
| 3521 | 3521 |
| 3522 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); | 3522 CheckCreateResource( |
| 3523 ResourceProvider::Bitmap, resource_provider.get(), nullptr); |
| 3523 | 3524 |
| 3524 InitializeGLAndCheck(shared_data.get(), | 3525 InitializeGLAndCheck(shared_data.get(), |
| 3525 resource_provider.get(), | 3526 resource_provider.get(), |
| 3526 output_surface.get()); | 3527 output_surface.get()); |
| 3527 | 3528 |
| 3528 resource_provider->InitializeSoftware(); | 3529 resource_provider->InitializeSoftware(); |
| 3529 output_surface->ReleaseGL(); | 3530 output_surface->ReleaseGL(); |
| 3530 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); | 3531 CheckCreateResource( |
| 3532 ResourceProvider::Bitmap, resource_provider.get(), nullptr); |
| 3531 | 3533 |
| 3532 InitializeGLAndCheck(shared_data.get(), | 3534 InitializeGLAndCheck(shared_data.get(), |
| 3533 resource_provider.get(), | 3535 resource_provider.get(), |
| 3534 output_surface.get()); | 3536 output_surface.get()); |
| 3535 } | 3537 } |
| 3536 | 3538 |
| 3537 TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) { | 3539 TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) { |
| 3538 if (GetParam() != ResourceProvider::GLTexture) | 3540 if (GetParam() != ResourceProvider::GLTexture) |
| 3539 return; | 3541 return; |
| 3540 | 3542 |
| 3541 scoped_ptr<AllocationTrackingContext3D> context_owned( | 3543 scoped_ptr<AllocationTrackingContext3D> context_owned( |
| 3542 new AllocationTrackingContext3D); | 3544 new AllocationTrackingContext3D); |
| 3543 AllocationTrackingContext3D* context = context_owned.get(); | 3545 AllocationTrackingContext3D* context = context_owned.get(); |
| 3544 context_owned->set_support_compressed_texture_etc1(true); | 3546 context_owned->set_support_compressed_texture_etc1(true); |
| 3545 | 3547 |
| 3546 FakeOutputSurfaceClient output_surface_client; | 3548 FakeOutputSurfaceClient output_surface_client; |
| 3547 scoped_ptr<OutputSurface> output_surface( | 3549 scoped_ptr<OutputSurface> output_surface( |
| 3548 FakeOutputSurface::Create3d(context_owned.Pass())); | 3550 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3549 CHECK(output_surface->BindToClient(&output_surface_client)); | 3551 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3550 | 3552 |
| 3551 gfx::Size size(4, 4); | 3553 gfx::Size size(4, 4); |
| 3552 scoped_ptr<ResourceProvider> resource_provider( | 3554 scoped_ptr<ResourceProvider> resource_provider( |
| 3553 ResourceProvider::Create(output_surface.get(), | 3555 ResourceProvider::Create(output_surface.get(), |
| 3554 shared_bitmap_manager_.get(), | 3556 shared_bitmap_manager_.get(), |
| 3555 NULL, | 3557 nullptr, |
| 3556 0, | 3558 0, |
| 3557 false, | 3559 false, |
| 3558 1, | 3560 1, |
| 3559 false)); | 3561 false)); |
| 3560 int texture_id = 123; | 3562 int texture_id = 123; |
| 3561 | 3563 |
| 3562 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3564 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
| 3563 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); | 3565 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); |
| 3564 EXPECT_NE(0u, id); | 3566 EXPECT_NE(0u, id); |
| 3565 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3567 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3581 | 3583 |
| 3582 FakeOutputSurfaceClient output_surface_client; | 3584 FakeOutputSurfaceClient output_surface_client; |
| 3583 scoped_ptr<OutputSurface> output_surface( | 3585 scoped_ptr<OutputSurface> output_surface( |
| 3584 FakeOutputSurface::Create3d(context_owned.Pass())); | 3586 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3585 CHECK(output_surface->BindToClient(&output_surface_client)); | 3587 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3586 | 3588 |
| 3587 gfx::Size size(4, 4); | 3589 gfx::Size size(4, 4); |
| 3588 scoped_ptr<ResourceProvider> resource_provider( | 3590 scoped_ptr<ResourceProvider> resource_provider( |
| 3589 ResourceProvider::Create(output_surface.get(), | 3591 ResourceProvider::Create(output_surface.get(), |
| 3590 shared_bitmap_manager_.get(), | 3592 shared_bitmap_manager_.get(), |
| 3591 NULL, | 3593 nullptr, |
| 3592 0, | 3594 0, |
| 3593 false, | 3595 false, |
| 3594 1, | 3596 1, |
| 3595 false)); | 3597 false)); |
| 3596 int texture_id = 123; | 3598 int texture_id = 123; |
| 3597 uint8_t pixels[8]; | 3599 uint8_t pixels[8]; |
| 3598 | 3600 |
| 3599 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3601 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
| 3600 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); | 3602 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); |
| 3601 EXPECT_NE(0u, id); | 3603 EXPECT_NE(0u, id); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3642 new TestSharedBitmapManager()); | 3644 new TestSharedBitmapManager()); |
| 3643 | 3645 |
| 3644 gfx::Size size(1, 1); | 3646 gfx::Size size(1, 1); |
| 3645 ResourceFormat format = RGBA_8888; | 3647 ResourceFormat format = RGBA_8888; |
| 3646 | 3648 |
| 3647 { | 3649 { |
| 3648 size_t kTextureAllocationChunkSize = 1; | 3650 size_t kTextureAllocationChunkSize = 1; |
| 3649 scoped_ptr<ResourceProvider> resource_provider( | 3651 scoped_ptr<ResourceProvider> resource_provider( |
| 3650 ResourceProvider::Create(output_surface.get(), | 3652 ResourceProvider::Create(output_surface.get(), |
| 3651 shared_bitmap_manager.get(), | 3653 shared_bitmap_manager.get(), |
| 3652 NULL, | 3654 nullptr, |
| 3653 0, | 3655 0, |
| 3654 false, | 3656 false, |
| 3655 kTextureAllocationChunkSize, | 3657 kTextureAllocationChunkSize, |
| 3656 false)); | 3658 false)); |
| 3657 | 3659 |
| 3658 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3660 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
| 3659 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3661 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
| 3660 resource_provider->AllocateForTesting(id); | 3662 resource_provider->AllocateForTesting(id); |
| 3661 Mock::VerifyAndClearExpectations(context); | 3663 Mock::VerifyAndClearExpectations(context); |
| 3662 | 3664 |
| 3663 DCHECK_EQ(2u, context->PeekTextureId()); | 3665 DCHECK_EQ(2u, context->PeekTextureId()); |
| 3664 resource_provider->DeleteResource(id); | 3666 resource_provider->DeleteResource(id); |
| 3665 } | 3667 } |
| 3666 | 3668 |
| 3667 { | 3669 { |
| 3668 size_t kTextureAllocationChunkSize = 8; | 3670 size_t kTextureAllocationChunkSize = 8; |
| 3669 scoped_ptr<ResourceProvider> resource_provider( | 3671 scoped_ptr<ResourceProvider> resource_provider( |
| 3670 ResourceProvider::Create(output_surface.get(), | 3672 ResourceProvider::Create(output_surface.get(), |
| 3671 shared_bitmap_manager.get(), | 3673 shared_bitmap_manager.get(), |
| 3672 NULL, | 3674 nullptr, |
| 3673 0, | 3675 0, |
| 3674 false, | 3676 false, |
| 3675 kTextureAllocationChunkSize, | 3677 kTextureAllocationChunkSize, |
| 3676 false)); | 3678 false)); |
| 3677 | 3679 |
| 3678 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3680 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
| 3679 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3681 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
| 3680 resource_provider->AllocateForTesting(id); | 3682 resource_provider->AllocateForTesting(id); |
| 3681 Mock::VerifyAndClearExpectations(context); | 3683 Mock::VerifyAndClearExpectations(context); |
| 3682 | 3684 |
| 3683 DCHECK_EQ(10u, context->PeekTextureId()); | 3685 DCHECK_EQ(10u, context->PeekTextureId()); |
| 3684 resource_provider->DeleteResource(id); | 3686 resource_provider->DeleteResource(id); |
| 3685 } | 3687 } |
| 3686 } | 3688 } |
| 3687 | 3689 |
| 3688 } // namespace | 3690 } // namespace |
| 3689 } // namespace cc | 3691 } // namespace cc |
| OLD | NEW |