Skip to content

Commit

Permalink
Update SkFCI::SetGlobal to smart pointers.
Browse files Browse the repository at this point in the history
This updates SkFontConfigInterface::SetGlobal calls to use the smart
pointer version. This removes the awkward trailing ->unref and will
allow Skia to remove the old non-smart version of this method.

Change-Id: Icf67a1976820f5f0f07243ab1539e90e18db2ef4
Reviewed-on: https://chromium-review.googlesource.com/1058019
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Ben Wagner <bungeman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558712}
  • Loading branch information
bungeman authored and Commit Bot committed May 15, 2018
1 parent c41a36a commit 952c4e3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion content/app/content_main_runner_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ void PreSandboxInit() {
InitializeWebRtcModule();
#endif

SkFontConfigInterface::SetGlobal(new FontConfigIPC(GetSandboxFD()))->unref();
SkFontConfigInterface::SetGlobal(sk_make_sp<FontConfigIPC>(GetSandboxFD()));

// Set the android SkFontMgr for blink. We need to ensure this is done
// before the sandbox is initialized to allow the font manager to access
Expand Down
3 changes: 1 addition & 2 deletions content/gpu/gpu_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ int GpuMain(const MainFunctionParams& parameters) {
SkGraphics::Init();
#if defined(OS_LINUX)
// Set up the font IPC so that the GPU process can create typefaces.
SkFontConfigInterface::SetGlobal(new FontConfigIPC(GetSandboxFD()))
->unref();
SkFontConfigInterface::SetGlobal(sk_make_sp<FontConfigIPC>(GetSandboxFD()));
#endif
}

Expand Down
3 changes: 1 addition & 2 deletions content/renderer/renderer_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ int RendererMain(const MainFunctionParams& parameters) {
// This call could already have been made from zygote_main_linux.cc. However
// we need to do it here if Zygote is disabled.
if (process_command_line.HasSwitch(switches::kNoZygote)) {
SkFontConfigInterface::SetGlobal(new FontConfigIPC(GetSandboxFD()))
->unref();
SkFontConfigInterface::SetGlobal(sk_make_sp<FontConfigIPC>(GetSandboxFD()));
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion ui/views/mus/aura_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool AuraInit::Init(service_manager::Connector* connector,
// Initialize the skia font code to go ask fontconfig underneath.
#if defined(OS_LINUX)
font_loader_ = sk_make_sp<font_service::FontLoader>(connector);
SkFontConfigInterface::SetGlobal(font_loader_.get());
SkFontConfigInterface::SetGlobal(font_loader_);

// Initialize static default font, by running this now, before any other apps
// load, we ensure all the state is set up.
Expand Down

0 comments on commit 952c4e3

Please sign in to comment.