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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 case ResourceProvider::InvalidType: | 410 case ResourceProvider::InvalidType: |
411 NOTREACHED(); | 411 NOTREACHED(); |
412 break; | 412 break; |
413 } | 413 } |
414 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 414 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
415 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); | 415 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); |
416 | 416 |
417 shared_bitmap_manager_.reset(new TestSharedBitmapManager); | 417 shared_bitmap_manager_.reset(new TestSharedBitmapManager); |
418 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); | 418 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); |
419 | 419 |
420 resource_provider_ = | 420 resource_provider_ = ResourceProvider::Create( |
421 ResourceProvider::Create(output_surface_.get(), | 421 output_surface_.get(), shared_bitmap_manager_.get(), |
422 shared_bitmap_manager_.get(), | 422 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, |
423 gpu_memory_buffer_manager_.get(), | 423 false, false, 1); |
424 main_thread_task_runner_.get(), | 424 child_resource_provider_ = ResourceProvider::Create( |
425 0, | 425 child_output_surface_.get(), shared_bitmap_manager_.get(), |
426 false, | 426 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, |
427 1); | 427 false, false, 1); |
428 child_resource_provider_ = | |
429 ResourceProvider::Create(child_output_surface_.get(), | |
430 shared_bitmap_manager_.get(), | |
431 gpu_memory_buffer_manager_.get(), | |
432 main_thread_task_runner_.get(), | |
433 0, | |
434 false, | |
435 1); | |
436 } | 428 } |
437 | 429 |
438 static void CollectResources(ReturnedResourceArray* array, | 430 static void CollectResources(ReturnedResourceArray* array, |
439 const ReturnedResourceArray& returned, | 431 const ReturnedResourceArray& returned, |
440 BlockingTaskRunner* main_thread_task_runner) { | 432 BlockingTaskRunner* main_thread_task_runner) { |
441 array->insert(array->end(), returned.begin(), returned.end()); | 433 array->insert(array->end(), returned.begin(), returned.end()); |
442 } | 434 } |
443 | 435 |
444 static ReturnCallback GetReturnCallback(ReturnedResourceArray* array) { | 436 static ReturnCallback GetReturnCallback(ReturnedResourceArray* array) { |
445 return base::Bind(&ResourceProviderTest::CollectResources, array); | 437 return base::Bind(&ResourceProviderTest::CollectResources, array); |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 return; | 1139 return; |
1148 | 1140 |
1149 scoped_ptr<ResourceProviderContext> child_context_owned( | 1141 scoped_ptr<ResourceProviderContext> child_context_owned( |
1150 ResourceProviderContext::Create(shared_data_.get())); | 1142 ResourceProviderContext::Create(shared_data_.get())); |
1151 | 1143 |
1152 FakeOutputSurfaceClient child_output_surface_client; | 1144 FakeOutputSurfaceClient child_output_surface_client; |
1153 scoped_ptr<OutputSurface> child_output_surface( | 1145 scoped_ptr<OutputSurface> child_output_surface( |
1154 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1146 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
1155 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1147 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
1156 | 1148 |
1157 scoped_ptr<ResourceProvider> child_resource_provider( | 1149 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create( |
1158 ResourceProvider::Create(child_output_surface.get(), | 1150 child_output_surface.get(), shared_bitmap_manager_.get(), |
1159 shared_bitmap_manager_.get(), | 1151 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
1160 gpu_memory_buffer_manager_.get(), | |
1161 NULL, | |
1162 0, | |
1163 false, | |
1164 1)); | |
1165 | 1152 |
1166 gfx::Size size(1, 1); | 1153 gfx::Size size(1, 1); |
1167 ResourceFormat format = RGBA_8888; | 1154 ResourceFormat format = RGBA_8888; |
1168 size_t pixel_size = TextureSizeBytes(size, format); | 1155 size_t pixel_size = TextureSizeBytes(size, format); |
1169 ASSERT_EQ(4U, pixel_size); | 1156 ASSERT_EQ(4U, pixel_size); |
1170 | 1157 |
1171 ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource( | 1158 ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource( |
1172 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 1159 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
1173 uint8_t data1[4] = { 1, 2, 3, 4 }; | 1160 uint8_t data1[4] = { 1, 2, 3, 4 }; |
1174 gfx::Rect rect(size); | 1161 gfx::Rect rect(size); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 | 1618 |
1632 FakeOutputSurfaceClient child_output_surface_client; | 1619 FakeOutputSurfaceClient child_output_surface_client; |
1633 scoped_ptr<OutputSurface> child_output_surface( | 1620 scoped_ptr<OutputSurface> child_output_surface( |
1634 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1621 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
1635 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1622 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
1636 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1623 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1637 new TestSharedBitmapManager()); | 1624 new TestSharedBitmapManager()); |
1638 | 1625 |
1639 scoped_ptr<ResourceProvider> child_resource_provider( | 1626 scoped_ptr<ResourceProvider> child_resource_provider( |
1640 ResourceProvider::Create(child_output_surface.get(), | 1627 ResourceProvider::Create(child_output_surface.get(), |
1641 shared_bitmap_manager.get(), | 1628 shared_bitmap_manager.get(), NULL, NULL, 0, |
1642 NULL, | 1629 false, false, 1)); |
1643 NULL, | |
1644 0, | |
1645 false, | |
1646 1)); | |
1647 | 1630 |
1648 scoped_ptr<TextureStateTrackingContext> parent_context_owned( | 1631 scoped_ptr<TextureStateTrackingContext> parent_context_owned( |
1649 new TextureStateTrackingContext); | 1632 new TextureStateTrackingContext); |
1650 TextureStateTrackingContext* parent_context = parent_context_owned.get(); | 1633 TextureStateTrackingContext* parent_context = parent_context_owned.get(); |
1651 | 1634 |
1652 FakeOutputSurfaceClient parent_output_surface_client; | 1635 FakeOutputSurfaceClient parent_output_surface_client; |
1653 scoped_ptr<OutputSurface> parent_output_surface( | 1636 scoped_ptr<OutputSurface> parent_output_surface( |
1654 FakeOutputSurface::Create3d(parent_context_owned.Pass())); | 1637 FakeOutputSurface::Create3d(parent_context_owned.Pass())); |
1655 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); | 1638 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); |
1656 | 1639 |
1657 scoped_ptr<ResourceProvider> parent_resource_provider( | 1640 scoped_ptr<ResourceProvider> parent_resource_provider( |
1658 ResourceProvider::Create(parent_output_surface.get(), | 1641 ResourceProvider::Create(parent_output_surface.get(), |
1659 shared_bitmap_manager.get(), | 1642 shared_bitmap_manager.get(), NULL, NULL, 0, |
1660 NULL, | 1643 false, false, 1)); |
1661 NULL, | |
1662 0, | |
1663 false, | |
1664 1)); | |
1665 | 1644 |
1666 gfx::Size size(1, 1); | 1645 gfx::Size size(1, 1); |
1667 ResourceFormat format = RGBA_8888; | 1646 ResourceFormat format = RGBA_8888; |
1668 int child_texture_id = 1; | 1647 int child_texture_id = 1; |
1669 int parent_texture_id = 2; | 1648 int parent_texture_id = 2; |
1670 | 1649 |
1671 size_t pixel_size = TextureSizeBytes(size, format); | 1650 size_t pixel_size = TextureSizeBytes(size, format); |
1672 ASSERT_EQ(4U, pixel_size); | 1651 ASSERT_EQ(4U, pixel_size); |
1673 | 1652 |
1674 ResourceProvider::ResourceId id = child_resource_provider->CreateResource( | 1653 ResourceProvider::ResourceId id = child_resource_provider->CreateResource( |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 | 2258 |
2280 scoped_ptr<TextureStateTrackingContext> context_owned( | 2259 scoped_ptr<TextureStateTrackingContext> context_owned( |
2281 new TextureStateTrackingContext); | 2260 new TextureStateTrackingContext); |
2282 TextureStateTrackingContext* context = context_owned.get(); | 2261 TextureStateTrackingContext* context = context_owned.get(); |
2283 | 2262 |
2284 FakeOutputSurfaceClient output_surface_client; | 2263 FakeOutputSurfaceClient output_surface_client; |
2285 scoped_ptr<OutputSurface> output_surface( | 2264 scoped_ptr<OutputSurface> output_surface( |
2286 FakeOutputSurface::Create3d(context_owned.Pass())); | 2265 FakeOutputSurface::Create3d(context_owned.Pass())); |
2287 CHECK(output_surface->BindToClient(&output_surface_client)); | 2266 CHECK(output_surface->BindToClient(&output_surface_client)); |
2288 | 2267 |
2289 scoped_ptr<ResourceProvider> resource_provider( | 2268 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2290 ResourceProvider::Create(output_surface.get(), | 2269 output_surface.get(), shared_bitmap_manager_.get(), |
2291 shared_bitmap_manager_.get(), | 2270 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
2292 gpu_memory_buffer_manager_.get(), | |
2293 NULL, | |
2294 0, | |
2295 false, | |
2296 1)); | |
2297 | 2271 |
2298 gfx::Size size(1, 1); | 2272 gfx::Size size(1, 1); |
2299 ResourceFormat format = RGBA_8888; | 2273 ResourceFormat format = RGBA_8888; |
2300 int texture_id = 1; | 2274 int texture_id = 1; |
2301 | 2275 |
2302 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 2276 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
2303 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 2277 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
2304 | 2278 |
2305 // Check that the texture gets created with the right sampler settings. | 2279 // Check that the texture gets created with the right sampler settings. |
2306 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) | 2280 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2366 | 2340 |
2367 scoped_ptr<TextureStateTrackingContext> context_owned( | 2341 scoped_ptr<TextureStateTrackingContext> context_owned( |
2368 new TextureStateTrackingContext); | 2342 new TextureStateTrackingContext); |
2369 TextureStateTrackingContext* context = context_owned.get(); | 2343 TextureStateTrackingContext* context = context_owned.get(); |
2370 | 2344 |
2371 FakeOutputSurfaceClient output_surface_client; | 2345 FakeOutputSurfaceClient output_surface_client; |
2372 scoped_ptr<OutputSurface> output_surface( | 2346 scoped_ptr<OutputSurface> output_surface( |
2373 FakeOutputSurface::Create3d(context_owned.Pass())); | 2347 FakeOutputSurface::Create3d(context_owned.Pass())); |
2374 CHECK(output_surface->BindToClient(&output_surface_client)); | 2348 CHECK(output_surface->BindToClient(&output_surface_client)); |
2375 | 2349 |
2376 scoped_ptr<ResourceProvider> resource_provider( | 2350 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2377 ResourceProvider::Create(output_surface.get(), | 2351 output_surface.get(), shared_bitmap_manager_.get(), |
2378 shared_bitmap_manager_.get(), | 2352 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
2379 gpu_memory_buffer_manager_.get(), | |
2380 NULL, | |
2381 0, | |
2382 false, | |
2383 1)); | |
2384 | 2353 |
2385 gfx::Size size(1, 1); | 2354 gfx::Size size(1, 1); |
2386 ResourceFormat format = RGBA_8888; | 2355 ResourceFormat format = RGBA_8888; |
2387 int texture_id = 1; | 2356 int texture_id = 1; |
2388 | 2357 |
2389 // Check that the texture gets created with the right sampler settings. | 2358 // Check that the texture gets created with the right sampler settings. |
2390 ResourceProvider::ResourceId id = resource_provider->CreateManagedResource( | 2359 ResourceProvider::ResourceId id = resource_provider->CreateManagedResource( |
2391 size, | 2360 size, |
2392 GL_TEXTURE_2D, | 2361 GL_TEXTURE_2D, |
2393 GL_CLAMP_TO_EDGE, | 2362 GL_CLAMP_TO_EDGE, |
(...skipping 27 matching lines...) Expand all Loading... |
2421 | 2390 |
2422 scoped_ptr<TextureStateTrackingContext> context_owned( | 2391 scoped_ptr<TextureStateTrackingContext> context_owned( |
2423 new TextureStateTrackingContext); | 2392 new TextureStateTrackingContext); |
2424 TextureStateTrackingContext* context = context_owned.get(); | 2393 TextureStateTrackingContext* context = context_owned.get(); |
2425 | 2394 |
2426 FakeOutputSurfaceClient output_surface_client; | 2395 FakeOutputSurfaceClient output_surface_client; |
2427 scoped_ptr<OutputSurface> output_surface( | 2396 scoped_ptr<OutputSurface> output_surface( |
2428 FakeOutputSurface::Create3d(context_owned.Pass())); | 2397 FakeOutputSurface::Create3d(context_owned.Pass())); |
2429 CHECK(output_surface->BindToClient(&output_surface_client)); | 2398 CHECK(output_surface->BindToClient(&output_surface_client)); |
2430 | 2399 |
2431 scoped_ptr<ResourceProvider> resource_provider( | 2400 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2432 ResourceProvider::Create(output_surface.get(), | 2401 output_surface.get(), shared_bitmap_manager_.get(), |
2433 shared_bitmap_manager_.get(), | 2402 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
2434 gpu_memory_buffer_manager_.get(), | |
2435 NULL, | |
2436 0, | |
2437 false, | |
2438 1)); | |
2439 | 2403 |
2440 gfx::Size size(1, 1); | 2404 gfx::Size size(1, 1); |
2441 ResourceFormat format = RGBA_8888; | 2405 ResourceFormat format = RGBA_8888; |
2442 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2406 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
2443 | 2407 |
2444 for (int texture_id = 1; texture_id <= 2; ++texture_id) { | 2408 for (int texture_id = 1; texture_id <= 2; ++texture_id) { |
2445 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; | 2409 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; |
2446 // Check that the texture gets created with the right sampler settings. | 2410 // Check that the texture gets created with the right sampler settings. |
2447 ResourceProvider::ResourceId id = resource_provider->CreateGLTexture( | 2411 ResourceProvider::ResourceId id = resource_provider->CreateGLTexture( |
2448 size, | 2412 size, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2480 new TextureStateTrackingContext); | 2444 new TextureStateTrackingContext); |
2481 TextureStateTrackingContext* context = context_owned.get(); | 2445 TextureStateTrackingContext* context = context_owned.get(); |
2482 context->set_support_texture_storage(true); | 2446 context->set_support_texture_storage(true); |
2483 context->set_support_texture_usage(true); | 2447 context->set_support_texture_usage(true); |
2484 | 2448 |
2485 FakeOutputSurfaceClient output_surface_client; | 2449 FakeOutputSurfaceClient output_surface_client; |
2486 scoped_ptr<OutputSurface> output_surface( | 2450 scoped_ptr<OutputSurface> output_surface( |
2487 FakeOutputSurface::Create3d(context_owned.Pass())); | 2451 FakeOutputSurface::Create3d(context_owned.Pass())); |
2488 CHECK(output_surface->BindToClient(&output_surface_client)); | 2452 CHECK(output_surface->BindToClient(&output_surface_client)); |
2489 | 2453 |
2490 scoped_ptr<ResourceProvider> resource_provider( | 2454 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2491 ResourceProvider::Create(output_surface.get(), | 2455 output_surface.get(), shared_bitmap_manager_.get(), |
2492 shared_bitmap_manager_.get(), | 2456 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
2493 gpu_memory_buffer_manager_.get(), | |
2494 NULL, | |
2495 0, | |
2496 false, | |
2497 1)); | |
2498 | 2457 |
2499 gfx::Size size(1, 1); | 2458 gfx::Size size(1, 1); |
2500 ResourceFormat format = RGBA_8888; | 2459 ResourceFormat format = RGBA_8888; |
2501 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2460 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
2502 | 2461 |
2503 const ResourceProvider::TextureHint hints[4] = { | 2462 const ResourceProvider::TextureHint hints[4] = { |
2504 ResourceProvider::TextureHintDefault, | 2463 ResourceProvider::TextureHintDefault, |
2505 ResourceProvider::TextureHintImmutable, | 2464 ResourceProvider::TextureHintImmutable, |
2506 ResourceProvider::TextureHintFramebuffer, | 2465 ResourceProvider::TextureHintFramebuffer, |
2507 ResourceProvider::TextureHintImmutableFramebuffer, | 2466 ResourceProvider::TextureHintImmutableFramebuffer, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2553 const uint32_t kBadBeef = 0xbadbeef; | 2512 const uint32_t kBadBeef = 0xbadbeef; |
2554 scoped_ptr<SharedBitmap> shared_bitmap( | 2513 scoped_ptr<SharedBitmap> shared_bitmap( |
2555 CreateAndFillSharedBitmap(shared_bitmap_manager_.get(), size, kBadBeef)); | 2514 CreateAndFillSharedBitmap(shared_bitmap_manager_.get(), size, kBadBeef)); |
2556 | 2515 |
2557 FakeOutputSurfaceClient output_surface_client; | 2516 FakeOutputSurfaceClient output_surface_client; |
2558 scoped_ptr<OutputSurface> output_surface( | 2517 scoped_ptr<OutputSurface> output_surface( |
2559 FakeOutputSurface::CreateSoftware(make_scoped_ptr( | 2518 FakeOutputSurface::CreateSoftware(make_scoped_ptr( |
2560 new SoftwareOutputDevice))); | 2519 new SoftwareOutputDevice))); |
2561 CHECK(output_surface->BindToClient(&output_surface_client)); | 2520 CHECK(output_surface->BindToClient(&output_surface_client)); |
2562 | 2521 |
2563 scoped_ptr<ResourceProvider> resource_provider( | 2522 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2564 ResourceProvider::Create(output_surface.get(), | 2523 output_surface.get(), shared_bitmap_manager_.get(), |
2565 shared_bitmap_manager_.get(), | 2524 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, |
2566 gpu_memory_buffer_manager_.get(), | 2525 false, false, 1)); |
2567 main_thread_task_runner_.get(), | |
2568 0, | |
2569 false, | |
2570 1)); | |
2571 | 2526 |
2572 uint32 release_sync_point = 0; | 2527 uint32 release_sync_point = 0; |
2573 bool lost_resource = false; | 2528 bool lost_resource = false; |
2574 BlockingTaskRunner* main_thread_task_runner = NULL; | 2529 BlockingTaskRunner* main_thread_task_runner = NULL; |
2575 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2530 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2576 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, | 2531 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, |
2577 &release_sync_point, | 2532 &release_sync_point, |
2578 &lost_resource, | 2533 &lost_resource, |
2579 &main_thread_task_runner)); | 2534 &main_thread_task_runner)); |
2580 TextureMailbox mailbox(shared_bitmap.get(), size); | 2535 TextureMailbox mailbox(shared_bitmap.get(), size); |
(...skipping 27 matching lines...) Expand all Loading... |
2608 GLenum sampler_filter) { | 2563 GLenum sampler_filter) { |
2609 scoped_ptr<TextureStateTrackingContext> context_owned( | 2564 scoped_ptr<TextureStateTrackingContext> context_owned( |
2610 new TextureStateTrackingContext); | 2565 new TextureStateTrackingContext); |
2611 TextureStateTrackingContext* context = context_owned.get(); | 2566 TextureStateTrackingContext* context = context_owned.get(); |
2612 | 2567 |
2613 FakeOutputSurfaceClient output_surface_client; | 2568 FakeOutputSurfaceClient output_surface_client; |
2614 scoped_ptr<OutputSurface> output_surface( | 2569 scoped_ptr<OutputSurface> output_surface( |
2615 FakeOutputSurface::Create3d(context_owned.Pass())); | 2570 FakeOutputSurface::Create3d(context_owned.Pass())); |
2616 CHECK(output_surface->BindToClient(&output_surface_client)); | 2571 CHECK(output_surface->BindToClient(&output_surface_client)); |
2617 | 2572 |
2618 scoped_ptr<ResourceProvider> resource_provider( | 2573 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2619 ResourceProvider::Create(output_surface.get(), | 2574 output_surface.get(), shared_bitmap_manager, gpu_memory_buffer_manager, |
2620 shared_bitmap_manager, | 2575 main_thread_task_runner, 0, false, false, 1)); |
2621 gpu_memory_buffer_manager, | |
2622 main_thread_task_runner, | |
2623 0, | |
2624 false, | |
2625 1)); | |
2626 | 2576 |
2627 unsigned texture_id = 1; | 2577 unsigned texture_id = 1; |
2628 uint32 sync_point = 30; | 2578 uint32 sync_point = 30; |
2629 unsigned target = GL_TEXTURE_2D; | 2579 unsigned target = GL_TEXTURE_2D; |
2630 | 2580 |
2631 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2581 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2632 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2582 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2633 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2583 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2634 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2584 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2635 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2585 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2757 | 2707 |
2758 scoped_ptr<TextureStateTrackingContext> context_owned( | 2708 scoped_ptr<TextureStateTrackingContext> context_owned( |
2759 new TextureStateTrackingContext); | 2709 new TextureStateTrackingContext); |
2760 TextureStateTrackingContext* context = context_owned.get(); | 2710 TextureStateTrackingContext* context = context_owned.get(); |
2761 | 2711 |
2762 FakeOutputSurfaceClient output_surface_client; | 2712 FakeOutputSurfaceClient output_surface_client; |
2763 scoped_ptr<OutputSurface> output_surface( | 2713 scoped_ptr<OutputSurface> output_surface( |
2764 FakeOutputSurface::Create3d(context_owned.Pass())); | 2714 FakeOutputSurface::Create3d(context_owned.Pass())); |
2765 CHECK(output_surface->BindToClient(&output_surface_client)); | 2715 CHECK(output_surface->BindToClient(&output_surface_client)); |
2766 | 2716 |
2767 scoped_ptr<ResourceProvider> resource_provider( | 2717 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2768 ResourceProvider::Create(output_surface.get(), | 2718 output_surface.get(), shared_bitmap_manager_.get(), |
2769 shared_bitmap_manager_.get(), | 2719 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
2770 gpu_memory_buffer_manager_.get(), | |
2771 NULL, | |
2772 0, | |
2773 false, | |
2774 1)); | |
2775 | 2720 |
2776 unsigned texture_id = 1; | 2721 unsigned texture_id = 1; |
2777 uint32 sync_point = 30; | 2722 uint32 sync_point = 30; |
2778 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 2723 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
2779 | 2724 |
2780 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2725 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2781 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2726 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2782 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2727 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2783 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2728 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2784 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2729 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2832 | 2777 |
2833 scoped_ptr<TextureStateTrackingContext> context_owned( | 2778 scoped_ptr<TextureStateTrackingContext> context_owned( |
2834 new TextureStateTrackingContext); | 2779 new TextureStateTrackingContext); |
2835 TextureStateTrackingContext* context = context_owned.get(); | 2780 TextureStateTrackingContext* context = context_owned.get(); |
2836 | 2781 |
2837 FakeOutputSurfaceClient output_surface_client; | 2782 FakeOutputSurfaceClient output_surface_client; |
2838 scoped_ptr<OutputSurface> output_surface( | 2783 scoped_ptr<OutputSurface> output_surface( |
2839 FakeOutputSurface::Create3d(context_owned.Pass())); | 2784 FakeOutputSurface::Create3d(context_owned.Pass())); |
2840 CHECK(output_surface->BindToClient(&output_surface_client)); | 2785 CHECK(output_surface->BindToClient(&output_surface_client)); |
2841 | 2786 |
2842 scoped_ptr<ResourceProvider> resource_provider( | 2787 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2843 ResourceProvider::Create(output_surface.get(), | 2788 output_surface.get(), shared_bitmap_manager_.get(), |
2844 shared_bitmap_manager_.get(), | 2789 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
2845 gpu_memory_buffer_manager_.get(), | |
2846 NULL, | |
2847 0, | |
2848 false, | |
2849 1)); | |
2850 | 2790 |
2851 uint32 sync_point = 30; | 2791 uint32 sync_point = 30; |
2852 unsigned target = GL_TEXTURE_2D; | 2792 unsigned target = GL_TEXTURE_2D; |
2853 | 2793 |
2854 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2794 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2855 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2795 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2856 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2796 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2857 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2797 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2858 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2798 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
2859 | 2799 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2891 | 2831 |
2892 scoped_ptr<TextureStateTrackingContext> context_owned( | 2832 scoped_ptr<TextureStateTrackingContext> context_owned( |
2893 new TextureStateTrackingContext); | 2833 new TextureStateTrackingContext); |
2894 TextureStateTrackingContext* context = context_owned.get(); | 2834 TextureStateTrackingContext* context = context_owned.get(); |
2895 | 2835 |
2896 FakeOutputSurfaceClient output_surface_client; | 2836 FakeOutputSurfaceClient output_surface_client; |
2897 scoped_ptr<OutputSurface> output_surface( | 2837 scoped_ptr<OutputSurface> output_surface( |
2898 FakeOutputSurface::Create3d(context_owned.Pass())); | 2838 FakeOutputSurface::Create3d(context_owned.Pass())); |
2899 CHECK(output_surface->BindToClient(&output_surface_client)); | 2839 CHECK(output_surface->BindToClient(&output_surface_client)); |
2900 | 2840 |
2901 scoped_ptr<ResourceProvider> resource_provider( | 2841 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2902 ResourceProvider::Create(output_surface.get(), | 2842 output_surface.get(), shared_bitmap_manager_.get(), |
2903 shared_bitmap_manager_.get(), | 2843 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
2904 gpu_memory_buffer_manager_.get(), | |
2905 NULL, | |
2906 0, | |
2907 false, | |
2908 1)); | |
2909 | 2844 |
2910 uint32 sync_point = 0; | 2845 uint32 sync_point = 0; |
2911 unsigned target = GL_TEXTURE_2D; | 2846 unsigned target = GL_TEXTURE_2D; |
2912 | 2847 |
2913 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2848 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2914 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2849 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2915 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2850 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2916 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2851 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2917 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2852 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
2918 | 2853 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3017 return; | 2952 return; |
3018 scoped_ptr<AllocationTrackingContext3D> context_owned( | 2953 scoped_ptr<AllocationTrackingContext3D> context_owned( |
3019 new StrictMock<AllocationTrackingContext3D>); | 2954 new StrictMock<AllocationTrackingContext3D>); |
3020 AllocationTrackingContext3D* context = context_owned.get(); | 2955 AllocationTrackingContext3D* context = context_owned.get(); |
3021 | 2956 |
3022 FakeOutputSurfaceClient output_surface_client; | 2957 FakeOutputSurfaceClient output_surface_client; |
3023 scoped_ptr<OutputSurface> output_surface( | 2958 scoped_ptr<OutputSurface> output_surface( |
3024 FakeOutputSurface::Create3d(context_owned.Pass())); | 2959 FakeOutputSurface::Create3d(context_owned.Pass())); |
3025 CHECK(output_surface->BindToClient(&output_surface_client)); | 2960 CHECK(output_surface->BindToClient(&output_surface_client)); |
3026 | 2961 |
3027 scoped_ptr<ResourceProvider> resource_provider( | 2962 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3028 ResourceProvider::Create(output_surface.get(), | 2963 output_surface.get(), shared_bitmap_manager_.get(), |
3029 shared_bitmap_manager_.get(), | 2964 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
3030 gpu_memory_buffer_manager_.get(), | |
3031 NULL, | |
3032 0, | |
3033 false, | |
3034 1)); | |
3035 | 2965 |
3036 gfx::Size size(2, 2); | 2966 gfx::Size size(2, 2); |
3037 gfx::Vector2d offset(0, 0); | 2967 gfx::Vector2d offset(0, 0); |
3038 gfx::Rect rect(0, 0, 2, 2); | 2968 gfx::Rect rect(0, 0, 2, 2); |
3039 ResourceFormat format = RGBA_8888; | 2969 ResourceFormat format = RGBA_8888; |
3040 ResourceProvider::ResourceId id = 0; | 2970 ResourceProvider::ResourceId id = 0; |
3041 uint8_t pixels[16] = { 0 }; | 2971 uint8_t pixels[16] = { 0 }; |
3042 int texture_id = 123; | 2972 int texture_id = 123; |
3043 | 2973 |
3044 // Lazy allocation. Don't allocate when creating the resource. | 2974 // Lazy allocation. Don't allocate when creating the resource. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3097 new StrictMock<AllocationTrackingContext3D>); | 3027 new StrictMock<AllocationTrackingContext3D>); |
3098 AllocationTrackingContext3D* context = context_owned.get(); | 3028 AllocationTrackingContext3D* context = context_owned.get(); |
3099 context->set_support_texture_storage(true); | 3029 context->set_support_texture_storage(true); |
3100 context->set_support_texture_usage(true); | 3030 context->set_support_texture_usage(true); |
3101 | 3031 |
3102 FakeOutputSurfaceClient output_surface_client; | 3032 FakeOutputSurfaceClient output_surface_client; |
3103 scoped_ptr<OutputSurface> output_surface( | 3033 scoped_ptr<OutputSurface> output_surface( |
3104 FakeOutputSurface::Create3d(context_owned.Pass())); | 3034 FakeOutputSurface::Create3d(context_owned.Pass())); |
3105 CHECK(output_surface->BindToClient(&output_surface_client)); | 3035 CHECK(output_surface->BindToClient(&output_surface_client)); |
3106 | 3036 |
3107 scoped_ptr<ResourceProvider> resource_provider( | 3037 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3108 ResourceProvider::Create(output_surface.get(), | 3038 output_surface.get(), shared_bitmap_manager_.get(), |
3109 shared_bitmap_manager_.get(), | 3039 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
3110 gpu_memory_buffer_manager_.get(), | |
3111 NULL, | |
3112 0, | |
3113 false, | |
3114 1)); | |
3115 | 3040 |
3116 gfx::Size size(2, 2); | 3041 gfx::Size size(2, 2); |
3117 | 3042 |
3118 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3043 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
3119 const ResourceProvider::TextureHint hints[4] = { | 3044 const ResourceProvider::TextureHint hints[4] = { |
3120 ResourceProvider::TextureHintDefault, | 3045 ResourceProvider::TextureHintDefault, |
3121 ResourceProvider::TextureHintImmutable, | 3046 ResourceProvider::TextureHintImmutable, |
3122 ResourceProvider::TextureHintFramebuffer, | 3047 ResourceProvider::TextureHintFramebuffer, |
3123 ResourceProvider::TextureHintImmutableFramebuffer, | 3048 ResourceProvider::TextureHintImmutableFramebuffer, |
3124 }; | 3049 }; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3157 AllocationTrackingContext3D* context = context_owned.get(); | 3082 AllocationTrackingContext3D* context = context_owned.get(); |
3158 context->set_support_texture_format_bgra8888(true); | 3083 context->set_support_texture_format_bgra8888(true); |
3159 context->set_support_texture_storage(true); | 3084 context->set_support_texture_storage(true); |
3160 context->set_support_texture_usage(true); | 3085 context->set_support_texture_usage(true); |
3161 | 3086 |
3162 FakeOutputSurfaceClient output_surface_client; | 3087 FakeOutputSurfaceClient output_surface_client; |
3163 scoped_ptr<OutputSurface> output_surface( | 3088 scoped_ptr<OutputSurface> output_surface( |
3164 FakeOutputSurface::Create3d(context_owned.Pass())); | 3089 FakeOutputSurface::Create3d(context_owned.Pass())); |
3165 CHECK(output_surface->BindToClient(&output_surface_client)); | 3090 CHECK(output_surface->BindToClient(&output_surface_client)); |
3166 | 3091 |
3167 scoped_ptr<ResourceProvider> resource_provider( | 3092 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3168 ResourceProvider::Create(output_surface.get(), | 3093 output_surface.get(), shared_bitmap_manager_.get(), |
3169 shared_bitmap_manager_.get(), | 3094 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
3170 gpu_memory_buffer_manager_.get(), | |
3171 NULL, | |
3172 0, | |
3173 false, | |
3174 1)); | |
3175 | 3095 |
3176 gfx::Size size(2, 2); | 3096 gfx::Size size(2, 2); |
3177 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3097 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
3178 | 3098 |
3179 const ResourceProvider::TextureHint hints[4] = { | 3099 const ResourceProvider::TextureHint hints[4] = { |
3180 ResourceProvider::TextureHintDefault, | 3100 ResourceProvider::TextureHintDefault, |
3181 ResourceProvider::TextureHintImmutable, | 3101 ResourceProvider::TextureHintImmutable, |
3182 ResourceProvider::TextureHintFramebuffer, | 3102 ResourceProvider::TextureHintFramebuffer, |
3183 ResourceProvider::TextureHintImmutableFramebuffer, | 3103 ResourceProvider::TextureHintImmutableFramebuffer, |
3184 }; | 3104 }; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3216 FakeOutputSurfaceClient output_surface_client; | 3136 FakeOutputSurfaceClient output_surface_client; |
3217 scoped_ptr<OutputSurface> output_surface( | 3137 scoped_ptr<OutputSurface> output_surface( |
3218 FakeOutputSurface::Create3d(context_owned.Pass())); | 3138 FakeOutputSurface::Create3d(context_owned.Pass())); |
3219 CHECK(output_surface->BindToClient(&output_surface_client)); | 3139 CHECK(output_surface->BindToClient(&output_surface_client)); |
3220 | 3140 |
3221 gfx::Size size(2, 2); | 3141 gfx::Size size(2, 2); |
3222 ResourceFormat format = RGBA_8888; | 3142 ResourceFormat format = RGBA_8888; |
3223 ResourceProvider::ResourceId id = 0; | 3143 ResourceProvider::ResourceId id = 0; |
3224 int texture_id = 123; | 3144 int texture_id = 123; |
3225 | 3145 |
3226 scoped_ptr<ResourceProvider> resource_provider( | 3146 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3227 ResourceProvider::Create(output_surface.get(), | 3147 output_surface.get(), shared_bitmap_manager_.get(), |
3228 shared_bitmap_manager_.get(), | 3148 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
3229 gpu_memory_buffer_manager_.get(), | |
3230 NULL, | |
3231 0, | |
3232 false, | |
3233 1)); | |
3234 | 3149 |
3235 id = resource_provider->CreateResource( | 3150 id = resource_provider->CreateResource( |
3236 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3151 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3237 resource_provider->AcquirePixelBuffer(id); | 3152 resource_provider->AcquirePixelBuffer(id); |
3238 | 3153 |
3239 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3154 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3240 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3155 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
3241 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) | 3156 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) |
3242 .Times(1); | 3157 .Times(1); |
3243 resource_provider->BeginSetPixels(id); | 3158 resource_provider->BeginSetPixels(id); |
(...skipping 19 matching lines...) Expand all Loading... |
3263 FakeOutputSurfaceClient output_surface_client; | 3178 FakeOutputSurfaceClient output_surface_client; |
3264 scoped_ptr<OutputSurface> output_surface( | 3179 scoped_ptr<OutputSurface> output_surface( |
3265 FakeOutputSurface::Create3d(context_owned.Pass())); | 3180 FakeOutputSurface::Create3d(context_owned.Pass())); |
3266 CHECK(output_surface->BindToClient(&output_surface_client)); | 3181 CHECK(output_surface->BindToClient(&output_surface_client)); |
3267 | 3182 |
3268 gfx::Size size(2, 2); | 3183 gfx::Size size(2, 2); |
3269 ResourceFormat format = RGBA_8888; | 3184 ResourceFormat format = RGBA_8888; |
3270 ResourceProvider::ResourceId id = 0; | 3185 ResourceProvider::ResourceId id = 0; |
3271 int texture_id = 123; | 3186 int texture_id = 123; |
3272 | 3187 |
3273 scoped_ptr<ResourceProvider> resource_provider( | 3188 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3274 ResourceProvider::Create(output_surface.get(), | 3189 output_surface.get(), shared_bitmap_manager_.get(), |
3275 shared_bitmap_manager_.get(), | 3190 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
3276 gpu_memory_buffer_manager_.get(), | |
3277 NULL, | |
3278 0, | |
3279 false, | |
3280 1)); | |
3281 | 3191 |
3282 id = resource_provider->CreateResource( | 3192 id = resource_provider->CreateResource( |
3283 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3193 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3284 resource_provider->AcquirePixelBuffer(id); | 3194 resource_provider->AcquirePixelBuffer(id); |
3285 | 3195 |
3286 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3196 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3287 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3197 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
3288 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) | 3198 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) |
3289 .Times(1); | 3199 .Times(1); |
3290 resource_provider->BeginSetPixels(id); | 3200 resource_provider->BeginSetPixels(id); |
(...skipping 19 matching lines...) Expand all Loading... |
3310 FakeOutputSurfaceClient output_surface_client; | 3220 FakeOutputSurfaceClient output_surface_client; |
3311 scoped_ptr<OutputSurface> output_surface( | 3221 scoped_ptr<OutputSurface> output_surface( |
3312 FakeOutputSurface::Create3d(context_owned.Pass())); | 3222 FakeOutputSurface::Create3d(context_owned.Pass())); |
3313 CHECK(output_surface->BindToClient(&output_surface_client)); | 3223 CHECK(output_surface->BindToClient(&output_surface_client)); |
3314 | 3224 |
3315 gfx::Size size(2, 2); | 3225 gfx::Size size(2, 2); |
3316 ResourceFormat format = RGBA_8888; | 3226 ResourceFormat format = RGBA_8888; |
3317 ResourceProvider::ResourceId id = 0; | 3227 ResourceProvider::ResourceId id = 0; |
3318 int texture_id = 123; | 3228 int texture_id = 123; |
3319 | 3229 |
3320 scoped_ptr<ResourceProvider> resource_provider( | 3230 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3321 ResourceProvider::Create(output_surface.get(), | 3231 output_surface.get(), shared_bitmap_manager_.get(), |
3322 shared_bitmap_manager_.get(), | 3232 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
3323 gpu_memory_buffer_manager_.get(), | |
3324 NULL, | |
3325 0, | |
3326 false, | |
3327 1)); | |
3328 | 3233 |
3329 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); | 3234 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); |
3330 | 3235 |
3331 id = resource_provider->CreateResource( | 3236 id = resource_provider->CreateResource( |
3332 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3237 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3333 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 3238 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
3334 GL_INNOCENT_CONTEXT_RESET_ARB); | 3239 GL_INNOCENT_CONTEXT_RESET_ARB); |
3335 | 3240 |
3336 resource_provider->AcquirePixelBuffer(id); | 3241 resource_provider->AcquirePixelBuffer(id); |
3337 int stride; | 3242 int stride; |
(...skipping 17 matching lines...) Expand all Loading... |
3355 CHECK(output_surface->BindToClient(&output_surface_client)); | 3260 CHECK(output_surface->BindToClient(&output_surface_client)); |
3356 | 3261 |
3357 const int kWidth = 2; | 3262 const int kWidth = 2; |
3358 const int kHeight = 2; | 3263 const int kHeight = 2; |
3359 gfx::Size size(kWidth, kHeight); | 3264 gfx::Size size(kWidth, kHeight); |
3360 ResourceFormat format = RGBA_8888; | 3265 ResourceFormat format = RGBA_8888; |
3361 ResourceProvider::ResourceId id = 0; | 3266 ResourceProvider::ResourceId id = 0; |
3362 const unsigned kTextureId = 123u; | 3267 const unsigned kTextureId = 123u; |
3363 const unsigned kImageId = 234u; | 3268 const unsigned kImageId = 234u; |
3364 | 3269 |
3365 scoped_ptr<ResourceProvider> resource_provider( | 3270 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3366 ResourceProvider::Create(output_surface.get(), | 3271 output_surface.get(), shared_bitmap_manager_.get(), |
3367 shared_bitmap_manager_.get(), | 3272 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
3368 gpu_memory_buffer_manager_.get(), | |
3369 NULL, | |
3370 0, | |
3371 false, | |
3372 1)); | |
3373 | 3273 |
3374 id = resource_provider->CreateResource( | 3274 id = resource_provider->CreateResource( |
3375 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3275 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3376 | 3276 |
3377 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) | 3277 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) |
3378 .WillOnce(Return(kImageId)) | 3278 .WillOnce(Return(kImageId)) |
3379 .RetiresOnSaturation(); | 3279 .RetiresOnSaturation(); |
3380 { | 3280 { |
3381 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( | 3281 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( |
3382 resource_provider.get(), id); | 3282 resource_provider.get(), id); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3442 const int kWidth = 2; | 3342 const int kWidth = 2; |
3443 const int kHeight = 2; | 3343 const int kHeight = 2; |
3444 gfx::Size size(kWidth, kHeight); | 3344 gfx::Size size(kWidth, kHeight); |
3445 ResourceFormat format = RGBA_8888; | 3345 ResourceFormat format = RGBA_8888; |
3446 ResourceProvider::ResourceId source_id = 0; | 3346 ResourceProvider::ResourceId source_id = 0; |
3447 ResourceProvider::ResourceId dest_id = 0; | 3347 ResourceProvider::ResourceId dest_id = 0; |
3448 const unsigned kSourceTextureId = 123u; | 3348 const unsigned kSourceTextureId = 123u; |
3449 const unsigned kDestTextureId = 321u; | 3349 const unsigned kDestTextureId = 321u; |
3450 const unsigned kImageId = 234u; | 3350 const unsigned kImageId = 234u; |
3451 | 3351 |
3452 scoped_ptr<ResourceProvider> resource_provider( | 3352 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3453 ResourceProvider::Create(output_surface.get(), | 3353 output_surface.get(), shared_bitmap_manager_.get(), |
3454 shared_bitmap_manager_.get(), | 3354 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
3455 gpu_memory_buffer_manager_.get(), | |
3456 NULL, | |
3457 0, | |
3458 false, | |
3459 1)); | |
3460 | 3355 |
3461 source_id = resource_provider->CreateResource( | 3356 source_id = resource_provider->CreateResource( |
3462 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3357 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3463 | 3358 |
3464 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) | 3359 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) |
3465 .WillOnce(Return(kImageId)) | 3360 .WillOnce(Return(kImageId)) |
3466 .RetiresOnSaturation(); | 3361 .RetiresOnSaturation(); |
3467 { | 3362 { |
3468 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( | 3363 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( |
3469 resource_provider.get(), source_id); | 3364 resource_provider.get(), source_id); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3528 scoped_ptr<ContextSharedData> shared_data = ContextSharedData::Create(); | 3423 scoped_ptr<ContextSharedData> shared_data = ContextSharedData::Create(); |
3529 bool delegated_rendering = false; | 3424 bool delegated_rendering = false; |
3530 scoped_ptr<FakeOutputSurface> output_surface( | 3425 scoped_ptr<FakeOutputSurface> output_surface( |
3531 FakeOutputSurface::CreateDeferredGL( | 3426 FakeOutputSurface::CreateDeferredGL( |
3532 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice), | 3427 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice), |
3533 delegated_rendering)); | 3428 delegated_rendering)); |
3534 FakeOutputSurfaceClient client(output_surface.get()); | 3429 FakeOutputSurfaceClient client(output_surface.get()); |
3535 EXPECT_TRUE(output_surface->BindToClient(&client)); | 3430 EXPECT_TRUE(output_surface->BindToClient(&client)); |
3536 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 3431 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
3537 new TestSharedBitmapManager()); | 3432 new TestSharedBitmapManager()); |
3538 scoped_ptr<ResourceProvider> resource_provider( | 3433 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3539 ResourceProvider::Create(output_surface.get(), | 3434 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, |
3540 shared_bitmap_manager.get(), | 3435 false, 1)); |
3541 NULL, | |
3542 NULL, | |
3543 0, | |
3544 false, | |
3545 1)); | |
3546 | 3436 |
3547 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); | 3437 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); |
3548 | 3438 |
3549 InitializeGLAndCheck(shared_data.get(), | 3439 InitializeGLAndCheck(shared_data.get(), |
3550 resource_provider.get(), | 3440 resource_provider.get(), |
3551 output_surface.get()); | 3441 output_surface.get()); |
3552 | 3442 |
3553 resource_provider->InitializeSoftware(); | 3443 resource_provider->InitializeSoftware(); |
3554 output_surface->ReleaseGL(); | 3444 output_surface->ReleaseGL(); |
3555 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); | 3445 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); |
(...skipping 11 matching lines...) Expand all Loading... |
3567 new AllocationTrackingContext3D); | 3457 new AllocationTrackingContext3D); |
3568 AllocationTrackingContext3D* context = context_owned.get(); | 3458 AllocationTrackingContext3D* context = context_owned.get(); |
3569 context_owned->set_support_compressed_texture_etc1(true); | 3459 context_owned->set_support_compressed_texture_etc1(true); |
3570 | 3460 |
3571 FakeOutputSurfaceClient output_surface_client; | 3461 FakeOutputSurfaceClient output_surface_client; |
3572 scoped_ptr<OutputSurface> output_surface( | 3462 scoped_ptr<OutputSurface> output_surface( |
3573 FakeOutputSurface::Create3d(context_owned.Pass())); | 3463 FakeOutputSurface::Create3d(context_owned.Pass())); |
3574 CHECK(output_surface->BindToClient(&output_surface_client)); | 3464 CHECK(output_surface->BindToClient(&output_surface_client)); |
3575 | 3465 |
3576 gfx::Size size(4, 4); | 3466 gfx::Size size(4, 4); |
3577 scoped_ptr<ResourceProvider> resource_provider( | 3467 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3578 ResourceProvider::Create(output_surface.get(), | 3468 output_surface.get(), shared_bitmap_manager_.get(), |
3579 shared_bitmap_manager_.get(), | 3469 gpu_memory_buffer_manager_.get(), NULL, 0, false, false, 1)); |
3580 gpu_memory_buffer_manager_.get(), | |
3581 NULL, | |
3582 0, | |
3583 false, | |
3584 1)); | |
3585 int texture_id = 123; | 3470 int texture_id = 123; |
3586 | 3471 |
3587 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3472 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
3588 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); | 3473 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); |
3589 EXPECT_NE(0u, id); | 3474 EXPECT_NE(0u, id); |
3590 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3475 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3591 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3476 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
3592 resource_provider->AllocateForTesting(id); | 3477 resource_provider->AllocateForTesting(id); |
3593 | 3478 |
3594 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3479 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3684 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3569 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3685 resource_provider->AllocateForTesting(id); | 3570 resource_provider->AllocateForTesting(id); |
3686 Mock::VerifyAndClearExpectations(context); | 3571 Mock::VerifyAndClearExpectations(context); |
3687 | 3572 |
3688 DCHECK_EQ(2u, context->PeekTextureId()); | 3573 DCHECK_EQ(2u, context->PeekTextureId()); |
3689 resource_provider->DeleteResource(id); | 3574 resource_provider->DeleteResource(id); |
3690 } | 3575 } |
3691 | 3576 |
3692 { | 3577 { |
3693 size_t kTextureAllocationChunkSize = 8; | 3578 size_t kTextureAllocationChunkSize = 8; |
3694 scoped_ptr<ResourceProvider> resource_provider( | 3579 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3695 ResourceProvider::Create(output_surface.get(), | 3580 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, |
3696 shared_bitmap_manager.get(), | 3581 false, kTextureAllocationChunkSize)); |
3697 NULL, | |
3698 NULL, | |
3699 0, | |
3700 false, | |
3701 kTextureAllocationChunkSize)); | |
3702 | 3582 |
3703 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3583 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
3704 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3584 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3705 resource_provider->AllocateForTesting(id); | 3585 resource_provider->AllocateForTesting(id); |
3706 Mock::VerifyAndClearExpectations(context); | 3586 Mock::VerifyAndClearExpectations(context); |
3707 | 3587 |
3708 DCHECK_EQ(10u, context->PeekTextureId()); | 3588 DCHECK_EQ(10u, context->PeekTextureId()); |
3709 resource_provider->DeleteResource(id); | 3589 resource_provider->DeleteResource(id); |
3710 } | 3590 } |
3711 } | 3591 } |
3712 | 3592 |
3713 } // namespace | 3593 } // namespace |
3714 } // namespace cc | 3594 } // namespace cc |
OLD | NEW |