Skip to content

Commit

Permalink
Remove global USE_PANGO and USE_CAIRO defines.
Browse files Browse the repository at this point in the history
In gn files, only both were checked, so combine them to a single
use_pangocairo flag.

Also run
  ack -l skia::NativeDrawing printing/ | \
    xargs sed -i 's/skia::NativeDrawing/printing::NativeDrawing/g'
since NativeDrawingContext got moved from skia/ to printing/
a while ago.

No intended behavior change.

Bug: none
Change-Id: Iba0a205b0026164bf434b7ad0ed246eff1f2c6f8
Reviewed-on: https://chromium-review.googlesource.com/693159
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505905}
  • Loading branch information
nico authored and Commit Bot committed Oct 3, 2017
1 parent 83ddc54 commit 8e55956
Show file tree
Hide file tree
Showing 33 changed files with 80 additions and 73 deletions.
6 changes: 0 additions & 6 deletions build/config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ config("feature_flags") {
if (use_aura) {
defines += [ "USE_AURA=1" ]
}
if (use_pango) {
defines += [ "USE_PANGO=1" ]
}
if (use_cairo) {
defines += [ "USE_CAIRO=1" ]
}
if (use_glib) {
defines += [ "USE_GLIB=1" ]
}
Expand Down
25 changes: 17 additions & 8 deletions build/config/linux/pangocairo/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,24 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/buildflag_header.gni")
import("//build/config/linux/pangocairo/pangocairo.gni")
import("//build/config/linux/pkg_config.gni")

pkg_config("pangocairo") {
packages = [ "pangocairo" ]
if (use_pangocairo) {
pkg_config("pangocairo") {
packages = [ "pangocairo" ]

# We don't want pkgconfig for pangocairo to explicitly request FreeType to get
# linked, because we control which FreeType to link to.
extra_args = [
"-v",
"freetype",
]
# We don't want pkgconfig for pangocairo to explicitly request FreeType to get
# linked, because we control which FreeType to link to.
extra_args = [
"-v",
"freetype",
]
}
}

buildflag_header("features") {
header = "features.h"
flags = [ "USE_PANGOCAIRO=$use_pangocairo" ]
}
7 changes: 7 additions & 0 deletions build/config/linux/pangocairo/pangocairo.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/ui.gni")

use_pangocairo = is_linux && !use_ozone
8 changes: 0 additions & 8 deletions build/config/ui.gni
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ if (use_ozone) {
use_glib = false
}

if (is_linux && !use_ozone) {
use_cairo = true
use_pango = true
} else {
use_cairo = false
use_pango = false
}

# Whether to use atk, the Accessibility ToolKit library
use_atk = is_desktop_linux && use_x11
# =============================================
Expand Down
3 changes: 2 additions & 1 deletion chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import("//build/config/chrome_build.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/compiler/pgo/pgo.gni")
import("//build/config/features.gni")
import("//build/config/linux/pangocairo/pangocairo.gni")
import("//build/config/locales.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
Expand Down Expand Up @@ -284,7 +285,7 @@ if (!is_android && !is_mac) {
ldflags += [ "-Wl,--long-plt" ]
}

if (use_pango || use_cairo) {
if (use_pangocairo) {
# Needed for chrome_main.cc initialization of libraries.
configs += [ "//build/config/linux/pangocairo" ]
}
Expand Down
13 changes: 6 additions & 7 deletions content/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import("//build/buildflag_header.gni")
import("//build/config/features.gni")
import("//build/config/linux/pangocairo/pangocairo.gni")
import("//build/config/ui.gni")
import("//gpu/vulkan/features.gni")
import("//media/media_options.gni")
Expand Down Expand Up @@ -1882,8 +1883,6 @@ source_set("browser") {
"renderer_host/pepper/pepper_truetype_font_list_host.cc",
"renderer_host/pepper/pepper_truetype_font_list_host.h",
"renderer_host/pepper/pepper_truetype_font_list_mac.mm",
"renderer_host/pepper/pepper_truetype_font_list_ozone.cc",
"renderer_host/pepper/pepper_truetype_font_list_pango.cc",
"renderer_host/pepper/pepper_truetype_font_list_win.cc",
"renderer_host/pepper/pepper_truetype_font_mac.mm",
"renderer_host/pepper/pepper_truetype_font_win.cc",
Expand All @@ -1902,11 +1901,11 @@ source_set("browser") {
"//ppapi/proxy:ipc",
"//ppapi/shared_impl",
]
if (!use_ozone || use_pango) {
sources -= [ "renderer_host/pepper/pepper_truetype_font_list_ozone.cc" ]
if (use_ozone) {
sources += [ "renderer_host/pepper/pepper_truetype_font_list_ozone.cc" ]
}
if (!use_pango) {
sources -= [ "renderer_host/pepper/pepper_truetype_font_list_pango.cc" ]
if (use_pangocairo) {
sources += [ "renderer_host/pepper/pepper_truetype_font_list_pango.cc" ]
}
}

Expand Down Expand Up @@ -1939,7 +1938,7 @@ source_set("browser") {
deps += [ "//ui/gfx/x" ]
}

if (use_pango) {
if (use_pangocairo) {
configs += [ "//build/config/linux/pangocairo" ]
}

Expand Down
1 change: 1 addition & 0 deletions printing/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ component("printing") {
defines = [ "PRINTING_IMPLEMENTATION" ]

public_deps = [
"//build/config/linux/pangocairo:features",
"//printing/features",
]
deps = [
Expand Down
8 changes: 4 additions & 4 deletions printing/metafile.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ class PRINTING_EXPORT MetafilePlayer {
// back in the HDC. The trick is that it skip over the records known to have
// issue with some printers. See Emf::Record::SafePlayback implementation for
// details.
virtual bool SafePlayback(skia::NativeDrawingContext hdc) const = 0;
virtual bool SafePlayback(printing::NativeDrawingContext hdc) const = 0;

#elif defined(OS_MACOSX)
// Renders the given page into |rect| in the given context.
// Pages use a 1-based index. The rendering uses the arguments in
// |params| to determine scaling, translation, and rotation.
virtual bool RenderPage(unsigned int page_number,
skia::NativeDrawingContext context,
printing::NativeDrawingContext context,
const CGRect rect,
const MacRenderPageParams& params) const = 0;
#endif // if defined(OS_WIN)
Expand Down Expand Up @@ -144,7 +144,7 @@ class PRINTING_EXPORT Metafile : public MetafilePlayer {
virtual gfx::Rect GetPageBounds(unsigned int page_number) const = 0;
virtual unsigned int GetPageCount() const = 0;

virtual skia::NativeDrawingContext context() const = 0;
virtual printing::NativeDrawingContext context() const = 0;

#if defined(OS_WIN)
// "Plays" the EMF buffer in a HDC. It is the same effect as calling the
Expand All @@ -155,7 +155,7 @@ class PRINTING_EXPORT Metafile : public MetafilePlayer {
// functions, whether used directly or indirectly through precompiled EMF
// data. We have to accept the risk here. Since it is used only for printing,
// it requires user intervention.
virtual bool Playback(skia::NativeDrawingContext hdc,
virtual bool Playback(printing::NativeDrawingContext hdc,
const RECT* rect) const = 0;
#endif // OS_WIN

Expand Down
7 changes: 4 additions & 3 deletions printing/native_drawing_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
#define PRINTING_NATIVE_DRAWING_CONTEXT_H_

#include "build/build_config.h"
#include "build/config/linux/pangocairo/features.h"

#if defined(OS_WIN)
#include <windows.h>
#elif defined(USE_CAIRO)
#elif BUILDFLAG(USE_PANGOCAIRO)
typedef struct _cairo cairo_t;
#elif defined(OS_MACOSX)
typedef struct CGContext* CGContextRef;
#endif

namespace skia {
namespace printing {

#if defined(OS_WIN)
typedef HDC NativeDrawingContext;
#elif defined(USE_CAIRO)
#elif BUILDFLAG(USE_PANGOCAIRO)
typedef cairo_t* NativeDrawingContext;
#elif defined(OS_MACOSX)
typedef CGContextRef NativeDrawingContext;
Expand Down
2 changes: 1 addition & 1 deletion printing/pdf_metafile_cg_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class PRINTING_EXPORT PdfMetafileCg : public Metafile {
CGContextRef context() const override;

bool RenderPage(unsigned int page_number,
skia::NativeDrawingContext context,
printing::NativeDrawingContext context,
const CGRect rect,
const MacRenderPageParams& params) const override;

Expand Down
6 changes: 3 additions & 3 deletions printing/pdf_metafile_skia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,20 @@ unsigned int PdfMetafileSkia::GetPageCount() const {
return base::checked_cast<unsigned int>(data_->pages_.size());
}

skia::NativeDrawingContext PdfMetafileSkia::context() const {
printing::NativeDrawingContext PdfMetafileSkia::context() const {
NOTREACHED();
return nullptr;
}


#if defined(OS_WIN)
bool PdfMetafileSkia::Playback(skia::NativeDrawingContext hdc,
bool PdfMetafileSkia::Playback(printing::NativeDrawingContext hdc,
const RECT* rect) const {
NOTREACHED();
return false;
}

bool PdfMetafileSkia::SafePlayback(skia::NativeDrawingContext hdc) const {
bool PdfMetafileSkia::SafePlayback(printing::NativeDrawingContext hdc) const {
NOTREACHED();
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions printing/pdf_metafile_skia.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ class PRINTING_EXPORT PdfMetafileSkia : public Metafile {
gfx::Rect GetPageBounds(unsigned int page_number) const override;
unsigned int GetPageCount() const override;

skia::NativeDrawingContext context() const override;
printing::NativeDrawingContext context() const override;

#if defined(OS_WIN)
bool Playback(skia::NativeDrawingContext hdc,
bool Playback(printing::NativeDrawingContext hdc,
const RECT* rect) const override;
bool SafePlayback(skia::NativeDrawingContext hdc) const override;
bool SafePlayback(printing::NativeDrawingContext hdc) const override;
#elif defined(OS_MACOSX)
bool RenderPage(unsigned int page_number,
skia::NativeDrawingContext context,
printing::NativeDrawingContext context,
const CGRect rect,
const MacRenderPageParams& params) const override;
#endif
Expand Down
2 changes: 1 addition & 1 deletion printing/printed_document.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class PRINTING_EXPORT PrintedDocument
// Note: locks for a short amount of time in debug only.
#if defined(OS_WIN) || defined(OS_MACOSX) && !defined(USE_AURA)
void RenderPrintedPage(const PrintedPage& page,
skia::NativeDrawingContext context) const;
printing::NativeDrawingContext context) const;
#elif defined(OS_POSIX)
void RenderPrintedPage(const PrintedPage& page,
PrintingContext* context) const;
Expand Down
2 changes: 1 addition & 1 deletion printing/printed_document_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace printing {

void PrintedDocument::RenderPrintedPage(
const PrintedPage& page,
skia::NativeDrawingContext context) const {
printing::NativeDrawingContext context) const {
#ifndef NDEBUG
{
// Make sure the page is from our list.
Expand Down
2 changes: 1 addition & 1 deletion printing/printed_document_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace printing {

void PrintedDocument::RenderPrintedPage(
const PrintedPage& page,
skia::NativeDrawingContext context) const {
printing::NativeDrawingContext context) const {
#ifndef NDEBUG
{
// Make sure the page is from our list.
Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class PRINTING_EXPORT PrintingContext {
virtual void ReleaseContext() = 0;

// Returns the native context used to print.
virtual skia::NativeDrawingContext context() const = 0;
virtual printing::NativeDrawingContext context() const = 0;

// Creates an instance of this object. Implementers of this interface should
// implement this method to create an object of their implementation.
Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void PrintingContextAndroid::ReleaseContext() {
// Intentional No-op.
}

skia::NativeDrawingContext PrintingContextAndroid::context() const {
printing::NativeDrawingContext PrintingContextAndroid::context() const {
// Intentional No-op.
return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
skia::NativeDrawingContext context() const override;
printing::NativeDrawingContext context() const override;

private:
base::android::ScopedJavaGlobalRef<jobject> j_printing_context_;
Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void PrintingContextChromeos::ReleaseContext() {
printer_.reset();
}

skia::NativeDrawingContext PrintingContextChromeos::context() const {
printing::NativeDrawingContext PrintingContextChromeos::context() const {
// Intentional No-op.
return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_chromeos.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PRINTING_EXPORT PrintingContextChromeos : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
skia::NativeDrawingContext context() const override;
printing::NativeDrawingContext context() const override;

Result StreamData(const std::vector<char>& buffer);

Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void PrintingContextLinux::ReleaseContext() {
// Intentional No-op.
}

skia::NativeDrawingContext PrintingContextLinux::context() const {
printing::NativeDrawingContext PrintingContextLinux::context() const {
// Intentional No-op.
return NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PRINTING_EXPORT PrintingContextLinux : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
skia::NativeDrawingContext context() const override;
printing::NativeDrawingContext context() const override;

private:
base::string16 document_name_;
Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PRINTING_EXPORT PrintingContextMac : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
skia::NativeDrawingContext context() const override;
printing::NativeDrawingContext context() const override;

private:
// Initializes PrintSettings from |print_info_|. This must be called
Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ PMPaper MatchPaper(CFArrayRef paper_list,
context_ = NULL;
}

skia::NativeDrawingContext PrintingContextMac::context() const {
printing::NativeDrawingContext PrintingContextMac::context() const {
return context_;
}

Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_no_system_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void PrintingContextNoSystemDialog::ReleaseContext() {
// Intentional No-op.
}

skia::NativeDrawingContext PrintingContextNoSystemDialog::context() const {
printing::NativeDrawingContext PrintingContextNoSystemDialog::context() const {
// Intentional No-op.
return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_no_system_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PRINTING_EXPORT PrintingContextNoSystemDialog : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
skia::NativeDrawingContext context() const override;
printing::NativeDrawingContext context() const override;

private:
DISALLOW_COPY_AND_ASSIGN(PrintingContextNoSystemDialog);
Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ void PrintingContextWin::ReleaseContext() {
}
}

skia::NativeDrawingContext PrintingContextWin::context() const {
printing::NativeDrawingContext PrintingContextWin::context() const {
return context_;
}

Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PRINTING_EXPORT PrintingContextWin : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
skia::NativeDrawingContext context() const override;
printing::NativeDrawingContext context() const override;

protected:
static HWND GetRootWindow(gfx::NativeView view);
Expand Down
Loading

0 comments on commit 8e55956

Please sign in to comment.