|author||tsepez <email@example.com>||Fri Aug 05 17:12:27 2016 -0700|
|committer||Commit bot <firstname.lastname@example.org>||Fri Aug 05 17:12:27 2016 -0700|
Remove another potential stale CJS_Timer usage Fix memory ownership model for PDFium timers. The |app| class owns the CJS_Timer as part of its vector<unique_ptr> to them. The CJS_Timer "owns" its slot in the global ID to timer map, and removes itself when it is destroyed. Nothing else deletes from the global map. Deleting from the global map is accompanied by a callback to the embedder to clear its resources. Next, the proper way to remove a CJS_Timer is by going through the app, and having the app erase its unique ptr, which then deletes the CJS_Timer, which in turn cleans up the global map. Provide a CJS_Timer::Cancel static method to do this conveniently. There is a alternate path to the CJS_timer via JS and its CJS_TimerObj. CJS_TimerObj owns a TimerObj that currently points to the CJS_Timer. If the timer fires, and cleans itself up, this can go stale. Make the TimerObj maintain a weak reference via global timer ID rather than a direct pointer to the CJS_Timer, so that if the timer fires and is destroyed, future attempts to cancel find nothing. There is another path, where if the JS timer object is GC'd, then we just clean up its CJS_TimerObj without touching the actual CJS_Timers. We could make this match the spec by calling into the new cancel routine as described above, but it seems weird to have a timer depend on whether a gc happened or not. A subsequent CL will rename these objects to more closely match the conventions used by the other JS wrappers. BUG=634716 Review-Url: https://codereview.chromium.org/2221513002
As of 2016-05-04, GN is used to generate build files replacing GYP. GYP support will remain until it is disabled in Chromium and then will be removed from PDFium.
As of 2016-04-28, the Visual Studio toolchain from depot_tools is used as the default Windows toolchain for Googlers. Please set DEPOT_TOOLS_WIN_TOOLCHAIN=0 if you need to use the system toolchain. See Windows development subsection for details.
Get the chromium depot tools via the instructions at http://www.chromium.org/developers/how-tos/install-depot-tools (this provides the gclient utility needed below).
Also install Python, Subversion, and Git and make sure they're in your path.
PDFium uses a similar Windows toolchain as Chromium:
Visual Studio 2015 Update 2 or later is highly recommended.
set DEPOT_TOOLS_WIN_TOOLCHAIN=0, or set that variable in your global environment.
Compilation is done through ninja, not Visual Studio.
download_from_google_storage --config and follow the authentication instructions. Note that you must authenticate with your @google.com credentials. Enter “0” if asked for a project-id.
Once you've done this, the toolchain will be installed automatically for you in the step below.
The toolchain will be in
depot_tools\win_toolchain\vs_files\<hash>, and windbg can be found in
If you want the IDE for debugging and editing, you will need to install it separately, but this is optional and not needed for building PDFium.
The name of the top-level directory does not matter. In our examples, we use “repo”. This directory must not have been used before by
gclient config as each directory can only house a single gclient configuration.
mkdir repo cd repo gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git gclient sync cd pdfium
We use GN to generate the build files and Ninja (also included with the depot_tools checkout) to execute the build files.
gn gen <directory>
If you want to set to
out/Release you'll need to export
GYP_PDFIUM_NO_ACTION=1 to stop
gclient sync from executing GYP and overwriting your build files.
Configuration is done by executing
gn args <directory> to configure the build. This will launch an editor in which you can set the following arguments.
Note, you must set
pdf_is_standalone = true if you want the sample applications like
pdfium_test to build.
When complete the arguments will be stored in
If you used Ninja, you can build the sample program by:
ninja -C <directory>/pdfium_test You can build the entire product (which includes a few unit tests) by:
ninja -C <directory>.
The pdfium_test program supports reading, parsing, and rasterizing the pages of a .pdf file to .ppm or .png output image files (windows supports two other formats). For example:
<directory>/pdfium_test --ppm path/to/myfile.pdf. Note that this will write output images to
There are currently several test suites that can be run:
It is possible the tests in the
testing directory can fail due to font differences on the various platforms. These tests are reliable on the bots. If you see failures, it can be a good idea to run the tests on the tip-of-tree checkout to see if the same failures appear.
The current health of the source tree can be found at http://build.chromium.org/p/client.pdfium/console
There are several mailing lists that are setup:
Note, the Reviews and Bugs lists are typically read-only.
We use this bug tracker, but for security bugs, please use [Chromium's security bug template] (https://code.google.com/p/chromium/issues/entry?template=Security%20Bug) and add the “Cr-Internals-Plugins-PDF” label.
For contributing code, we will follow Chromium's process as much as possible. The main exceptions is: