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

Side by Side Diff: content/browser/gpu/gpu_ipc_browsertests.cc

Issue 1862693002: Replace skia::RefPtr with sk_sp<> in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unget Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 8 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
9 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 9 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
10 #include "content/common/gpu/client/context_provider_command_buffer.h" 10 #include "content/common/gpu/client/context_provider_command_buffer.h"
11 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 11 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
12 #include "content/common/gpu_process_launch_causes.h" 12 #include "content/common/gpu_process_launch_causes.h"
13 #include "content/public/browser/gpu_data_manager.h" 13 #include "content/public/browser/gpu_data_manager.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/public/test/content_browser_test.h" 15 #include "content/public/test/content_browser_test.h"
16 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" 16 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h"
17 #include "skia/ext/refptr.h"
18 #include "third_party/skia/include/core/SkCanvas.h" 17 #include "third_party/skia/include/core/SkCanvas.h"
19 #include "third_party/skia/include/core/SkPaint.h" 18 #include "third_party/skia/include/core/SkPaint.h"
20 #include "third_party/skia/include/core/SkSurface.h" 19 #include "third_party/skia/include/core/SkSurface.h"
21 #include "third_party/skia/include/gpu/GrContext.h" 20 #include "third_party/skia/include/gpu/GrContext.h"
22 #include "ui/gl/gl_switches.h" 21 #include "ui/gl/gl_switches.h"
23 22
24 namespace { 23 namespace {
25 24
26 using content::WebGraphicsContext3DCommandBufferImpl; 25 using content::WebGraphicsContext3DCommandBufferImpl;
27 26
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 DCHECK(!IsChannelEstablished()); 226 DCHECK(!IsChannelEstablished());
228 EstablishAndWait(); 227 EstablishAndWait();
229 228
230 // Step 2: verify that holding onto the provider's GrContext will 229 // Step 2: verify that holding onto the provider's GrContext will
231 // retain the host after provider is destroyed. 230 // retain the host after provider is destroyed.
232 scoped_refptr<ContextProviderCommandBuffer> provider = 231 scoped_refptr<ContextProviderCommandBuffer> provider =
233 ContextProviderCommandBuffer::Create(CreateContext(GetGpuChannel()), 232 ContextProviderCommandBuffer::Create(CreateContext(GetGpuChannel()),
234 OFFSCREEN_CONTEXT_FOR_TESTING); 233 OFFSCREEN_CONTEXT_FOR_TESTING);
235 EXPECT_TRUE(provider->BindToCurrentThread()); 234 EXPECT_TRUE(provider->BindToCurrentThread());
236 235
237 skia::RefPtr<GrContext> gr_context = skia::SharePtr(provider->GrContext()); 236 sk_sp<GrContext> gr_context = sk_ref_sp(provider->GrContext());
238 237
239 SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100); 238 SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
240 sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget( 239 sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget(
241 gr_context.get(), SkBudgeted::kNo, info); 240 gr_context.get(), SkBudgeted::kNo, info);
242 EXPECT_TRUE(surface); 241 EXPECT_TRUE(surface);
243 242
244 // Destroy the GL context after we made a surface. 243 // Destroy the GL context after we made a surface.
245 provider = nullptr; 244 provider = nullptr;
246 245
247 // New surfaces will fail to create now. 246 // New surfaces will fail to create now.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 shim->SimulateCrash(); 291 shim->SimulateCrash();
293 run_loop.Run(); 292 run_loop.Run();
294 293
295 EXPECT_EQ(1, counter); 294 EXPECT_EQ(1, counter);
296 EXPECT_FALSE(IsChannelEstablished()); 295 EXPECT_FALSE(IsChannelEstablished());
297 EstablishAndWait(); 296 EstablishAndWait();
298 EXPECT_TRUE(IsChannelEstablished()); 297 EXPECT_TRUE(IsChannelEstablished());
299 } 298 }
300 299
301 } // namespace content 300 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/surface_utils.cc ('k') | content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698