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

Unified Diff: cc/resources/resource_provider_unittest.cc

Issue 609663003: cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cc-passas: PassAs-presubmit-warning Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/task_graph_runner_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider_unittest.cc
diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc
index e1fd05433c397afa12ba9d00928025f180a216cd..04d88c6cdee55ae47ce44f027961cc61c55da95b 100644
--- a/cc/resources/resource_provider_unittest.cc
+++ b/cc/resources/resource_provider_unittest.cc
@@ -389,16 +389,15 @@ class ResourceProviderTest
context3d_ = context3d.get();
scoped_refptr<TestContextProvider> context_provider =
- TestContextProvider::Create(
- context3d.PassAs<TestWebGraphicsContext3D>());
+ TestContextProvider::Create(context3d.Pass());
output_surface_ = FakeOutputSurface::Create3d(context_provider);
scoped_ptr<ResourceProviderContext> child_context_owned =
ResourceProviderContext::Create(shared_data_.get());
child_context_ = child_context_owned.get();
- child_output_surface_ = FakeOutputSurface::Create3d(
- child_context_owned.PassAs<TestWebGraphicsContext3D>());
+ child_output_surface_ =
+ FakeOutputSurface::Create3d(child_context_owned.Pass());
break;
}
case ResourceProvider::Bitmap:
@@ -1153,8 +1152,8 @@ TEST_P(ResourceProviderTest, TransferGLToSoftware) {
ResourceProviderContext::Create(shared_data_.get()));
FakeOutputSurfaceClient child_output_surface_client;
- scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d(
- child_context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> child_output_surface(
+ FakeOutputSurface::Create3d(child_context_owned.Pass()));
CHECK(child_output_surface->BindToClient(&child_output_surface_client));
scoped_ptr<ResourceProvider> child_resource_provider(
@@ -1456,7 +1455,7 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) {
// Destroy the parent resource provider. The resource that's left should be
// lost at this point, and returned.
- resource_provider_.reset();
+ resource_provider_ = nullptr;
ASSERT_EQ(1u, returned_to_child.size());
if (GetParam() == ResourceProvider::GLTexture) {
EXPECT_NE(0u, returned_to_child[0].sync_point);
@@ -1633,8 +1632,8 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest {
TextureStateTrackingContext* child_context = child_context_owned.get();
FakeOutputSurfaceClient child_output_surface_client;
- scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d(
- child_context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> child_output_surface(
+ FakeOutputSurface::Create3d(child_context_owned.Pass()));
CHECK(child_output_surface->BindToClient(&child_output_surface_client));
scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
new TestSharedBitmapManager());
@@ -1653,8 +1652,8 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest {
TextureStateTrackingContext* parent_context = parent_context_owned.get();
FakeOutputSurfaceClient parent_output_surface_client;
- scoped_ptr<OutputSurface> parent_output_surface(FakeOutputSurface::Create3d(
- parent_context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> parent_output_surface(
+ FakeOutputSurface::Create3d(parent_context_owned.Pass()));
CHECK(parent_output_surface->BindToClient(&parent_output_surface_client));
scoped_ptr<ResourceProvider> parent_resource_provider(
@@ -2205,7 +2204,7 @@ TEST_P(ResourceProviderTest, Shutdown) {
EXPECT_EQ(0u, release_sync_point);
EXPECT_FALSE(lost_resource);
- child_resource_provider_.reset();
+ child_resource_provider_ = nullptr;
if (GetParam() == ResourceProvider::GLTexture) {
EXPECT_LE(sync_point, release_sync_point);
@@ -2232,7 +2231,7 @@ TEST_P(ResourceProviderTest, ShutdownWithExportedResource) {
EXPECT_EQ(0u, release_sync_point);
EXPECT_FALSE(lost_resource);
- child_resource_provider_.reset();
+ child_resource_provider_ = nullptr;
// Since the resource is in the parent, the child considers it lost.
EXPECT_EQ(0u, release_sync_point);
@@ -2268,7 +2267,7 @@ TEST_P(ResourceProviderTest, LostContext) {
EXPECT_EQ(NULL, main_thread_task_runner);
resource_provider_->DidLoseOutputSurface();
- resource_provider_.reset();
+ resource_provider_ = nullptr;
EXPECT_LE(sync_point, release_sync_point);
EXPECT_TRUE(lost_resource);
@@ -2285,8 +2284,8 @@ TEST_P(ResourceProviderTest, ScopedSampler) {
TextureStateTrackingContext* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
@@ -2372,8 +2371,8 @@ TEST_P(ResourceProviderTest, ManagedResource) {
TextureStateTrackingContext* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
@@ -2427,8 +2426,8 @@ TEST_P(ResourceProviderTest, TextureWrapMode) {
TextureStateTrackingContext* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
@@ -2486,8 +2485,8 @@ TEST_P(ResourceProviderTest, TextureHint) {
context->set_support_texture_usage(true);
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
@@ -2611,8 +2610,8 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D) {
TextureStateTrackingContext* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
@@ -2696,8 +2695,8 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) {
TextureStateTrackingContext* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
@@ -2771,8 +2770,8 @@ TEST_P(ResourceProviderTest,
TextureStateTrackingContext* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
@@ -2830,8 +2829,8 @@ TEST_P(ResourceProviderTest, TextureMailbox_WaitSyncPointIfNeeded_NoSyncPoint) {
TextureStateTrackingContext* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
@@ -2958,8 +2957,8 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
AllocationTrackingContext3D* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
@@ -3038,8 +3037,8 @@ TEST_P(ResourceProviderTest, TextureAllocationHint) {
context->set_support_texture_usage(true);
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
@@ -3098,8 +3097,8 @@ TEST_P(ResourceProviderTest, TextureAllocationHint_BGRA) {
context->set_support_texture_usage(true);
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
@@ -3152,8 +3151,8 @@ TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) {
AllocationTrackingContext3D* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
gfx::Size size(2, 2);
@@ -3199,8 +3198,8 @@ TEST_P(ResourceProviderTest, ForcingAsyncUploadToComplete) {
AllocationTrackingContext3D* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
gfx::Size size(2, 2);
@@ -3246,8 +3245,8 @@ TEST_P(ResourceProviderTest, PixelBufferLostContext) {
AllocationTrackingContext3D* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
gfx::Size size(2, 2);
@@ -3288,8 +3287,8 @@ TEST_P(ResourceProviderTest, Image_GLTexture) {
AllocationTrackingContext3D* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
const int kWidth = 2;
@@ -3398,8 +3397,8 @@ TEST_P(ResourceProviderTest, CopyResource_GLTexture) {
context_owned->set_support_sync_query(true);
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
ASSERT_TRUE(output_surface->BindToClient(&output_surface_client));
const int kWidth = 2;
@@ -3490,8 +3489,7 @@ void InitializeGLAndCheck(ContextSharedData* shared_data,
ResourceProviderContext* context = context_owned.get();
scoped_refptr<TestContextProvider> context_provider =
- TestContextProvider::Create(
- context_owned.PassAs<TestWebGraphicsContext3D>());
+ TestContextProvider::Create(context_owned.Pass());
output_surface->InitializeAndSetContext3d(context_provider);
resource_provider->InitializeGL();
@@ -3543,8 +3541,8 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) {
context_owned->set_support_compressed_texture_etc1(true);
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
gfx::Size size(4, 4);
@@ -3579,8 +3577,8 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1SetPixels) {
context_owned->set_support_compressed_texture_etc1(true);
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
gfx::Size size(4, 4);
@@ -3634,8 +3632,8 @@ TEST(ResourceProviderTest, TextureAllocationChunkSize) {
TextureIdAllocationTrackingContext* context = context_owned.get();
FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- context_owned.PassAs<TestWebGraphicsContext3D>()));
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(context_owned.Pass()));
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
new TestSharedBitmapManager());
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/task_graph_runner_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698