android: Support “unified headers” with GCC build

Previously, the __ANDROID_API__ macro was provided by
<android/api-level.h>. With unified headers (expected to become the
default in the next NDK release and the sole option in the subsequent
release), this macro is not set properly by headers. When building with
Clang, the standalone toolchain’s clang and clang++ wrappers set the
macro properly. GCC isn’t accounted for in this way, so the build system
must assume the responsibility of setting it.

This change allows __ANDROID_API__ to be defined based on the
android_api_level GYP variable. For an example of how this might be
used, see the dependent
https://chromium-review.googlesource.com/458021/.

https://android.googlesource.com/platform/ndk/+/master/docs/UnifiedHeaders.md
https://android.googlesource.com/platform/ndk/+/ndk-r14/CHANGELOG.md

Bug: crashpad:30
Change-Id: Ia910fe11c5b5a5b872249ff7389b24a210373967
Reviewed-on: https://chromium-review.googlesource.com/457962
Reviewed-by: Scott Graham <scottmg@chromium.org>
1 file changed
tree: 6d85bb1153abc0d227736adb74a6045e1f10c92f
  1. base/
  2. build/
  3. .gitignore
  4. .gn
  5. AUTHORS
  6. BUILD.gn
  7. codereview.settings
  8. LICENSE
  9. mini_chromium.gyp
  10. README.md
README.md

mini_chromium

This is mini_chromium, a small collection of useful low-level (“base”) routines from the Chromium open-source project. Chromium is large, sprawling, full of dependencies, and a web browser. mini_chromium is small, self-contained, and a library. mini_chromium is especially useful as a dependency of other code that wishes to use Chromium’s base routines. By using mini_chromium, other projects’ code can function in a standalone environment outside of Chromium without having to treat all of Chromium as a dependency. When building as part of Chromium, those projects’ code can use Chromium’s own (non-mini_chromium) base implementation.

Code provided in mini_chromium provides the same interface as the equivalent code in Chromium.

While it’s a goal of mini_chromium to maintain interface compatibility with Chromium’s base library for the interfaces it does implement, there’s no requirement that it use the same implementations as Chromium’s base library. Many of the implementations used in mini_chromium are identical to Chromium’s, but many others have been modified to eliminate dependencies that are not desired in mini_chromium, and a few are completely distinct from Chromium’s altogether. Additionally, when mini_chromium provides an interface in the form of a file or class present in Chromium, it’s not bound to provide all functions, methods, or types that the Chromium equivalent does. The differences noted above notwithstanding, the interfaces exposed by mini_chromium’s base are and must remain a strict subset of Chromium’s.

Crashpad is the chief consumer of mini_chromium.

Mark Mentovai
mark@chromium.org