Commit 4e4f645e authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Do less initialization in PdfCompositorImpl ctor.

Currently it initializes some DirectWrite code on Windows in unit tests
that is only intended to be called once per process, whereas
PdfCompositorImplTest constructs multiple PdfCompositorImpl objects and
ends up calling that repeatedly, which then fails. Avoid doing this, as
the DirectWrite code is not needed in the test.

Bug: 1002663
Change-Id: I741690466d3111f0095a070bd64f39ebfb835804
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1797225Reviewed-by: default avatarWei Li <weili@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695669}
parent d67795f4
...@@ -46,6 +46,9 @@ PdfCompositorImpl::PdfCompositorImpl( ...@@ -46,6 +46,9 @@ PdfCompositorImpl::PdfCompositorImpl(
if (receiver) if (receiver)
receiver_.Bind(std::move(receiver)); receiver_.Bind(std::move(receiver));
if (!initialize_environment)
return;
#if defined(OS_WIN) #if defined(OS_WIN)
// Initialize direct write font proxy so skia can use it. // Initialize direct write font proxy so skia can use it.
content::InitializeDWriteFontProxy(); content::InitializeDWriteFontProxy();
...@@ -55,9 +58,6 @@ PdfCompositorImpl::PdfCompositorImpl( ...@@ -55,9 +58,6 @@ PdfCompositorImpl::PdfCompositorImpl(
SkGraphics::SetImageGeneratorFromEncodedDataFactory( SkGraphics::SetImageGeneratorFromEncodedDataFactory(
blink::WebImageGenerator::CreateAsSkImageGenerator); blink::WebImageGenerator::CreateAsSkImageGenerator);
if (!initialize_environment)
return;
#if defined(OS_POSIX) && !defined(OS_ANDROID) #if defined(OS_POSIX) && !defined(OS_ANDROID)
content::UtilityThread::Get()->EnsureBlinkInitializedWithSandboxSupport(); content::UtilityThread::Get()->EnsureBlinkInitializedWithSandboxSupport();
// Check that we have sandbox support on this platform. // Check that we have sandbox support on this platform.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment