1094 Commits

Author SHA1 Message Date
Tom Sepez
882b7bf236 Add pdf_enable_rust_bmp GN argument and preprocessor macro
Declare the pdf_enable_rust_bmp build argument, its override
pdf_enable_rust_bmp_override, and define the PDF_ENABLE_RUST_BMP
preprocessor macro when pdf_use_skia && pdf_enable_rust_bmp is active.

This allows external build recipes to configure the GN argument prior to
activating the Rust-based BMP decoder in a follow-up change.

TAG=agy
CONV=f457c92a-036e-44c5-89eb-1caaf0d672f5

Bug: 537855738
Change-Id: Ia44c2b798b5c26cac89a8025b83d8244e1978655
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/152810
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2026-07-22 18:05:56 -07:00
Lei Zhang
0be884dffc Remove -Wc++11-narrowing build rule
This rule got added in 2020 when Chromium's //build still had
-Wno-c++11-narrowing by default. After that, crrev.com/896310 removed
-Wno-c++11-narrowing from Chromium's build rules. As such,
-Wc++11-narrowing is on by default, so there is no need to explicitly
specify it anymore. Similarly, remove -Wnarrowing for non-Clang
compilers.

Change-Id: I5070bdfa5d2e70b3fcb9244c21586f3b60e7db9a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/151471
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2026-07-01 18:06:09 -07:00
Lei Zhang
d904b6b89f Turn on -Wctad-maybe-unsupported
Add deduction guides for ScopedSetInsertion, ZipView2 and ZipView3 to
explicitly opt into supporting use of CTAD and fix the build errors
generated by this extra warning.

Change-Id: Ia6ecb42d871a9c0163764c77a5a087e1e77c4083
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/151430
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2026-07-01 17:09:51 -07:00
Tom Sepez
12159a27cd Add -Wlifetime-safety-permissive flag and fix CPDF_DIB lifetime warning.
Enable the -Wlifetime-safety-permissive compiler flag to enforce
lifetime safety checks.

Fix a lifetime issue in CPDF_DIB::GetScanline where a pointer to a
local temporary buffer could be returned when the stream is truncated.
The temporary buffer is replaced with a class member buffer.

The code path returning the temporary buffer is believed to be
dynamically unreachable. It requires a JPX image with less than 3
channels to trigger a width mismatch, but such images are forced to
the DeviceGray color space, which routes differently.

TAG=agy
CONV=35e67fbe-02d2-429f-9dbd-5e7fa8e5e9b6

Fixed: 526724013
Change-Id: I660ef01bdc7bc98a60eb0c1fb884062a824f943e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/150450
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2026-06-22 16:05:22 -07:00
Aryan Krishnan
2ae413aca5 Add simple tests for Brotli compression
This CL adds test based on brotli-stream compressed PDF files and
updates the needed BUILD files to be able to allow for Brotli
compression to be tested when the feature is built. These test files are
based on existing files with a compressed stream using brotli and
ASCII85 decode to prevent the stream from just being a binary blob.

Bug: 475855993
Change-Id: I8162dd98885cf6e75bfe8b5d82f61d7d4252bea1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/148230
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2026-06-10 14:51:27 -07:00
Tom Sepez
78cd1a2947 Make PDF_ENABLE_SKIA_TYPEFACE_CHECKS a GN build argument.
Currently, no builds should set this, but allow development to
continue making these checks.

Change-Id: Iba0b507393ca5a0a2ec6f90aedd82adfb8ecb182
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/148192
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2026-05-20 17:06:29 -07:00
Tom Sepez
4d0eb4d4c4 Introduce pdf_use_agg GN build argument.
Allow building a theoretically skia-only platform without AGG fallback.

Fixed: 485984630
Change-Id: I1a85e5e6ea8a3e4bf395e10d7e16e06dc35cc8c4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/143670
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2026-02-23 14:48:18 -08:00
Lei Zhang
d9b42e4276 Fix Skia-enabled pdfium_embeddertests builds in Chromium
Skia needs a DiscardableMemoryAllocator and pdfium_embeddertests built
in Chromium checkouts do not have one. Refactor pdfium_test's
DiscardableMemoryAllocator support code from CL [1] to support
pdfium_embeddertests as well.

[1] https://pdfium-review.googlesource.com/103474

Change-Id: I21ea4adf4312cb451a0b629cae3f78cde0c73d9e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/143270
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2026-02-18 12:30:39 -08:00
Andy Phan
97ffcdba4a Move MaxPixelPerChannelDelta() to testing util file
Relocate MaxPixelPerChannelDelta() and its helpers from image_diff.cpp
to a new utility file. Then, update the parameters so that callers do
not need to know about the UnpackedPixel struct.

This method will be reused in
https://pdfium-review.googlesource.com/c/pdfium/+/141472.

Bug: 468228360
Change-Id: I8f37a68527efc15f712c68286e864cf1a25be536
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/141471
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Andy Phan <andyphan@chromium.org>
2026-01-23 17:31:16 -08:00
Lei Zhang
01a17c1cee Turn off more raw-ptr bits when pdf_use_partition_alloc=false
This fixes then new "no_partition_alloc" bots, which are doing debug
builds when they hit a UNOWNED_PTR_EXCLUSION error. Previous attempts to
fix the no-PA build were release builds, so the error did not occur.

Bug: 469000730
Change-Id: Ie4e52fc2b969d3f0a196805211f8c54c7030645b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/139991
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2025-12-17 14:31:34 -08:00
Lukasz Anforowicz
a1229deddf [rust png] Fix handling of discard_transparency in EncodeBGRAPNG.
https://pdfium-review.googlesource.com/c/pdfium/+/136570 has landed an
implementation of `EncodeBGRAPNG` that ignores `discard_transparency`.
This behavior was different from the old, `libpng`-based implementation
as shown by the new `EncodeBGRAPNGAndDiscardTransparency` test where
the last assertion (`EXPECT_EQ(rgba_output[3], 255)`) would pass with
`libpng`-based implementation but (before this CL) fail with the
Rust-based implementation.

Bug: 444045690
Change-Id: Ifa894e36ab0f568aeea8a4421bc8ed9010f23d6b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/138891
Auto-Submit: Łukasz Anforowicz <lukasza@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2025-12-03 14:35:49 -08:00
Lukasz Anforowicz
ab7e415be9 [rust png] Use Rust-based PNG codec from PDFium tests.
After this CL, if `pdf_enable_rust_png` GN arg is set, then PDFium tests
will use Rust-based PNG codec (instead of `libpng`-based one) from
`pdfium/testing/helpers/write.cc` and from
`testing/image_diff/image_diff_png...`.

Switching the production code underneath `core/fxcodec/png/...` is
deferred to a future CL (see
https://pdfium-review.googlesource.com/135730).

CLs that demonstrate test coverage of PDFium CQ:

- https://pdfium-review.googlesource.com/136111 - is an ad-hoc,
  non-landable CL, which replaces `SkPngEncoder` usage in `write.cc`with
  `NOTREACHED` to discover which tests cover it.  All tests pass in this
  CL (i.e. this path is not covered by CQ).
- https://pdfium-review.googlesource.com/136392 is a similar CL for
  encoding/decoding path under `testing/image_diff/...` (there are a few
  failing tests)
- https://pdfium-review.googlesource.com/136110 is a similar CL for
  decoding path under `core/fxcodec/png/...` (there are a few failing
  tests)

Bug: 444045690
Change-Id: Ica54e6e82d5646267242fd0a6d6538389bd18deb
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/135630
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@google.com>
2025-10-13 14:05:49 -07:00
Junji Watanabe
d67b1b1055 Support Siso builds
This CL adds Siso build supports:
- Install Siso CIPD package.
- Generate //build/config/siso/.sisoenv file via DEPS hook.
- Generate `gn_logs.txt` GN logs.

Bug: 420355454
Change-Id: I6dd33ff12ba29167b00efbbe28712eec8527cc13
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/132390
Auto-Submit: Junji Watanabe <jwata@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2025-05-28 09:57:44 -07:00
Tom Sepez
97aaf8bda2 Remove the /wd defines from BUILD.gn
Simplify our build files in the absence of MSVC support.

Bug: 389951208
Change-Id: I0290301a2adb09fa0bc7354f124f064477848db4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/128350
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2025-02-03 16:23:56 -08:00
Tom Sepez
da206beb23 Make PDFium's compiler_specific.h use clang's UNSAFE_BUFFERS_BUILD
This symbol is defined consistently in build/config/clang/BUILD.gn
and is a better source of truth than the old PDFium symbol.

This allows the UNSAFE_BUFFERS macro to be correctly defined even
outside of pdfium_common_config, such as for fuzzers and testing.

Change-Id: I5f15147e8eeb28104323b5a58f09707a8df6de7e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/127730
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2025-01-08 16:58:55 -08:00
Lei Zhang
efabef6509 Stop passing -Wdeprecated-copy
It should already be included via -Wextra.

Bug: 42050286
Change-Id: I21c0448e1d665e818bb1d8318cb09ea8a9810a83
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/123690
Reviewed-by: Tom Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
2024-08-20 23:14:51 +00:00
Lei Zhang
5b453aa55b Import Fontations build rules
Import the Fontations build rules from Chromium's //skia/BUILD.gn into
PDFium's. The build rules are gated behind the `pdf_enable_fontations`
GN arg, similar to how Fontations was first introduced into Chromium.

Bug: 42271123
Change-Id: Ifd632dd928ace32883c27f17d2826e1007dfd3ec
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/121353
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2024-07-02 15:15:46 +00:00
Lei Zhang
063859bd15 Build Fontations dependencies
Take a step towards building Fontations by building some of its Rust
dependencies.

- Check out third_party/rust to make those dependencies available.
- Rename some rust variables in DEPS to make them clearer.

Bug: 42271123
Change-Id: Ia34dc4a720a04bd12abd6e0f9c523d8ebf909c7b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/121250
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
2024-06-28 16:54:58 +00:00
Takashi Sakamoto
6b9d58ea14 [clang-plugin] Use -plugin-arg-raw-ptr-plugin for raw-ptr check.
To move raw-ptr check from find-bad-construct plugin to raw-ptr plugin,
replace -plugin-arg-find-bad-constructs with -plugin-arg-raw-ptr-plugin.

Bug: 40945579
Change-Id: If7803c47616afb508f7ef08d4d332194ed05b112
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/120910
Reviewed-by: Thomas Sepez <tsepez@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Thomas Sepez <tsepez@google.com>
2024-06-24 17:28:22 +00:00
Tom Sepez
7c7b4c704a Move pdfium_test.cc from samples/ to testing/
Allow future use of non-public APIs in the test programs. Also,
this has become far too complex to serve as a useful sample.

Fixed: pdfium:1895
Change-Id: I8ff3113a4aebbaf24d1cbcc46746c37436f46dbb
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/118911
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2024-05-09 07:21:41 +00:00
Tom Sepez
f0dc864fb1 Put plugin-specific logic in pdfium_common_config.
Define a symbol indicating it is present, and then use it to
condition plugin-specific definitions so as to avoid breaking
(future) builds against off-the-shelf clang compilers, as
plugin-only #pragma syntax may be added.

Change-Id: Ia485f9ed56705f2bf9506c9ba868b6b4515aca52
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/118273
Reviewed-by: Thomas Sepez <tsepez@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2024-04-10 01:01:47 +00:00
Tom Sepez
11f9c86740 Enable UNOWNED_PTR_EXCLUSION checks for debug builds only.
Clang's inability to optimize out some redundant CHECK()s was noticed
while working on an unrelated CL. This is caused by the issue noted in
crbug.com/40836910, where __attribute__((annotate()) changed code gen
as a side effect of placating warnings in the plugin.

Bug: chromium:40836910
Change-Id: Idde4cecd3c329c4c7bac728d5c376a4574cd8f77
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/117550
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
2024-03-16 01:55:56 +00:00
Tom Sepez
b214b50e4e Adjust BUILD.gn files for path-based unsafe buffer warnings.
Prepare for using the clang plugin-based filtering mechanism for
unsafe buffer warnings. This is enabled automatically as appropriate in
build/config/clang/BUILD.gn (sync'ed from outside of pdfium repository
along with other tools). It is enabled on a directory-by-directory basis
based on some paths.txt file (location to be specified via a GN variable
following a build/ roll past https://crrev.com/c/5369835.

Change-Id: I030dc5d15b2b9ea0541af146bcce5d61df13ffee
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/117510
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2024-03-16 01:32:43 +00:00
Lei Zhang
9108588e63 Move remaining code out of third_party/base and into core/fxcrt
Bug: pdfium:2127
Change-Id: I6958fd117a550a8c46a43265ee46370bd1615f38
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/116851
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2024-02-22 00:49:57 +00:00
Lei Zhang
ee6325efec Move third_party/base/test/scoped_locale.* to testing
Move helpers used for testing to the testing directory. Also shorten the
pdfium::base nested namespace to namespace pdfium.

Bug: pdfium:2127
Change-Id: If26a9054b75178b1781d1c5a5572fb69125fcc05
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/116672
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
2024-02-17 02:31:38 +00:00
Tom Sepez
187fa9288b Introduce UNSAFE_BUFFERS() macro to PDFium.
Introduce the macro but do not use it yet as we continue to discuss
how to document safe usage.

Split from https://pdfium-review.googlesource.com/c/pdfium/+/116070
Derived from https://crrev.com/1255055

Change-Id: Iddfe732072f27b0c4e97781a25b52ec5f05664c4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/116170
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2024-02-06 16:56:03 +00:00
Alan Screen
f22325c95a Make PDF_USE_SKIA a public build definition
Move the build definition for PDF_USE_SKIA into the public
configuration. This is necessary to enable embedders to use the
public APIs which are controlled by it, such as FPDF_FFLDrawSkia()
and FPDF_RenderPageSkia().

Bug: pdfium:11
Change-Id: Ibf35432691fccecd8b4737e1a4737dd0fa9ae4ad
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/115870
Commit-Queue: Alan Screen <awscreen@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2024-01-31 23:51:20 +00:00
Lei Zhang
b2d4f1104c Add pdf_enable_fontations GN flag
Set up a pdf_enable_fontations GN flag for future use.

- Define PDF_ENABLE_FONTATIONS for use in C++ code when enabled.
- Add the override hook, so PDFium embedders that use GN can choose the
  default via the override mechanism.
- Add GN assertion to make sure Rust and Skia are enabled.

Bug: pdfium:2107
Change-Id: I9ed504ebd5cbeaf922fe1da280cd20a08c260803
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/114834
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2023-12-16 01:17:04 +00:00
Lei Zhang
b26a1101d4 Rename _SKIA_SUPPORT_ to PDF_USE_SKIA
Be consistent with other defines in the code base. Avoid using a leading
underscore, as that is considered reserved by C/C++.

Bug: pdfium:11
Change-Id: I2e75b70236944f5c09cad3c9a1f6ed13761d8189
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/114833
Auto-Submit: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2023-12-16 00:04:05 +00:00
Omer Katz
c199ca664a Add flag to disable blink gc plugin check
The plugin now has a check to prohibit stl collections of gced types and
members. PDFium intentionally uses such collections and thus can't use
the new check.
This CL adds a flag to BUILD.gn to explicitly disable this check such
that it will not be used in pdfium even when it is enabled by default.

Bug: chromium:1470687
Change-Id: I009068eca560bee4d7d937532f52bb94f0e9b9b1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/114810
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Auto-Submit: Omer Katz <omerkatz@chromium.org>
2023-12-14 21:34:43 +00:00
danakj
9be49d4b0e Add rust_build_tests to pdfium_all when enable_rust=true
This will make any bots that enable Rust also actually verify that
building Rust targets is working.

Bug: chromium:1494118
Change-Id: Ic939c8a5d86d10410a3c7b4e268026736a5c0c39
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/113390
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2023-11-06 18:00:24 +00:00
danakj
647a08001b Add support for the Rust toolchain
To enable Rust build targets in standalone pdfium:
- Add `checkout_rust: True` to the gclient `custom_vars` section. As
  it defaults to false:
    "custom_vars": {
      "checkout_rust": True,
    }
- Set `enable_rust = true` in GN args, as it also defaults to false.
- Run gclient sync

Then building `rust_build_tests` will build test targets in
//build/rust/tests, which rely on and verify the functioning of
the Rust toolchain.

Make new rust targets by using the GN templates in //build/rust.

In the chromium build, Rust build targets that use the templates
from //build/rust will just work.

When rolling `tools/clang` and `build`, also roll `tools/rust` and
`testing/scripts/rust`.

Bug: chromium:1494118
Change-Id: I25fadcdee6223293382e623101b8489b75419791
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/113230
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2023-10-31 17:38:24 +00:00
Arthur Sonzogni
c8f9d23f8e Roll base/allocator/partition_allocator/ b22ccba48..2f4afa63f (42 commits)
This resolve two breaking change created by:
- 2023-09-28 bartekn Zero raw_ptr when constructing or moving
- 2023-10-03 arthursonzogni Move partition_alloc into a "partition_alloc" dir.

Note: We are still using the full pathname for partition_alloc files. In
a follow-up, after PartitionAlloc declare its include_dir, we will
shorten them.

Bug:chromium:1467773
Change-Id: Ib589e7a3e2b32c44d48a25701f4c467303ceb813
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/112210
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
2023-10-03 16:51:41 +00:00
Arthur Sonzogni
159bccb7f4 PA: Temporary option for new PartitionAlloc location.
To make the partition_alloc directory a standalone library, I am going to:

1. Move from files from:
   /base/allocator/partition_allocator/*
   toward
   /base/allocator/partition_allocator/src/partition_alloc/*

2. Make PartitionAlloc to declare its include_dirs.

3. PartitionAlloc dependants will be able put PartitionAlloc wherever
   they want (e.g. probably in their third_party/partition_alloc) and
   to use:
   #include "partition_alloc/..."
   instead of:
   #include "base/allocator/partition_allocator/src/partition_alloc/..."

Unfortunately, the partition_alloc library is already used by PDFium.
Step (1) would break it. To achieve step 1 without breaking pdfium, this
patch adds an option for chromium to set the location of PartitionAlloc.

This is temporary and will be removed after step 1 is completed in
Chrome.
It a kind of 3-step change.

Bug:chromuium:1467773
Change-Id: I9f312f6a47976659a1e792c663006f3a75ec7fca
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/111490
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
2023-08-29 08:59:38 +00:00
Lei Zhang
11e639bc80 Merge third_party/skia_shared code into core/fpdfapi/edit
This removes the overhead of having to track this third_party directory.
It only contains two functions borrowed from Skia internals, which are
solely authored by Google. As such, the open source licensing team
approved the transfer of this code from Skia to PDFium.

Move the code into cpdf_contentstream_write_utils.cpp. The comments have
been updated to consistently use double slashes for comments, and the
code has been auto-formatted. Otherwise it remains the same.

Bug: b/293292512
Change-Id: I7998c046a21ef16de896f65de2d838ff5998ad3e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/110710
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2023-08-01 20:24:57 +00:00
K. Moon
55e793a8f1 Only define test_runner_py when standalone
Only defines the //testing/tools:test_runner_py target when
pdf_is_standalone, as this target is only useful and valid for the
PDFium CQ and CI builders.

Bug: pdfium:1933
Change-Id: I57d242086c0ed8b4d81f7c94feb753ca2a67106f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/110590
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2023-07-31 22:48:35 +00:00
Tom Sepez
f07f001bb8 Move shim partition configuration to separate test file.
This expands the use of BRP for testing in both pdfium_embeddertests
and pdfium_test. Currently, these are running with a malloc shim,
when supported, but not with the full BRP tracing enabled at runtime.

Change-Id: I5d7f8b4df0e66f6f8a860eec1286a2cb27adcc4f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/110394
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2023-07-29 01:26:26 +00:00
Tom Sepez
ab959fa38c Switch to officially supported PA-E malloc shim.
The tests currently indicate PA/BRP support, but only pdfium_unittests
is using the shim in this first iteration. Follow-on CLs will broaden
this to other pdfium binaries. Windows is still not yet enabled.

Bug: pdfium:2038
Change-Id: I67b4695b8e6cb1b820a18c58640b177436124739
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/110130
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2023-07-27 22:49:28 +00:00
Tom Sepez
d9e3f3fd6b Consolidate some pdf_is_standalone build logic
Build fewer tests when !pdf_is_standalone, but allow the pdfium_all
target (which is always reachable) to build more tests.

-- re-work some rooted pathnames.

Change-Id: Iaf3b23796720e1e419e0b30a6d68524c9ec32f41
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/110094
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2023-07-24 23:29:11 +00:00
K. Moon
bce0a8f1ea Write CAS archive paths for test_runner.py tests
Adds a GN action that writes out the runtime dependencies for
test_runner.py tests (javascript, pixel, and corpus) in a format
compatible with the "cas archive" tool. This will be used to support
swarming.

Bug: pdfium:1933
Change-Id: Id44a8ba3d5d607a88e304469eb79de2e0d683891
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/109272
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
2023-07-13 20:12:24 +00:00
Lei Zhang
b8df4c36db Remove redundant MSVC 4267 warning
Change-Id: I9ff8405360e592522582ba68d30debd05e620d1d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/104970
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
2023-06-16 23:29:34 +00:00
Tom Sepez
09126b95ae Enable raw_ptr usage enforcement for PDFium.
Reduce the scope of the files over which the plugin is run to
avoid false positives and save some cycles. Do not enable on
Windows yet to make incremental progress.

Change-Id: Idf65aa9c4015bb2f30b70043ac47f402aad72714
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/107370
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2023-05-10 17:17:47 +00:00
Tom Sepez
1ce0f0424b Unblock roll of PDFium into chromium
Remove GN arg which was conflicting.

Change-Id: I5e4851eeb8696818c63772905dd95ce1641a5374
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/107270
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2023-05-09 01:53:48 +00:00
Tom Sepez
530d0170f7 Suppress unowned ptr exclusions in embeddertests
Add another pattern to match a type of test.

Change-Id: Ic2f0963601abcb0785a95def1adeb761c27b8898
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/107138
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: Tom Sepez <tsepez@chromium.org>
2023-05-06 02:05:29 +00:00
Tom Sepez
ef937a25a8 Exclude public files and test files from raw ptr checks
Provide regular expressions for paths from which warnings should
be suppressed.

Change-Id: Iaba2c2ea01921431aad3d841c3482c1832b810de
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/107137
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2023-05-05 23:51:10 +00:00
Tom Sepez
be511372f4 Introduce raw ptr exclusion enforcement to PDFium.
The chromium clang plugin has an option to warn about places where T*
should be re-written to raw_ptr<T>. PDFium, can't enable this warning
directly because it uses UnownedPtr instead of raw_ptr<> since it needs
to support non-PartitionAlloc builds. Someday UnownedPtr will wrap
raw_ptr for PartitionAlloc builds, at which point it will be helpful to
have this warning. So create a pdf_enable_unowned_ptr_exclusion GN arg
to turn this on independently of chromium builds. Then mark the most
obvious places with UNOWNED_PTR_EXCLUSION.

This does not yet compile correctly with the option enabled:
-- Many places ought be converted to UnownedPtr<>.
-- Public headers shouldn't be polluted with this annotation.
-- Tests are unlikely to be converted.

Change-Id: Iec2dc30835b054063c3f32679252889dce4971df
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/107131
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2023-05-05 23:13:51 +00:00
Lei Zhang
c207ee2c33 Enable -Wcovered-switch-default
When building PDFium with Clang, enable -Wcovered-switch-default.
Fix remaining warnings and remove an unnecessary variable initialization
along the way.

Bug: chromium:1393075
Change-Id: Ia7a439f2ca787f9e3dafb8d30fed2a38b7e29719
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/106670
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
2023-04-28 20:11:23 +00:00
Tom Sepez
d3fb7d00ef Revert "Enable cppgc plugin for pdfium"
This reverts commit 9140e3ff776b35ec92ae447148a2dcb739dec804.

Reason for revert: compilation warnings enable-checks-for-pdfium-directory

Original change's description:
> Enable cppgc plugin for pdfium
>
> Activate the plugin via compiler args now that the underlying issues
> have been resolved.
>
> Fixed: chromium:1421576
> Change-Id: Iafa3c8ec5b4c6f1ca8314c87bed1434269f691a5
> Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/104730
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Commit-Queue: Tom Sepez <tsepez@chromium.org>

TBR=thestig@chromium.org,tsepez@chromium.org,pdfium-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I8fd5db1b18b4fc886a04d63492c07e8b32971b96
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/104830
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
2023-03-14 18:44:43 +00:00
Tom Sepez
9140e3ff77 Enable cppgc plugin for pdfium
Activate the plugin via compiler args now that the underlying issues
have been resolved.

Fixed: chromium:1421576
Change-Id: Iafa3c8ec5b4c6f1ca8314c87bed1434269f691a5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/104730
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2023-03-14 17:26:45 +00:00
Dirk Pranke
f9562f5d18 Remove //:gn_visibility carve out.
I'm getting rid of //:gn_visibility in Chrome (and other
relevant places) because it wasn't really needed and didn't
do what I'd hoped it would do.

This CL removes the reference to that target from //BUILD.gn

Bug: chromium:1311306
Change-Id: I48b4ef72a3385ad3dc44f305f0a215af4e9541d0
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/104110
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2023-02-28 01:30:53 +00:00