LaCrOS: Replace defined(OS_CHROMEOS) with BUILDFLAG(IS_ASH)
The change is mostly mechanical replacing defined(OS_CHROMEOS) with BUILDFLAG(IS_ASH) and GN variable is_chromeos with is_ash. Only the insertion of "//build:chromeos_buildflags" into appropriate deps in BUILD.gn is done semi-manualy. The change should not change the behaviour of any build. This is in preparation to switching lacros build from target_os=linux to target_os=chromeos so that lacros does not include any additional code due the switch. Please note that any new defined(OS_CHROMEOS) and is_chromeos introduced to should be consistent with the new meaning. Please refer to this short document http://go/lacros-replace-chromeos-macro-with-ash for full context. Bug: 1052397 Change-Id: Ic12afd68af4bb6b1eec07c66918db951eb08aab8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494281 Commit-Queue: Yuta Hijikata <ythjkt@chromium.org> Reviewed-by: Daniel Hosseinian <dhoss@chromium.org> Cr-Commit-Position: refs/heads/master@{#820531}
This commit is contained in:

committed by
Commit Bot

parent
3ec07e80f8
commit
6b9c17c815
@ -32,6 +32,7 @@ if (enable_pdf) {
|
||||
deps = [
|
||||
":internal",
|
||||
"//base",
|
||||
"//build:chromeos_buildflags",
|
||||
"//ui/gfx/geometry",
|
||||
]
|
||||
}
|
||||
@ -63,7 +64,10 @@ if (enable_pdf) {
|
||||
|
||||
public = [ "pdf_features.h" ]
|
||||
|
||||
deps = [ "//base" ]
|
||||
deps = [
|
||||
"//base",
|
||||
"//build:chromeos_buildflags",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("internal") {
|
||||
@ -143,6 +147,7 @@ if (enable_pdf) {
|
||||
":ppapi_migration",
|
||||
"//base",
|
||||
"//base:i18n",
|
||||
"//build:chromeos_buildflags",
|
||||
"//gin",
|
||||
"//net",
|
||||
"//pdf/pdfium/fuzzers",
|
||||
@ -232,6 +237,7 @@ if (enable_pdf) {
|
||||
":internal",
|
||||
":ppapi_migration",
|
||||
"//base",
|
||||
"//build:chromeos_buildflags",
|
||||
"//net",
|
||||
"//ppapi/cpp:objects",
|
||||
"//ppapi/cpp/private:internal_module",
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "net/base/escape.h"
|
||||
#include "net/base/filename_util.h"
|
||||
#include "pdf/accessibility.h"
|
||||
@ -1395,7 +1396,7 @@ void OutOfProcessInstance::SaveToBuffer(const std::string& token) {
|
||||
message.Set(kJSDataToSave, buffer);
|
||||
}
|
||||
} else {
|
||||
#if defined(OS_CHROMEOS)
|
||||
#if BUILDFLAG(IS_ASH)
|
||||
uint32_t length = engine()->GetLoadedByteSize();
|
||||
if (IsSaveDataSizeValid(length)) {
|
||||
pp::VarArrayBuffer buffer(length);
|
||||
@ -1405,7 +1406,7 @@ void OutOfProcessInstance::SaveToBuffer(const std::string& token) {
|
||||
}
|
||||
#else
|
||||
NOTREACHED();
|
||||
#endif
|
||||
#endif // BUILDFLAG(IS_ASH)
|
||||
}
|
||||
|
||||
PostMessage(message);
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "pdf/pdf_engine.h"
|
||||
#include "pdf/pdf_init.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
@ -35,13 +36,13 @@ class ScopedSdkInitializer {
|
||||
|
||||
} // namespace
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
#if BUILDFLAG(IS_ASH)
|
||||
std::vector<uint8_t> CreateFlattenedPdf(
|
||||
base::span<const uint8_t> input_buffer) {
|
||||
ScopedSdkInitializer scoped_sdk_initializer(/*enable_v8=*/false);
|
||||
return PDFEngineExports::Get()->CreateFlattenedPdf(input_buffer);
|
||||
}
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
#endif // BUILDFLAG(IS_ASH)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
bool RenderPDFPageToDC(base::span<const uint8_t> pdf_buffer,
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "base/optional.h"
|
||||
#include "base/values.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
@ -30,12 +31,12 @@ class SizeF;
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
#if BUILDFLAG(IS_ASH)
|
||||
// Create a flattened PDF document from an existing PDF document.
|
||||
// |input_buffer| is the buffer that contains the entire PDF document to be
|
||||
// flattened.
|
||||
std::vector<uint8_t> CreateFlattenedPdf(base::span<const uint8_t> input_buffer);
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
#endif // BUILDFLAG(IS_ASH)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Printing modes - type to convert PDF to for printing. See PDFium's
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "base/time/time.h"
|
||||
#include "base/values.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "pdf/document_layout.h"
|
||||
#include "ppapi/c/dev/pp_cursor_type_dev.h"
|
||||
#include "ppapi/c/dev/ppp_printing_dev.h"
|
||||
@ -534,11 +535,11 @@ class PDFEngineExports {
|
||||
|
||||
static PDFEngineExports* Get();
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
#if BUILDFLAG(IS_ASH)
|
||||
// See the definition of CreateFlattenedPdf in pdf.cc for details.
|
||||
virtual std::vector<uint8_t> CreateFlattenedPdf(
|
||||
base::span<const uint8_t> input_buffer) = 0;
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
#endif // BUILDFLAG(IS_ASH)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// See the definition of RenderPDFPageToDC in pdf.cc for details.
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "pdf/pdf_features.h"
|
||||
|
||||
#include "build/chromeos_buildflags.h"
|
||||
|
||||
namespace chrome_pdf {
|
||||
namespace features {
|
||||
|
||||
@ -27,11 +29,11 @@ const base::Feature kPDFViewerUpdate = {"PDFViewerUpdate",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
||||
const base::Feature kSaveEditedPDFForm = {"SaveEditedPDFForm",
|
||||
#if defined(OS_CHROMEOS)
|
||||
#if BUILDFLAG(IS_ASH)
|
||||
base::FEATURE_ENABLED_BY_DEFAULT
|
||||
#else
|
||||
base::FEATURE_DISABLED_BY_DEFAULT
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
#endif // BUILDFLAG(IS_ASH)
|
||||
};
|
||||
|
||||
const base::Feature kTabAcrossPDFAnnotations = {
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/optional.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "pdf/pdfium/pdfium_api_string_buffer_adapter.h"
|
||||
#include "pdf/pdfium/pdfium_mem_buffer_file_write.h"
|
||||
#include "pdf/pdfium/pdfium_print.h"
|
||||
@ -226,7 +227,7 @@ PDFiumEngineExports::PDFiumEngineExports() {}
|
||||
|
||||
PDFiumEngineExports::~PDFiumEngineExports() {}
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
#if BUILDFLAG(IS_ASH)
|
||||
std::vector<uint8_t> PDFiumEngineExports::CreateFlattenedPdf(
|
||||
base::span<const uint8_t> input_buffer) {
|
||||
ScopedFPDFDocument doc = LoadPdfData(input_buffer);
|
||||
@ -234,7 +235,7 @@ std::vector<uint8_t> PDFiumEngineExports::CreateFlattenedPdf(
|
||||
return std::vector<uint8_t>();
|
||||
return PDFiumPrint::CreateFlattenedPdf(std::move(doc));
|
||||
}
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
#endif // BUILDFLAG(IS_ASH)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
bool PDFiumEngineExports::RenderPDFPageToDC(
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "pdf/pdf_engine.h"
|
||||
|
||||
namespace chrome_pdf {
|
||||
@ -21,10 +22,10 @@ class PDFiumEngineExports : public PDFEngineExports {
|
||||
~PDFiumEngineExports() override;
|
||||
|
||||
// PDFEngineExports:
|
||||
#if defined(OS_CHROMEOS)
|
||||
#if BUILDFLAG(IS_ASH)
|
||||
std::vector<uint8_t> CreateFlattenedPdf(
|
||||
base::span<const uint8_t> input_buffer) override;
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
#endif // BUILDFLAG(IS_ASH)
|
||||
#if defined(OS_WIN)
|
||||
bool RenderPDFPageToDC(base::span<const uint8_t> pdf_buffer,
|
||||
int page_number,
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "pdf/pdf_transform.h"
|
||||
#include "pdf/pdfium/pdfium_engine.h"
|
||||
#include "pdf/pdfium/pdfium_mem_buffer_file_read.h"
|
||||
@ -271,14 +272,14 @@ PDFiumPrint::PDFiumPrint(PDFiumEngine* engine) : engine_(engine) {}
|
||||
|
||||
PDFiumPrint::~PDFiumPrint() = default;
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
#if BUILDFLAG(IS_ASH)
|
||||
// static
|
||||
std::vector<uint8_t> PDFiumPrint::CreateFlattenedPdf(ScopedFPDFDocument doc) {
|
||||
if (!FlattenPrintData(doc.get()))
|
||||
return std::vector<uint8_t>();
|
||||
return ConvertDocToBuffer(std::move(doc));
|
||||
}
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
#endif // BUILDFLAG(IS_ASH)
|
||||
|
||||
// static
|
||||
std::vector<uint32_t> PDFiumPrint::GetPageNumbersFromPrintPageNumberRange(
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "third_party/pdfium/public/cpp/fpdf_scopers.h"
|
||||
#include "third_party/pdfium/public/fpdfview.h"
|
||||
|
||||
@ -31,12 +32,12 @@ class PDFiumPrint {
|
||||
PDFiumPrint& operator=(const PDFiumPrint&) = delete;
|
||||
~PDFiumPrint();
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
#if BUILDFLAG(IS_ASH)
|
||||
// Flattens the |doc|.
|
||||
// On success, returns the flattened version of |doc| as a vector.
|
||||
// On failure, returns an empty vector.
|
||||
static std::vector<uint8_t> CreateFlattenedPdf(ScopedFPDFDocument doc);
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
#endif // BUILDFLAG(IS_ASH)
|
||||
|
||||
static std::vector<uint32_t> GetPageNumbersFromPrintPageNumberRange(
|
||||
const PP_PrintPageNumberRange_Dev* page_ranges,
|
||||
|
Reference in New Issue
Block a user