Import chromium-63.0.3239.132

This commit is contained in:
klzgrad 2018-01-29 00:30:36 +08:00
commit 19bc836227
19193 changed files with 3974470 additions and 0 deletions

36
.clang-format Normal file
View File

@ -0,0 +1,36 @@
# Defines the Chromium style for automatic reformatting.
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: Chromium
# This defaults to 'Auto'. Explicitly set it for a while, so that
# 'vector<vector<int> >' in existing files gets formatted to
# 'vector<vector<int>>'. ('Auto' means that clang-format will only use
# 'int>>' if the file already contains at least one such instance.)
Standard: Cpp11
# Make sure code like:
# IPC_BEGIN_MESSAGE_MAP()
# IPC_MESSAGE_HANDLER(WidgetHostViewHost_Update, OnUpdate)
# IPC_END_MESSAGE_MAP()
# gets correctly indented.
MacroBlockBegin: "^\
BEGIN_MSG_MAP|\
BEGIN_MSG_MAP_EX|\
BEGIN_SAFE_MSG_MAP_EX|\
CR_BEGIN_MSG_MAP_EX|\
IPC_BEGIN_MESSAGE_MAP|\
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM|\
IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN|\
IPC_STRUCT_BEGIN|\
IPC_STRUCT_BEGIN_WITH_PARENT|\
IPC_STRUCT_TRAITS_BEGIN|\
POLPARAMS_BEGIN|\
PPAPI_BEGIN_MESSAGE_MAP$"
MacroBlockEnd: "^\
CR_END_MSG_MAP|\
END_MSG_MAP|\
IPC_END_MESSAGE_MAP|\
IPC_PROTOBUF_MESSAGE_TRAITS_END|\
IPC_STRUCT_END|\
IPC_STRUCT_TRAITS_END|\
POLPARAMS_END|\
PPAPI_END_MESSAGE_MAP$"

5
.gitattributes vendored Normal file
View File

@ -0,0 +1,5 @@
# Stop Windows python license check presubmit errors by forcing LF checkout.
*.py text eol=lf
# Force LF checkout of the pins files to avoid transport_security_state_generator errors.
/net/http/*.pins text eol=lf

247
.gn Normal file
View File

@ -0,0 +1,247 @@
# This file is used by the GN meta build system to find the root of the source
# tree and to set startup options. For documentation on the values set in this
# file, run "gn help dotfile" at the command line.
import("//build/dotfile_settings.gni")
# The location of the build configuration file.
buildconfig = "//build/config/BUILDCONFIG.gn"
# The secondary source root is a parallel directory tree where
# GN build files are placed when they can not be placed directly
# in the source tree, e.g. for third party source trees.
secondary_source = "//build/secondary/"
# These arguments override the default values for items in a declare_args
# block. "gn args" in turn can override these.
#
# In general the value for a build arg in the declare_args block should be the
# default. In some cases, a DEPS-ed in project will want different defaults for
# being built as part of Chrome vs. being built standalone. In this case, the
# Chrome defaults should go here. There should be no overrides here for
# values declared in the main Chrome repository.
#
# Important note for defining defaults: This file is executed before the
# BUILDCONFIG.gn file. That file sets up the global variables like "is_ios".
# This means that the default_args can not depend on the platform,
# architecture, or other build parameters. If you really need that, the other
# repo should define a flag that toggles on a behavior that implements the
# additional logic required by Chrome to set the variables.
default_args = {
# TODO(brettw) bug 684096: Chrome on iOS does not build v8, so "gn gen" prints
# a warning that "Build argument has no effect". When adding a v8 variable, it
# also needs to be defined to src/ios/BUILD.gn (respectively removed from both
# location when it is removed).
v8_extra_library_files = [
# Dependencies used by the extra libraries. Putting them here causes them
# to be executed first during snapshot creation.
"//third_party/WebKit/Source/core/streams/CommonOperations.js",
"//third_party/WebKit/Source/core/streams/CommonStrings.js",
"//third_party/WebKit/Source/core/streams/SimpleQueue.js",
# Extra libraries.
"//third_party/WebKit/Source/core/streams/ByteLengthQueuingStrategy.js",
"//third_party/WebKit/Source/core/streams/CountQueuingStrategy.js",
"//third_party/WebKit/Source/core/streams/ReadableStream.js",
"//third_party/WebKit/Source/core/streams/WritableStream.js",
]
v8_experimental_extra_library_files = []
v8_enable_gdbjit = false
v8_imminent_deprecation_warnings = false
# TODO(jochen): Remove this. http://crbug.com/v8/5830,
# http://crbug.com/728583.
v8_check_microtasks_scopes_consistency = false
}
# These are the targets to check headers for by default. The files in targets
# matching these patterns (see "gn help label_pattern" for format) will have
# their includes checked for proper dependencies when you run either
# "gn check" or "gn gen --check".
check_targets = [
#"//apps/*", # Medium-hard.
"//ash/*",
"//base/*",
"//blink/*",
"//build/*",
"//cc/*",
#"//chrome/*", # Epic number of errors.
"//chrome/app/*",
"//chrome/app_shim/*",
"//chrome/browser/chromeos/*",
"//chrome/browser/extensions/*",
"//chrome/browser/ui/*",
"//chrome/common/*",
"//chrome/installer/*",
"//chrome/profiling",
"//chrome/third_party/mozilla_security_manager/*",
"//chrome/tools/*",
"//chrome/utility/*",
"//chromecast/*",
"//chromeos/*",
"//chrome_elf/*",
"//cloud_print/*",
"//components/*",
"//content/*",
"//courgette/*",
"//crypto/*",
"//data/*",
"//dbus/*",
"//device/*",
#"//extensions/*", # Lots of errors.
"//extensions:extensions_unittests",
"//extensions/browser:browser_tests",
"//extensions/browser:unit_tests",
"//extensions/common:unit_tests",
"//extensions/renderer:unit_tests",
"//extensions/shell:browser_tests",
"//extensions/shell:unit_tests",
"//extensions/utility:unit_tests",
"//gin/*",
"//google_apis/*",
"//google_update/*",
"//gpu/*",
"//ios/*",
"//ios_internal/*",
"//ipc/*",
#"//jingle/*",
"//mash/*",
"//media/*",
"//mojo/*",
#"//native_client/*",
"//net/*",
#"//pdf/*", # Medium-hard.
#"//ppapi/*", # Lots of errors.
"//ppapi/examples/*",
"//printing/*",
#"//remoting/*", # Medium-hard.
"//rlz/*",
#"//sandbox/*", # Medium-hard.
"//services/*",
"//skia/*",
"//sql/*",
"//storage/*",
"//testing/*",
#"//third_party/*", # May not ever want this.
"//third_party/breakpad/*",
"//third_party/brotli/*",
"//third_party/hunspell/*",
"//third_party/leveldatabase/*",
"//third_party/libaddressinput/*",
"//third_party/libphonenumber/*",
"//third_party/libwebp/*",
"//third_party/snappy/*",
"//third_party/WebKit/*",
"//tools/*",
"//ui/*",
"//url/*",
"//v8/*",
"//win8/*",
]
# These are the list of GN files that run exec_script. This whitelist exists
# to force additional review for new uses of exec_script, which is strongly
# discouraged.
#
# GYPI_TO_GN
#
# Some of these entries are for legacy gypi_to_gn calls. We should not be
# adding new calls to this script in the build (see //build/gypi_to_gn.py for
# detailed advice). The only time you should be editing this list for
# gypi_to_gn purposes is when moving an existing call to a different place.
#
# PLEASE READ
#
# You should almost never need to add new exec_script calls. exec_script is
# slow, especially on Windows, and can cause confusing effects. Although
# individually each call isn't slow or necessarily very confusing, at the scale
# of our repo things get out of hand quickly. By strongly pushing back on all
# additions, we keep the build fast and clean. If you think you need to add a
# new call, please consider:
#
# - Do not use a script to check for the existance of a file or directory to
# enable a different mode. Instead, use GN build args to enable or disable
# functionality and set options. An example is checking for a file in the
# src-internal repo to see if the corresponding src-internal feature should
# be enabled. There are several things that can go wrong with this:
#
# - It's mysterious what causes some things to happen. Although in many cases
# such behavior can be conveniently automatic, GN optimizes for explicit
# and obvious behavior so people can more easily diagnose problems.
#
# - The user can't enable a mode for one build and not another. With GN build
# args, the user can choose the exact configuration of multiple builds
# using one checkout. But implicitly basing flags on the state of the
# checkout, this functionality is broken.
#
# - It's easy to get stale files. If for example the user edits the gclient
# to stop checking out src-internal (or any other optional thing), it's
# easy to end up with stale files still mysteriously triggering build
# conditions that are no longer appropriate (yes, this happens in real
# life).
#
# - Do not use a script to iterate files in a directory (glob):
#
# - This has the same "stale file" problem as the above discussion. Various
# operations can leave untracked files in the source tree which can cause
# surprising effects.
#
# - It becomes impossible to use "git grep" to find where a certain file is
# referenced. This operation is very common and people really do get
# confused when things aren't listed.
#
# - It's easy to screw up. One common case is a build-time script that packs
# up a directory. The author notices that the script isn't re-run when the
# directory is updated, so adds a glob so all the files are listed as
# inputs. This seems to work great... until a file is deleted. When a
# file is deleted, all the inputs the glob lists will still be up to date
# and no command-lines will have been changed. The action will not be
# re-run and the build will be broken. It is possible to get this correct
# using glob, and it's possible to mess it up without glob, but globs make
# this situation much easier to create. if the build always lists the
# files and passes them to a script, it will always be correct.
exec_script_whitelist =
build_dotfile_settings.exec_script_whitelist + [
# Whitelist entries for //build should go into
# //build/dotfile_settings.gni instead, so that they can be shared
# with other repos. The entries in this list should be only for files
# in the Chromium repo outside of //build.
"//build_overrides/build.gni",
# TODO(dgn): Layer violation but breaks the build otherwise, see
# https://crbug.com/474506.
"//clank/java/BUILD.gn",
"//clank/native/BUILD.gn",
"//remoting/host/installer/linux/BUILD.gn",
"//remoting/remoting_version.gni",
"//remoting/host/installer/win/generate_clsids.gni",
# TODO(dpranke): Get these from the appropriate repos instead.
"//third_party/angle/BUILD.gn",
"//third_party/angle/src/tests/BUILD.gn",
"//third_party/angle/src/vulkan_support/BUILD.gn",
"//third_party/catapult/tracing/BUILD.gn",
"//third_party/google_input_tools/inputview.gni",
# CLD2 should be removed soon, delete this when we do.
"//third_party/cld_2/BUILD.gn",
"//tools/grit/grit_rule.gni",
# Not gypi-to-gn.
"//google_apis/BUILD.gn",
"//printing/BUILD.gn",
]

917
AUTHORS Normal file
View File

@ -0,0 +1,917 @@
# Names should be added to this file with this pattern:
#
# For individuals:
# Name <email address>
#
# For organizations:
# Organization <fnmatch pattern>
#
# See python fnmatch module documentation for more information.
Aaron Boushley <boushley@gmail.com>
Aaron Jacobs <samusaaron3@gmail.com>
Aaron Leventhal <aaronlevbugs@gmail.com>
Aaron Randolph <aaron.randolph@gmail.com>
Aaryaman Vasishta <jem456.vasishta@gmail.com>
Abhijeet Kandalkar <abhijeet.k@samsung.com>
Abhishek Agarwal <abhishek.a21@samsung.com>
Abhishek Singh <abhi.rathore@samsung.com>
Adam Bonner <abonner-chromium@solscope.com>
Adam Roben <adam@github.com>
Adam Treat <adam.treat@samsung.com>
Addanki Gandhi Kishor <kishor.ag@samsung.com>
Adenilson Cavalcanti <a.cavalcanti@samsung.com>
Aditya Bhargava <heuristicist@gmail.com>
Adrian Belgun <adrian.belgun@intel.com>
Abhishek Kanike <abhishek.ka@samsung.com>
Ahmet Emir Ercin <ahmetemiremir@gmail.com>
Ajay Berwal <ajay.berwal@samsung.com>
Ajay Berwal <a.berwal@samsung.com>
Ajith Kumar V <ajith.v@samsung.com>
Aku Kotkavuo <a.kotkavuo@partner.samsung.com>
Alex Gabriel <minilogo@gmail.com>
Alex Gartrell <agartrell@cmu.edu>
Alex Henrie <alexhenrie24@gmail.com>
Alex Scheele <alexscheele@gmail.com>
Alexander Douglas <agdoug@amazon.com>
Alexander Shalamov <alexander.shalamov@intel.com>
Alexander Sulfrian <alexander@sulfrian.net>
Alexandre Abreu <wiss1976@gmail.com>
Alexandru Chiculita <achicu@adobe.com>
Alexey Korepanov <alexkorep@gmail.com>
Alexey Kuts <kruntuid@gmail.com>
Alexis Brenon <brenon.alexis@gmail.com>
Alexis La Goutte <alexis.lagoutte@gmail.com>
Alexis Menard <alexis.menard@intel.com>
Alfredo Hernandez <ahernandez.miralles@gmail.com>
Ali Vathi <ali.akbar@gmail.com>
Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Ambarish Rapte <ambarish.r@samsung.com>
Amey Jahagirdar <jahagird@amazon.com>
Amit Sarkar <amit.srkr@samsung.com>
Amogh Bihani <amogh.bihani@samsung.com>
Amos Lim <amoseui@gmail.com>
Amruth Raj <amruthraj@motorola.com>
Amruth Raj <ckqr36@motorola.com>
Anand Ratn <anand.ratn@samsung.com>
Anastasios Cassiotis <tom.cassiotis@gmail.com>
Ancil George <ancilgeorge@samsung.com>
Andra Paraschiv <andra.paraschiv@intel.com>
Andrei Parvu <andrei.prv@gmail.com>
Andrei Parvu <parvu@adobe.com>
Andrew Boyarshin <andrew.boyarshin@gmail.com>
Andrew Brampton <me@bramp.net>
Andrew Hung <andrhung@amazon.com>
Andrew MacPherson <andrew.macpherson@soundtrap.com>
Andrew Tulloch <andrew@tullo.ch>
Anish Patankar <anish.p@samsung.com>
Ankit Kumar <ankit2.kumar@samsung.com>
Ankur Verma <ankur1.verma@samsung.com>
Anne Kao <annekao94@gmail.com>
Anssi Hannula <anssi.hannula@iki.fi>
Anthony Halliday <anth.halliday12@gmail.com>
Anton Obzhirov <a.obzhirov@samsung.com>
Antonin Hildebrand <antonin.hildebrand@gmail.com>
Antonio Gomes <a1.gomes@sisa.samsung.com>
Anuj Kumar Sharma <anujk.sharma@samsung.com>
Arjun Karthik <arjunkar@amazon.com>
Armin Burgmeier <aburgmeier@bloomberg.net>
Arnaud Renevier <a.renevier@samsung.com>
Arpita Bahuguna <a.bah@samsung.com>
Arthur Lussos <developer0420@gmail.com>
Arun Kulkarni <kulkarni.a@samsung.com>
Arun Kumar <arun87.kumar@samsung.com>
Arun Mankuzhi <arun.m@samsung.com>
Arunoday Sarkar <a.sarkar.arun@gmail.com>
Arunprasad Rajkumar <ararunprasad@gmail.com>
Arunprasad Rajkumar <arurajku@cisco.com>
Ashish Kumar Gupta <guptaag@amazon.com>
Ashlin Joseph <ashlin.j@samsung.com>
Attila Dusnoki <dati91@gmail.com>
Avinaash Doreswamy <avi.nitk@samsung.com>
Balazs Kelemen <b.kelemen@samsung.com>
Baul Eun <baul.eun@samsung.com>
Behara Mani Shyam Patro <behara.ms@samsung.com>
Bem Jones-Bey <bemajaniman@gmail.com>
Bem Jones-Bey <bjonesbe@adobe.com>
Ben Fiola <benfiola@gmail.com>
Ben Karel <eschew@gmail.com>
Ben Noordhuis <ben@strongloop.com>
Benjamin Dupont <bedupont@cisco.com>
Benjamin Jemlich <pcgod99@gmail.com>
Bernard Cafarelli <voyageur@gentoo.org>
Bernhard M. Wiedemann <bwiedemann@suse.de>
Bhagirathi Satpathy <bhagirathi.s@samsung.com>
Bhanukrushana Rout <b.rout@samsung.com>
Biljith Jayan <billy.jayan@samsung.com>
Bobby Powers <bobbypowers@gmail.com>
Branden Archer <bma4@zips.uakron.edu>
Brendan Kirby <brendan.kirby@imgtec.com>
Brendan Long <self@brendanlong.com>
Brian G. Merrell <bgmerrell@gmail.com>
Brian Konzman, SJ <b.g.konzman@gmail.com>
Brian Luft <brian@electroly.com>
Brian Merrell, Novell Inc. <bgmerrell@gmail.com>
Brian Yip <itsbriany@gmail.com>
Bruno Calvignac <bruno@flock.com>
Bruno de Oliveira Abinader <brunoabinader@gmail.com>
Bruno Roy <brusi_roy@hotmail.com>
Bryan Donlan <bdonlan@gmail.com>
Byoungkwon Ko <gogag2@gmail.com>
Byungwoo Lee <bw80.lee@samsung.com>
Caio Marcelo de Oliveira Filho <caio.de.oliveira.filho@intel.com>
Caitlin Potter <caitpotter88@gmail.com>
Calvin Mei <calvimei@amazon.com>
Cameron Gutman <aicommander@gmail.com>
Catalin Badea <badea@adobe.com>
Cem Kocagil <cem.kocagil@gmail.com>
Chakshu Ahuja <chakshu.a@samsung.com>
Chamal De Silva <chamalsl@yahoo.com>
Chandan Padhi <c.padhi@samsung.com>
Chandra Shekar Vallala <brk376@motorola.com>
Chang Shu <c.shu@samsung.com>
ChangSeok Oh <shivamidow@gmail.com>
Changbin Shao <changbin.shao@intel.com>
Changjun Yang <changjun.yang@intel.com>
Changwan Hong <cwhong893@gmail.com>
Changyeon Kim <cyzero.kim@samsung.com>
Chansik Yun <chansik.yun@gmail.com>
Chaobin Zhang <zhchbin@gmail.com>
Choongwoo Han <cwhan.tunz@gmail.com>
Chris Greene <cwgreene@amazon.com>
Chris Harrelson <chrishtr@gmail.com>
Chris Nardi <hichris123@gmail.com>
Chris Tserng <tserng@amazon.com>
Chris Vasselli <clindsay@gmail.com>
Chris Szurgot <szurgotc@amazon.com>
Christophe Dumez <ch.dumez@samsung.com>
Christopher Dale <chrelad@gmail.com>
Claudio DeSouza <claudiomdsjr@gmail.com>
Clemens Fruhwirth <clemens@endorphin.org>
Clement Scheelfeldt Skau <clementskau@gmail.com>
Clinton Staley <clintstaley@chromium.org>
Clinton Staley <clintstaley@gmail.com>
Connor Pearson <cjp822@gmail.com>
Craig Schlenter <craig.schlenter@gmail.com>
Csaba Osztrogonác <ossy.szeged@gmail.com>
Daegyu Lee <na7jun8gi@gmail.com>
Dai Chunyang <chunyang.dai@intel.com>
Daiwei Li <daiweili@suitabletech.com>
Damien Marié <damien@dam.io>
Dan McCombs <overridex@gmail.com>
Daniel Bevenius <daniel.bevenius@gmail.com>
Daniel Bomar <dbdaniel42@gmail.com>
Daniel Carvalho Liedke <dliedke@gmail.com>
Daniel Charles <daniel.charles@intel.com>
Daniel Imms <daniimms@amazon.com>
Daniel Johnson <danielj41@gmail.com>
Daniel Lockyer <thisisdaniellockyer@gmail.com>
Daniel Nishi <dhnishi@gmail.com>
Daniel Platz <daplatz@googlemail.com>
Daniel Shaulov <dshaulov@ptc.com>
Daniel Trebbien <dtrebbien@gmail.com>
Daniel Waxweiler <daniel.waxweiler@gmail.com>
Dániel Bátyai <dbatyai@inf.u-szeged.hu>
Dániel Vince <vinced@inf.u-szeged.hu>
Darshini KN <kn.darshini@samsung.com>
David Benjamin <davidben@mit.edu>
David Erceg <erceg.david@gmail.com>
David Fox <david@davidjfox.com>
David Futcher <david.mike.futcher@gmail.com>
David Leen <davileen@amazon.com>
David McAllister <mcdavid@amazon.com>
David Spellman <dspell@amazon.com>
Dax Kelson <dkelson@gurulabs.com>
Debashish Samantaray <d.samantaray@samsung.com>
Deepak Dilip Borade <deepak.db@samsung.com>
Deepak Mittal <deepak.m1@samsung.com>
Deepak Singla <deepak.s@samsung.com>
Deokjin Kim <deokjin81.kim@samsung.com>
Derek Halman <d.halman@gmail.com>
Devlin Cronin <rdevlin.cronin@gmail.com>
Diana Suvorova <diana.suvorova@gmail.com>
Diego Ferreiro Val <elfogris@gmail.com>
Dillon Sellars <dill.sellars@gmail.com>
Divya Bansal <divya.bansal@samsung.com>
Dominic Jodoin <dominic.jodoin@gmail.com>
Dominik Röttsches <dominik.rottsches@intel.com>
Don Woodward <woodward@adobe.com>
Donghee Na <corona10@gmail.com>
Dongheun Kang <dongheun.kang@lge.com>
Dongie Agnir <dongie.agnir@gmail.com>
Dongjun Kim <djmix.kim@samsung.com>
Dongseong Hwang <dongseong.hwang@intel.com>
Dongwoo Joshua Im <dw.im@samsung.com>
Dongyu Lin <l2d4y3@gmail.com>
Donna Wu <donna.wu@intel.com>
Douglas F. Turner <doug.turner@gmail.com>
Dustin Doloff <doloffd@amazon.com>
Ebrahim Byagowi <ebraminio@gmail.com>
Eduardo Lima (Etrunko) <eblima@gmail.com>
Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
Edward Baker <edward.baker@intel.com>
Edward Crossman <tedoc2000@gmail.com>
Eero Häkkinen <eero.hakkinen@intel.com>
Eero Häkkinen <e.hakkinen@samsung.com>
Egor Starkov <egor.starkov@samsung.com>
Ehsan Akhgari <ehsan.akhgari@gmail.com>
Elan Ruusamäe <elan.ruusamae@gmail.com>
Eric Ahn <byungwook.ahn@gmail.com>
Eric Rescorla <ekr@rtfm.com>
Erik Hill <erikghill@gmail.com>
Erik Sjölund <erik.sjolund@gmail.com>
Eriq Augustine <eriq.augustine@gmail.com>
Etienne Laurin <etienne@atnnn.com>
Evan Peterson <evan.peterson.ep@gmail.com>
Evan Wallace <evan.exe@gmail.com>
Evangelos Foutras <evangelos@foutrelis.com>
Evgeniy Dushistov <dushistov@gmail.com>
Evgeny Agafonchikov <evgeny.agafonchikov@akvelon.com>
Fabien Tassin <fta@sofaraway.org>
Felix H. Dahlke <fhd@ubercode.de>
Fernando Jiménez Moreno <ferjmoreno@gmail.com>
Finbar Crago <finbar.crago@gmail.com>
François Beaufort <beaufort.francois@gmail.com>
Francois Kritzinger <francoisk777@gmail.com>
Francois Rauch <leopardb@gmail.com>
Frankie Dintino <fdintino@theatlantic.com>
Franklin Ta <fta2012@gmail.com>
Frédéric Jacob <frederic.jacob.78@gmail.com>
Frédéric Wang <fred.wang@free.fr>
Fu Junwei <junwei.fu@intel.com>
Gaetano Mendola <mendola@gmail.com>
Gajendra N <gajendra.n@samsung.com>
Gajendra Singh <wxjg68@motorola.com>
Gao Chun <chun.gao@intel.com>
Gao Chun <gaochun.dev@gmail.com>
George Joseph <kottackal.george@gmail.com>
George Liaskos <geo.liaskos@gmail.com>
Georgy Buranov <gburanov@gmail.com>
Gergely Nagy <ngg@ngg.hu>
Getulio Sánchez <valentin2507@gmail.com>
Gideon Pyzer <gjpyzer@gmail.com>
Gitanshu Mehndiratta <g.mehndiratt@samsung.com>
Giuseppe Iuculano <giuseppe@iuculano.it>
Glenn Adams <glenn@chromium.org>
Gnanasekar Somanathan <gnanasekar.s@samsung.com>
Gordana Cmiljanovic <gordana.cmiljanovic@imgtec.com>
Goutham Jagannatha <wrm364@motorola.com>
Graham Yoakum <gyoakum@skobalt.com>
Gregory Davis <gpdavis.chromium@gmail.com>
Greg Visser <gregvis@gmail.com>
Grzegorz Czajkowski <g.czajkowski@samsung.com>
Guangzhen Li <guangzhen.li@intel.com>
Gurpreet Kaur <k.gurpreet@samsung.com>
Gustav Tiger <gustav.tiger@sonymobile.com>
Gyuyoung Kim <gyuyoung.kim@navercorp.com>
Gzob Qq <gzobqq@gmail.com>
Habib Virji <habib.virji@samsung.com>
Haeun Kim <haeungun@gmail.com>
Haitao Feng <haitao.feng@intel.com>
Halley Zhao <halley.zhao@intel.com>
Halton Huo <halton.huo@intel.com>
Hans Hillen <hans.hillen@gmail.com>
Haojian Wu <hokein.wu@gmail.com>
Hari Singh <hari.singh1@samsung.com>
Harpreet Singh Khurana <harpreet.sk@samsung.com>
Harshikesh Kumar <harshikeshnobug@gmail.com>
Hautio Kari <khautio@gmail.com>
Heejin R. Chung <heejin.r.chung@samsung.com>
Heeyoun Lee <heeyoun.lee@samsung.com>
Himanshu Joshi <h.joshi@samsung.com>
Holger Kraus <kraush@amazon.com>
Hong Zheng <hong.zheng@intel.com>
Hongbo Min <hongbo.min@intel.com>
Horia Olaru <horia.olaru@gmail.com>
Horia Olaru <olaru@adobe.com>
Hosung You <hosung.you@samsung.com>
Huapeng Li <huapengl@amazon.com>
Huayong Xu <huayong.xu@samsung.com>
Hugo Holgersson <hugo.holgersson@sonymobile.com>
Huiwon Jo <jhwon0415@gmail.com>
Huy Duong <huy.duongdinh@gmail.com>
Hwanseung Lee <hs1217.lee@gmail.com>
Hwanseung Lee <hs1217.lee@samsung.com>
Hyemi Shin <hyemi.sin@samsung.com>
Hyunjune Kim <hyunjune.kim@samsung.com>
Hyunki Baik <hyunki.baik@samsung.com>
Hyungchan Kim <inlinechan@gmail.com>
Hyungwook Lee <withlhw@gmail.com>
Hyungwook Lee <hyungwook.lee@navercorp.com>
Ian Cullinan <cullinan@amazon.com>
Ian Scott <ian.scott@arteris.com>
Ibrar Ahmed <ibrar.ahmad@gmail.com>
Ilia K <ki.stfu@gmail.com>
Ilya Konstantinov <ilya.konstantinov@gmail.com>
Ion Rosca <rosca@adobe.com>
Irmak Kavasoglu <irmakkavasoglu@gmail.com>
Isaac Murchie <murchieisaac@gmail.com>
Isaac Reilly <reillyi@amazon.com>
Ivan Sham <ivansham@amazon.com>
J. Ryan Stinnett <jryans@chromium.org>
Jack Bates <jack@nottheoilrig.com>
Jacob Clark <jacob.jh.clark@googlemail.com>
Jacob Mandelson <jacob@mandelson.org>
Jaehun Lim <ljaehun.lim@samsung.com>
Jaehyun Lee <j-hyun.lee@samsung.com>
Jaekyeom Kim <btapiz@gmail.com>
Jaemin Seo <jaemin86.seo@samsung.com>
Jaeseok Yoon <yjaeseok@gmail.com>
Jaideep Bajwa <bjaideep@ca.ibm.com>
Jaime Soriano Pastor <jsorianopastor@gmail.com>
Jake Helfert <jake@helfert.us>
Jake Hendy <me@jakehendy.com>
Jakob Weigert <jakob.j.w@googlemail.com>
Jakub Machacek <xtreit@gmail.com>
James Burton <jb@0.me.uk>
James Choi <jchoi42@pha.jhu.edu>
James Stanley <james@apphaus.co.uk>
James Vega <vega.james@gmail.com>
James Wei <james.wei@intel.com>
James Willcox <jwillcox@litl.com>
Jan Sauer <jan@jansauer.de>
Janwar Dinata <j.dinata@gmail.com>
Jared Shumway <jaredshumway94@gmail.com>
Jared Sohn <jared.sohn@gmail.com>
Jared Wein <weinjared@gmail.com>
Jari Karppanen <jkarp@amazon.com>
Jay Oster <jay@kodewerx.org>
Jay Soffian <jaysoffian@gmail.com>
Jeado Ko <haibane84@gmail.com>
Jeongeun Kim <je_julie.kim@samsung.com>
Jeongmin Kim <kimwjdalsl@gmail.com>
Jeongwoo Park <skeksk91@gmail.com>
Jeremy Noring <jnoring@hirevue.com>
Jeremy Spiegel <jeremysspiegel@gmail.com>
Jeroen Van den Berghe <vandenberghe.jeroen@gmail.com>
Jesper Storm Bache <jsbache@gmail.com>
Jesse Miller <jesse@jmiller.biz>
Jesus Sanchez-Palencia <jesus.sanchez-palencia.fernandez.fil@intel.com>
Jiadong Zhu <jiadong.zhu@linaro.org>
Jiajia Qin <jiajia.qin@intel.com>
Jianjun Zhu <jianjun.zhu@intel.com>
Jianneng Zhong <muzuiget@gmail.com>
Jiawei Shao <jiawei.shao@intel.com>
Jie Chen <jie.a.chen@intel.com>
Jihoon Chung <jihoon@gmail.com>
Jihoon Chung <j.c@navercorp.com>
Jihun Brent Kim <devgrapher@gmail.com>
Jin Yang <jin.a.yang@intel.com>
Jincheol Jo <jincheol.jo@navercorp.com>
Jingwei Liu <kingweiliu@gmail.com>
Jingyi Wei <wjywbs@gmail.com>
Jinho Bang <jinho.bang@samsung.com>
Jinkyu Seong <jinkyu.seong@lge.com>
Jinsong Fan <fanjinsong@sogou-inc.com>
Jinwoo Song <jinwoo7.song@samsung.com>
Jitendra Kumar Sahoo <jitendra.ks@samsung.com>
Joachim Bauch <mail@joachim-bauch.de>
Joachim Bauch <jbauch@webrtc.org>
Joe Knoll <joe.knoll@workday.com>
Joe Thomas <mhx348@motorola.com>
Joel Stanley <joel@jms.id.au>
Johannes Rudolph <johannes.rudolph@googlemail.com>
John Yani <vanuan@gmail.com>
John Yoo <nearbyh13@gmail.com>
Johnson Lin <johnson.lin@intel.com>
Jonathan Frazer <listedegarde@gmail.com>
Jonathan Garbee <jonathan@garbee.me>
Jonathan Hacker <jhacker@arcanefour.com>
JongKwon Lee <jongkwon.lee@navercorp.com>
Jongsoo Lee <leejongsoo@gmail.com>
Joone Hur <joone.hur@intel.com>
Jorge Villatoro <jorge@tomatocannon.com>
Joseph Gentle <josephg@gmail.com>
Josh Triplett <josh@joshtriplett.org>
Josh Triplett <josh.triplett@intel.com>
Joshua Lock <joshua.lock@intel.com>
Joshua Roesslein <jroesslein@gmail.com>
Josué Ratelle <jorat1346@gmail.com>
Josyula Venkat Narasimham <venkat.nj@samsung.com>
Juhui Lee <juhui24.lee@samsung.com>
Julien Brianceau <jbriance@cisco.com>
Julien Isorce <j.isorce@samsung.com>
Julien Racle <jracle@logitech.com>
Jun Fang <jun_fang@foxitsoftware.com>
Jun Jiang <jun.a.jiang@intel.com>
Junchao Han <junchao.han@intel.com>
JungJik Lee <jungjik.lee@samsung.com>
Jungkee Song <jungkee.song@samsung.com>
Junmin Zhu <junmin.zhu@intel.com>
Justin Okamoto <justmoto@amazon.com>
Kai Jiang <jiangkai@gmail.com>
Kai Köhne <kai.koehne@qt.io>
Kal Conley <kcconley@gmail.com>
Kalyan Kondapally <kalyan.kondapally@intel.com>
Kamil Jiwa <kamil.jiwa@gmail.com>
Kamil Rytarowski <krytarowski@gmail.com>
Kangil Han <kangil.han@samsung.com>
Kangyuan Shu <kangyuan.shu@intel.com>
Karan Thakkar <karanjthakkar@gmail.com>
Kartikey Bhatt <kartikey@amazon.com>
Kaspar Brand <googlecontrib@velox.ch>
Kaustubh Atrawalkar <kaustubh.ra@gmail.com>
Kaustubh Atrawalkar <kaustubh.a@samsung.com>
Ke He <ke.he@intel.com>
Keene Pan <keenepan@linpus.com>
Keith Chen <keitchen@amazon.com>
Kenneth Rohde Christiansen <kenneth.r.christiansen@intel.com>
Kenneth Zhou <knthzh@gmail.com>
Keonho Kim <keonho07.kim@samsung.com>
Ketan Goyal <ketan.goyal@samsung.com>
Kevin Gibbons <bakkot@gmail.com>
Kevin Lee Helpingstine <sig11@reprehensible.net>
Kevin M. McCormick <mckev@amazon.com>
Khasim Syed Mohammed <khasim.mohammed@linaro.org>
Kihong Kwon <kihong.kwon@samsung.com>
Kim Christensen <kimworking@gmail.com>
Kingshuk Jana <kingshuk.j@samsung.com>
Kirill Bobyrev <kirillbobyrev@gmail.com>
Kirill Ovchinnikov <kirill.ovchinn@gmail.com>
Kirk Shoop <kirk.shoop@microsoft.com>
Kihwang Kim <pwangkk@gmail.com>
Klemen Forstnerič <klemen.forstneric@gmail.com>
Kodam Nagaraju <k2.nagaraju@samsung.com>
Konrad Dzwinel <kdzwinel@gmail.com>
Krishna Chaitanya <krish.botta@samsung.com>
Kristof Kosztyo <kkosztyo.u-szeged@partner.samsung.com>
Krzysztof Czech <k.czech@samsung.com>
Krzysztof Wolanski <k.wolanski@samsung.com>
Kunal Thakar <kunalt@gmail.com>
Kushal Pisavadia <kushi.p@gmail.com>
Kwangho Shin <k_h.shin@samsung.com>
Kyle Nahrgang <kpn24@drexel.edu>
Kyounga Ra <kyounga.ra@gmail.com>
Kyungtae Kim <ktf.kim@samsung.com>
Kyung Yeol Kim <chitacan@gmail.com>
Laszlo Gombos <l.gombos@samsung.com>
Laszlo Radanyi <bekkra@gmail.com>
Lauren Yeun Kim <lauren.yeun.kim@gmail.com>
Lauri Oherd <lauri.oherd@gmail.com>
Lavar Askew <open.hyperion@gmail.com>
Legend Lee <guanxian.li@intel.com>
Leith Bade <leith@leithalweapon.geek.nz>
Lenny Khazan <lenny.khazan@gmail.com>
Leo Wolf <jclw@ymail.com>
Leon Han <leon.han@intel.com>
Leung Wing Chung <lwchkg@gmail.com>
Li Yin <li.yin@intel.com>
Lidwine Genevet <lgenevet@cisco.com>
Lingyun Cai <lingyun.cai@intel.com>
Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Loo Rong Jie <loorongjie@gmail.com>
Lorenzo Stoakes <lstoakes@gmail.com>
Lu Guanqun <guanqun.lu@gmail.com>
Lucie Brozkova <lucinka.brozkova@gmail.com>
Luiz Von Dentz <luiz.von.dentz@intel.com>
Luke Inman-Semerau <luke.semerau@gmail.com>
Luke Zarko <lukezarko@gmail.com>
Luoxi Pan <l.panpax@gmail.com>
Maarten Lankhorst <m.b.lankhorst@gmail.com>
Magnus Danielsson <fuzzac@gmail.com>
Mahesh Kulkarni <mahesh.kk@samsung.com>
Mahesh Machavolu <mahesh.ma@samsung.com>
Maksim Sisov <maksim.sisov@intel.com>
Malcolm Wang <malcolm.2.wang@gmail.com>
Manish Chhajer <chhajer.m@samsung.com>
Manojkumar Bhosale <manojkumar.bhosale@imgtec.com>
Manuel Braun <thembrown@gmail.com>
Mao Yujie <maojie0924@gmail.com>
Mao Yujie <yujie.mao@intel.com>
Marco Rodrigues <gothicx@gmail.com>
Mario Pistrich <m.pistrich@gmail.com>
Mario Sanchez Prada <mario.prada@samsung.com>
Marcin Wiacek <marcin@mwiacek.com>
Mariusz Mlynski <marius.mlynski@gmail.com>
Mark Hahnenberg <mhahnenb@andrew.cmu.edu>
Mark Seaborn <mrs@mythic-beasts.com>
Martijn Croonen <martijn@martijnc.be>
Martin Bednorz <m.s.bednorz@gmail.com>
Martin Rogalla <martin@martinrogalla.com>
Martina Kollarova <martina.kollarova@intel.com>
Masahiro Yado <yado.masa@gmail.com>
Masaru Nishida <msr.i386@gmail.com>
Matej Knopp <matej.knopp@gmail.com>
Matheus Bratfisch <matheusbrat@gmail.com>
Mathias Bynens <mathias@qiwi.be>
Mathieu Meisser <mmeisser@logitech.com>
Matt Arpidone <mma.public@gmail.com>
Matt Strum <mstrum@amazon.com>
Matt Zeunert <matt@mostlystatic.com>
Matthew Bauer <mjbauer95@gmail.com>
Matthew Demarest <demarem@amazon.com>
Matthew Robertson <matthewrobertson03@gmail.com>
Matthew Turk <matthewturk@gmail.com>
Matthew Willis <appamatto@gmail.com>
Matthias Reitinger <reimarvin@gmail.com>
Matthieu Rigolot <matthieu.rigolot@gmail.com>
Max Perepelitsyn <pph34r@gmail.com>
Max Vujovic <mvujovic@adobe.com>
Mayank Gupta <mayank.g1@samsung.com>
Mayur Kankanwadi <mayurk.vk@samsung.com>
Md Sami Uddin <md.sami@samsung.com>
Michael Cirone <mikecirone@gmail.com>
Michael Gilbert <floppymaster@gmail.com>
Michael Lopez <lopes92290@gmail.com>
Michael Morrison <codebythepound@gmail.com>
Michael Schechter <mike.schechter@gmail.com>
Michaël Zasso <mic.besace@gmail.com>
Michael Zugelder <michael@zugelder.org>
Mihai Maerean <mmaerean@adobe.com>
Mihai Tica <mihai.o.tica@gmail.com>
Mihai Tica <mitica@adobe.com>
Mike Pennisi <mike@mikepennisi.com>
Mike Tilburg <mtilburg@adobe.com>
Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com>
Milko Leporis <milko.leporis@imgtec.com>
Milton Chiang <milton.chiang@mediatek.com>
Minggang Wang <minggang.wang@intel.com>
Mingmin Xie <melvinxie@gmail.com>
Minseok Koo <kei98301@gmail.com>
Minsoo Max Koo <msu.koo@samsung.com>
Miran Karic <miran.karic@imgtec.com>
Mirela Budaes <mbudaes@gmail.com>
Mirela Budaes <mbudaes@adobe.com>
Mitchell Rosen <mitchellwrosen@chromium.org>
Miyoung Shin <myid.shin@samsung.com>
Mohamed I. Hammad <ibraaaa@gmail.com>
Mohamed Mansour <m0.interactive@gmail.com>
Mohammad Azam <m.azam@samsung.com>
Mohammed Wajahat Ali Siddiqui <wajahat.s@samsung.com>
Mohan Reddy <mohan.reddy@samsung.com>
Mohit Bhalla <bhallam@amazon.com>
Mrunal Kapade <mrunal.kapade@intel.com>
Myles C. Maxfield <mymax@amazon.com>
Nagarajan Narayanan <nagarajan.n@samsung.com>
Nagarjuna Atluri <nagarjuna.a@samsung.com>
Naiem Shaik <naiem.shaik@gmail.com>
Naoki Takano <takano.naoki@gmail.com>
Naveen Bobbili <naveenbobbili@motorola.com>
Naveen Bobbili <qghc36@motorola.com>
Naveen Kumar Devaraj <devarajn@amazon.com>
Naveen Kumar S G <naveensg@samsung.com>
Nayan Kumar K <qtc746@motorola.com>
Neal Gompa <ngompa13@gmail.com>
Nedeljko Babic <nedeljko.babic@imgtec.com>
Nikhil Bansal <n.bansal@samsung.com>
Nikhil Sahni <nikhil.sahni@samsung.com>
Nikita Ofitserov <himikof@gmail.com>
Niklas Schulze <me@jns.io>
Nils Schneider <nils@nilsschneider.net>
Nils Schneider <nils.schneider@gmail.com>
Ningxin Hu <ningxin.hu@intel.com>
Nitish Mehrotra <nitish.m@samsung.com>
Noj Vek <nojvek@gmail.com>
Nolan Cao <nolan.robin.cao@gmail.com>
Oleksii Kadurin <ovkadurin@gmail.com>
Omar Sandoval <osandov@osandov.com>
Pan Deng <pan.deng@intel.com>
Parag Radke <nrqv63@motorola.com>
Paritosh Kumar <paritosh.in@samsung.com>
Patrasciuc Sorin Cristian <cristian.patrasciuc@gmail.com>
Patrick Chan <chanpatorikku@gmail.com>
Patrick Kettner <patrickkettner@gmail.com>
Patrick Riordan <patrickriordan177@gmail.com>
Patrick Stein <patrickwonders@gmail.com>
Patrik Ackland <patrikackland@gmail.com>
Paul Adolph <padolph@netflix.com>
Paul Kehrer <paul.l.kehrer@gmail.com>
Paul Lind <paul.lind@imgtec.com>
Paul Nettleship <pnettleship@gmail.com>
Paul Robinson <paulrobinson85@googlemail.com>
Paul Roskell <blurrech@gmail.com>
Paul Sapunaru <paul.sapunaru@intel.com>
Paul Wicks <pwicks86@gmail.com>
Pavan Kumar Emani <pavan.e@samsung.com>
Pavel Ivanov <paivanof@gmail.com>
Paweł Hajdan jr <phajdan.jr@gmail.com>
Pawel Forysiuk <p.forysiuk@samsung.com>
Peng Jiang <leiyi.jp@gmail.com>
Peng Xinchao <pxinchao@gmail.com>
Petar Jovanovic <petarj@mips.com>
Peter Beverloo <peter@chromium.org>
Peter Bright <drpizza@quiscalusmexicanus.org>
Peter Brophy <pbrophy@adobe.com>
Peter Collingbourne <peter@pcc.me.uk>
Peter Gal <pgal.u-szeged@partner.samsung.com>
Peter Molnar <pmolnar.u-szeged@partner.samsung.com>
Philip Hanson <philip.hanson@intel.com>
Philipp Hancke <fippo@andyet.net>
Philipp Hancke <philipp.hancke@googlemail.com>
Philippe Beauchamp <philippe.beauchamp@gmail.com>
Philippe Beaudoin <philippe.beaudoin@gmail.com>
Pierre-Antoine LaFayette <pierre.lafayette@gmail.com>
Po-Chun Chang <pochang0403@gmail.com>
Pramod Begur Srinath <pramod.bs@samsung.com>
Pranay Kumar <pranay.kumar@samsung.com>
Prashant Hiremath <prashhir@cisco.com>
Prashant Nevase <prashant.n@samsung.com>
Prashant Patil <prashant.patil@imgtec.com>
Praveen Akkiraju <praveen.anp@samsung.com>
Preeti Nayak <preeti.nayak@samsung.com>
Pritam Nikam <pritam.nikam@samsung.com>
Puttaraju R <puttaraju.r@samsung.com>
Qiankun Miao <qiankun.miao@intel.com>
Qing Zhang <qing.zhang@intel.com>
Qi Yang <qi1988.yang@samsung.com>
Radu Stavila <stavila@adobe.com>
Radu Velea <radu.velea@intel.com>
Rafael Antognolli <rafael.antognolli@intel.com>
Raghavendra Ghatage <r.ghatage@samsung.com>
Rahul Gupta <rahul.g@samsung.com>
Rajneesh Rana <rajneesh.r@samsung.com>
Raman Tenneti <raman.tenneti@gmail.com>
Ramkumar Gokarnesan <ramkumar.gokarnesan@gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com>
Ramya Vadlamudi <ramya.v@samsung.com>
Randy Posynick <randy.posynick@gmail.com>
Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Raveendra Karu <r.karu@samsung.com>
Ravi Nanjundappa <nravi.n@samsung.com>
Ravi Phaneendra Kasibhatla <r.kasibhatla@samsung.com>
Ravi Phaneendra Kasibhatla <ravi.kasibhatla@motorola.com>
Refael Ackermann <refack@gmail.com>
Renata Hodovan <rhodovan.u-szeged@partner.samsung.com>
Rene Bolldorf <rb@radix.io>
Rene Ladan <r.c.ladan@gmail.com>
Rijubrata Bhaumik <rijubrata.bhaumik@intel.com>
Riku Voipio <riku.voipio@linaro.org>
Rob Buis <rob.buis@samsung.com>
Rob Wu <rob@robwu.nl>
Robert Bear Travis <bear.travis@gmail.com>
Robert Bear Travis <betravis@adobe.com>
Robert Bradford <robert.bradford@intel.com>
Robert Goldberg <goldberg@adobe.com>
Robert Hogan <robhogan@gmail.com>
Robert Nagy <robert.nagy@gmail.com>
Robert Sesek <rsesek@bluestatic.org>
Roland Takacs <rtakacs.u-szeged@partner.samsung.com>
Romain Pokrzywka <romain.pokrzywka@gmail.com>
Rosen Dash <nqk836@motorola.com>
Rosen Dash <rosen.dash@gmail.com>
ruben <chromium@hybridsource.org>
Ruben Terrazas <rubentopo@gmail.com>
Rufus Hamade <rufus.hamade@imgtec.com>
Ruiyi Luo <luoruiyi2008@gmail.com>
Ryan Ackley <ryanackley@gmail.com>
Ryan Norton <rnorton10@gmail.com>
Ryan Sleevi <ryan-chromium-dev@sleevi.com>
Ryan Yoakum <ryoakum@skobalt.com>
Ryuan Choi <ryuan.choi@samsung.com>
Saikrishna Arcot <saiarcot895@gmail.com>
Salvatore Iovene <salvatore.iovene@intel.com>
Sam Larison <qufighter@gmail.com>
Sam McDonald <sam@sammcd.com>
Sanggi Hong <sanggi.hong11@gmail.com>
Sanghee Lee <sanghee.lee1992@gmail.com>
Sanghyun Park <sh919.park@samsung.com>
Sanghyup Lee <sh53.lee@samsung.com>
Sangjoon Je <htamop@gmail.com>
Sangwoo Ko <sangwoo108@gmail.com>
Sanjoy Pal <ncj674@motorola.com>
Sanjoy Pal <sanjoy.pal@samsung.com>
Sanne Wouda <sanne.wouda@gmail.com>
Santosh Mahto <samahto@cisco.com>
Sarath Singapati <s.singapati@gmail.com>
Sarath Singapati <s.singapati@samsung.com>
Saravanan KR <sramajay@cisco.com>
Sathish Kuppuswamy <sathish.kuppuswamy@intel.com>
Satoshi Matsuzaki <satoshi.matsuzaki@gmail.com>
Sayan Nayak <sayan.nayak@samsung.com>
Scott Blomquist <sblom@microsoft.com>
Scott D Phillips <scott.d.phillips@intel.com>
Sean Bryant <sean@cyberwang.net>
Seo Sanghyeon <sanxiyn@gmail.com>
Seokju Kwon <seokju.kwon@gmail.com>
SeongTae Jeong <ferendevelop.gl@gmail.com>
Sergey Kipet <sergey.kipet@gmail.com>
Sergey Putilin <p.sergey@samsung.com>
Sergey Shekyan <shekyan@gmail.com>
Sergio Carlos Morales Angeles <carloschilazo@gmail.com>
Sergiy Byelozyorov <rryk.ua@gmail.com>
Seshadri Mahalingam <seshadri.mahalingam@gmail.com>
Sevan Janiyan <venture37@geeklan.co.uk>
Shahriar Rostami <shahriar.rostami@gmail.com>
Shane Hansen <shanemhansen@gmail.com>
ShankarGanesh K <blr.bmlab@gmail.com>
Shanmuga Pandi M <shanmuga.m@samsung.com>
Shail Singhal <shail.s@samsung.com>
Shaobo Yan <shaobo.yan@intel.com>
Shashi Kumar <sk.kumar@samsung.com>
Sherry Mou <wenjinm@amazon.com>
Shez Baig <sbaig1@bloomberg.net>
Shigeki Ohtsu <shigeki.ohtsu@gmail.com>
Shiliu Wang <aofdwsl@gmail.com>
Shiliu Wang <shiliu.wang@intel.com>
Shilpa Shri <shilpa.shri@samsung.com>
Shivakumar JM <shiva.jm@samsung.com>
Shiva Kumar <shiva.k1@samsung.com>
Shouqun Liu <liushouqun@xiaomi.com>
Shouqun Liu <shouqun.liu@intel.com>
Shreeram Kushwaha <shreeram.k@samsung.com>
Shreyas Gopal <shreyas.g@samsung.com>
Shreyas VA <v.a.shreyas@gmail.com>
Siba Samal <siba.samal@samsung.com>
Simon Arlott <simon.arlott@gmail.com>
Siva Kumar Gunturi <siva.gunturi@samsung.com>
Sohan Jyoti Ghosh <sohan.jyoti@samsung.com>
Sohan Jyoti Ghosh <sohan.jyoti@huawei.com>
Song YeWen <ffmpeg@gmail.com>
Sooho Park <sooho1000@gmail.com>
Soorya R <soorya.r@samsung.com>
Soren Dreijer <dreijerbit@gmail.com>
Srirama Chandra Sekhar Mogali <srirama.m@samsung.com>
Stephen Searles <stephen.searles@gmail.com>
Steve Sanders <steve@zanderz.com>
Steven Pennington <spenn@engr.uvic.ca>
Steven Roussey <sroussey@gmail.com>
Subrahmanya Praveen Munukutla <sataya.m@samsung.com>
Suchit Agrawal <a.suchit@samsung.com>
Sudarsana Babu Nagineni <sudarsana.nagineni@intel.com>
Sudarshan Parthasarathy <sudarshan.p@samsung.com>
Sujae Jo <sujae33.jo@gmail.com>
Sujith S S <sujiths.s@samsung.com>
Suneel Kota <suneel.kota@samsung.com>
Sungguk Lim <limasdf@gmail.com>
Sunghoon Kim <shoon.kim@lge.com>
Sungmann Cho <sungmann.cho@gmail.com>
Sungmann Cho <sungmann.cho@navercorp.com>
Sunitha Srivatsa <srivats@amazon.com>
Suyash Sengar <suyash.s@samsung.com>
Sunil Ratnu <sunil.ratnu@samsung.com>
Suvanjan Mukherjee <suvanjanmukherjee@gmail.com>
Swarali Raut <swarali.sr@samsung.com>
Swati Jaiswal <swa.jaiswal@samsung.com>
Sylvain Zimmer <sylvinus@gmail.com>
Sylvestre Ledru <sylvestre.ledru@gmail.com>
Szabolcs David <davidsz@inf.u-szeged.hu>
Szymon Piechowicz <szymonpiechowicz@o2.pl>
Taehoon Lee <taylor.hoon@gmail.com>
Takashi Fujita <tgfjt.mail@gmail.com>
Takeshi Kurosawa <taken.spc@gmail.com>
Tanay Chowdhury <tanay.c@samsung.com>
Tanvir Rizvi <tanvir.rizvi@samsung.com>
Tapu Kumar Ghose <ghose.tapu@gmail.com>
Taylor Price <trprice@gmail.com>
Ted Kim <neot0000@gmail.com>
Ted Vessenes <tedvessenes@gmail.com>
Teodora Novkovic <teodora.petrovic@gmail.com>
Thiago Farina <thiago.farina@gmail.com>
Thiago Marcos P. Santos <thiago.santos@intel.com>
Thomas Butter <tbutter@gmail.com>
Thomas Conti <tomc@amazon.com>
Tiago Vignatti <tiago.vignatti@intel.com>
Tibor Dusnoki <tibor.dusnoki.91@gmail.com>
Tim Ansell <mithro@mithis.com>
Tim Niederhausen <tim@rnc-ag.de>
Timo Reimann <ttr314@googlemail.com>
Tom Callaway <tcallawa@redhat.com>
Tom Harwood <tfh@skip.org>
Torsten Kurbad <google@tk-webart.de>
Tomas Popela <tomas.popela@gmail.com>
Trevor Perrin <unsafe@trevp.net>
Tripta Gupta <tripta.g@samsung.com>
U. Artie Eoff <ullysses.a.eoff@intel.com>
Umar Hansa <umar.hansa@gmail.com>
Upendra Gowda <upendrag.gowda@gmail.com>
Uzair Jaleel <uzair.jaleel@samsung.com>
Vaibhav Agrawal <vaibhav1.a@samsung.com>
Valentin Ilie <valentin.ilie@intel.com>
Vamshikrishna Yellenki <vamshi@motorola.com>
Vani Hegde <vani.hegde@samsung.com>
Vartul Katiyar <vartul.k@samsung.com>
Vedran Šajatović <vedran.sajatovic@gmail.com>
Vernon Tang <vt@foilhead.net>
Viatcheslav Ostapenko <sl.ostapenko@samsung.com>
Victor Costan <costan@gmail.com>
Viet-Trung Luu <viettrungluu@gmail.com>
Vinay Anantharaman <vinaya@adobe.com>
Vipul Bhasin <vipul.bhasin@gmail.com>
Visa Putkinen <v.putkinen@partner.samsung.com>
Vivek Galatage <vivek.vg@samsung.com>
Volker Sorge <volker.sorge@gmail.com>
Waihung Fu <fufranci@amazon.com>
Wanchang Ryu <wanchang.ryu@lge.com>
Wang Qing <wangqing-hf@loongson.cn>
Wesley Lancel <wesleylancel@gmail.com>
Wesley Wigham <t-weswig@microsoft.com>
Wesley Wigham <wwigham@gmail.com>
Will Hirsch <chromium@willhirsch.co.uk>
Will Shackleton <w.shackleton@gmail.com>
William Xie <william.xie@chromium.com>
William Xie <william.xie@intel.com>
Xiang Long <xiang.long@intel.com>
Xiangze Zhang <xiangze.zhang@intel.com>
Xiaofeng Zhang <xiaofeng.zhang@intel.com>
Xiaolei Yu <dreifachstein@gmail.com>
Xiaoshu Zhang <xiaoshu@amazon.com>
Xiaoyin Liu <xiaoyin.l@outlook.com>
Xinchao He <hexinchao@gmail.com>
Xing Zhang <xzhang@adobe.com>
Xinghua Cao <xinghua.cao@intel.com>
Xu Samuel <samuel.xu@intel.com>
Xu Xing <xing.xu@intel.com>
Xuefei Ren <xrenishere@gmail.com>
Xueqing Huang <huangxueqing@xiaomi.com>
Xun Sun <xun.sun@intel.com>
Yael Aharon <yael.aharon@intel.com>
Yair Yogev <progame@chromium.org>
Yan Wang <yan0422.wang@samsung.com>
Yang Gu <yang.gu@intel.com>
Yarin Kaul <yarin.kaul@gmail.com>
Ye Liu <cbakgly@gmail.com>
Yi Shen <yi.shen@samsung.com>
Yi Sun <ratsunny@gmail.com>
Yizhou Jiang <yizhou.jiang@intel.com>
Yoav Weiss <yoav@yoav.ws>
Yoav Zilberberg <yoav.zilberberg@gmail.com>
Yong Shin <sy3620@gmail.com>
Yongsheng Zhu <yongsheng.zhu@intel.com>
Yoonjae Cho <yoonjae.cho92@gmail.com>
Yoshinori Sano <yoshinori.sano@gmail.com>
Youngho Seo <hazivoo@gmail.com>
Youngho Yoo <youngho33.yoo@lge.com>
YoungKi Hong <simon.hong81@gmail.com>
Youngmin Yoo <youngmin.yoo@samsung.com>
Youngsoo Choi <kenshin.choi@samsung.com>
Youngsun Suh <zard17@gmail.com>
Yumikiyo Osanai <yumios.art@gmail.com>
Yunchao He <yunchao.he@intel.com>
Yuri Gorobets <yuri.gorobets@gmail.com>
Zeno Albisser <zeno.albisser@digia.com>
Zhaoze Zhou <zhaoze.zhou@partner.samsung.com>
Zheng Chuang <zhengchuangscu@gmail.com>
Zhenyu Liang <zhenyu.liang@intel.com>
Zhenyu Shan <zhenyu.shan@intel.com>
Zheda Chen <zheda.chen@intel.com>
Zhuoyu Qian <zhuoyu.qian@samsung.com>
Ziran Sun <ziran.sun@samsung.com>
Zoltan Herczeg <zherczeg.u-szeged@partner.samsung.com>
Zoltan Kuscsik <zoltan.kuscsik@linaro.org>
Zsolt Borbely <zsborbely.u-szeged@partner.samsung.com>
Yongha Lee <yongha78.lee@samsung.com>
方觉 (Fang Jue) <fangjue23303@gmail.com>
Yupei Wang <perryuwang@tencent.com>
Peng Hu <penghu@tencent.com>
WenSheng He <wensheng.he@samsung.com>
Raghu Ram Nagaraj <r.nagaraj@samsung.com>
Chanho Park <parkch98@gmail.com>
Payal Pandey <payal.pandey@samsung.com>
Kenneth Strickland <ken.strickland@gmail.com>
Olli Raula (Old name Olli Syrjälä) <olli.raula@intel.com>
Vishal Bhatnagar <vishal.b@samsung.com>
Yunsik Jang <yunsik.jang@lge.com>
Siddharth Bagai <b.siddharth@samsung.com>
Andrei Borza <andrei.borza@gmail.com>
anatoly techtonik <techtonik@gmail.com>
Aleksandar Stojiljkovic <aleksandar.stojiljkovic@intel.com>
Marc des Garets <marc.desgarets@googlemail.com>
Siddharth Shankar <funkysidd@gmail.com>
Eden Wang <nedenwang@tencent.com>
Cathie Chen <cathiechen@tencent.com>
Kyle Plumadore <kyle.plumadore@amd.com>
Sunchang Li <johnstonli@tencent.com>
Yeol Park <peary2@gmail.com>
Debug Wang <debugwang@tencent.com>
Zeqin Chen <talonchen@tencent.com>
Yong Wang <ccyongwang@tencent.com>
Charles Vaughn <cvaughn@gmail.com>
Ernesto Mudu <ernesto.mudu@gmail.com>
Zhifei Fang <facetothefate@gmail.com>
Timo Witte <timo.witte@gmail.com>
Pierre Neter <pierreneter@gmail.com>
Jan Rucka <ruckajan10@gmail.com>
Yannic Bonenberger <contact@yannic-bonenberger.com>
ACCESS CO., LTD. <*@access-company.com>
BlackBerry Limited <*@blackberry.com>
Code Aurora Forum <*@codeaurora.org>
Comodo CA Limited
Endless Mobile, Inc. <*@endlessm.com>
Google Inc. <*@google.com>
Hewlett-Packard Development Company, L.P. <*@hp.com>
Igalia S.L. <*@igalia.com>
NIKE, Inc. <*@nike.com>
Loongson Technology Corporation Limited. <*@loongson.cn>
NVIDIA Corporation <*@nvidia.com>
Neverware Inc. <*@neverware.com>
Opera Software ASA <*@opera.com>
Spotify AB <*@spotify.com>
TeamSpeak Systems GmbH <*@teamspeak.com>
The Chromium Authors <*@chromium.org>
The MathWorks, Inc. <binod.pant@mathworks.com>
Torchmobile Inc.
Venture 3 Systems LLC <*@venture3systems.com>
Yandex LLC <*@yandex-team.ru>
ARM Holdings <*@arm.com>
Macadamian <*@macadamian.com>
IBM Inc. <*@*.ibm.com>
Tableau Software <*@tableau.com>
Akamai Inc. <*@akamai.com>
Impossible Dreams Network <*@impossibledreams.net>
Facebook, Inc. <*@fb.com>
Facebook, Inc. <*@oculus.com>
Canonical Limited <*@canonical.com>
Seznam.cz, a.s. <*@firma.seznam.cz>
LG Electronics, Inc. <*@lge.com>
Vewd Software AS <*@vewd.com>

1151
BUILD.gn Normal file

File diff suppressed because it is too large Load Diff

27
LICENSE Normal file
View File

@ -0,0 +1,27 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

27
LICENSE.chromium_os Normal file
View File

@ -0,0 +1,27 @@
// Copyright (c) 2006-2009 The Chromium OS Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

993
android_webview/BUILD.gn Normal file
View File

@ -0,0 +1,993 @@
# Copyright 2015 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("//android_webview/system_webview_apk_tmpl.gni")
import("//android_webview/webview_repack_locales.gni")
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//build/config/locales.gni")
import("//components/spellcheck/spellcheck_build_features.gni")
import("//tools/grit/repack.gni")
import("//tools/resources/generate_resource_whitelist.gni")
declare_args() {
# Package name of the system_webview_apk target.
system_webview_package_name = "com.android.webview"
}
if (!defined(use_unpublished_apis)) {
use_unpublished_apis = false
}
if (enable_resource_whitelist_generation) {
system_webview_pak_whitelist =
"$target_gen_dir/system_webview_pak_whitelist.txt"
}
system_webview_android_manifest =
"$target_gen_dir/system_webview_apk/AndroidManifest.xml"
group("android_webview") {
if (!use_unpublished_apis) {
deps = [
":system_webview_apk",
]
}
}
generate_jni("native_jni") {
sources = [
"java/src/org/chromium/android_webview/AndroidProtocolHandler.java",
"java/src/org/chromium/android_webview/AwAutofillClient.java",
"java/src/org/chromium/android_webview/AwBrowserProcess.java",
"java/src/org/chromium/android_webview/AwContents.java",
"java/src/org/chromium/android_webview/AwContentsBackgroundThreadClient.java",
"java/src/org/chromium/android_webview/AwContentsClientBridge.java",
"java/src/org/chromium/android_webview/AwContentsIoThreadClient.java",
"java/src/org/chromium/android_webview/AwContentsLifecycleNotifier.java",
"java/src/org/chromium/android_webview/AwContentsStatics.java",
"java/src/org/chromium/android_webview/AwCookieManager.java",
"java/src/org/chromium/android_webview/AwDebug.java",
"java/src/org/chromium/android_webview/AwDevToolsServer.java",
"java/src/org/chromium/android_webview/AwFormDatabase.java",
"java/src/org/chromium/android_webview/AwGLFunctor.java",
"java/src/org/chromium/android_webview/AwHttpAuthHandler.java",
"java/src/org/chromium/android_webview/AwMetricsLogUploader.java",
"java/src/org/chromium/android_webview/AwMetricsServiceClient.java",
"java/src/org/chromium/android_webview/AwPdfExporter.java",
"java/src/org/chromium/android_webview/AwPicture.java",
"java/src/org/chromium/android_webview/AwQuotaManagerBridge.java",
"java/src/org/chromium/android_webview/AwResource.java",
"java/src/org/chromium/android_webview/AwSettings.java",
"java/src/org/chromium/android_webview/AwTokenBindingManager.java",
"java/src/org/chromium/android_webview/AwWebContentsDelegate.java",
"java/src/org/chromium/android_webview/AwWebResourceResponse.java",
"java/src/org/chromium/android_webview/InputStreamUtil.java",
"java/src/org/chromium/android_webview/JavaBrowserViewRendererHelper.java",
"java/src/org/chromium/android_webview/PopupTouchHandleDrawable.java",
"java/src/org/chromium/android_webview/permission/AwPermissionRequest.java",
]
jni_package = "android_webview"
deps = [
":cancellation_signal_android_jar_jni_headers",
]
}
generate_jar_jni("cancellation_signal_android_jar_jni_headers") {
classes = [ "android/os/CancellationSignal.class" ]
jni_package = "android_webview"
}
java_cpp_enum("aw_permission_request_resource") {
sources = [
"browser/permission/aw_permission_request.h",
]
}
java_cpp_enum("android_webview_java_enums_srcjar") {
sources = [
"browser/aw_renderer_priority.h",
]
}
java_cpp_enum("aw_error_ui") {
sources = [
"browser/aw_safe_browsing_blocking_page.h",
]
}
java_cpp_enum("aw_safe_browsing_action") {
sources = [
"browser/aw_url_checker_delegate_impl.h",
]
}
jinja_template("system_webview_manifest") {
input = "apk/java/AndroidManifest.xml"
output = system_webview_android_manifest
variables = [ "package=$system_webview_package_name" ]
}
webview_repack_locales("repack_locales") {
input_locales = locales
output_locales = locales
if (enable_resource_whitelist_generation) {
repack_whitelist = system_webview_pak_whitelist
deps = [
":system_webview_pak_whitelist",
]
}
}
android_assets("locale_pak_assets") {
disable_compression = true
renaming_sources = []
renaming_destinations = []
foreach(_locale, locales) {
renaming_sources += [ "$root_out_dir/android_webview/locales/$_locale.pak" ]
renaming_destinations += [ "stored-locales/$_locale.pak" ]
}
deps = [
":repack_locales",
]
}
repack("repack_pack") {
sources = [
"$root_gen_dir/blink/public/resources/blink_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$target_gen_dir/aw_resources.pak",
"$target_gen_dir/components_resources.pak",
"$target_gen_dir/webui_resources.pak",
]
deps = [
":generate_aw_resources",
":generate_components_resources",
":generate_webui_resources",
"//content:resources",
"//net:net_resources",
"//third_party/WebKit/public:resources",
]
output = "$target_gen_dir/resources.pak"
if (enable_resource_whitelist_generation) {
repack_whitelist = system_webview_pak_whitelist
deps += [ ":system_webview_pak_whitelist" ]
}
}
repack("repack_100_percent") {
sources = [
"$root_gen_dir/blink/public/resources/blink_scaled_resources_100_percent.pak",
"$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
]
deps = [
"//content/app/resources",
"//third_party/WebKit/public:scaled_resources_100_percent",
"//ui/resources",
]
output = "$target_gen_dir/chrome_100_percent.pak"
if (enable_resource_whitelist_generation) {
repack_whitelist = system_webview_pak_whitelist
deps += [ ":system_webview_pak_whitelist" ]
}
}
android_assets("pak_file_assets") {
sources = [
"$target_gen_dir/chrome_100_percent.pak",
"$target_gen_dir/resources.pak",
]
deps = [
":repack_100_percent",
":repack_pack",
]
disable_compression = true
}
# These assets are needed by both monochrome and stand alone WebView, but not by
# Chrome.
android_assets("monochrome_webview_assets") {
deps = [
"//third_party/icu:icu_assets",
"//v8:v8_external_startup_data_assets",
]
if (android_64bit_target_cpu && build_apk_secondary_abi) {
deps += [ ":v8_snapshot_secondary_abi_assets" ]
}
}
android_assets("assets") {
deps = [
":license_assets",
":locale_pak_assets",
":monochrome_webview_assets",
":pak_file_assets",
]
}
java_group("stub_assets") {
deps = [
":license_assets",
]
}
android_assets("license_assets") {
renaming_sources = [ "$root_gen_dir/components/resources/about_credits.html" ]
renaming_destinations = [ "webview_licenses.notice" ]
deps = [
"//components/resources:about_credits",
]
}
android_resources("system_webview_resources") {
resource_dirs = [ "apk/java/res" ]
custom_package = system_webview_package_name
}
android_resources("resources") {
resource_dirs = [ "java/res" ]
custom_package = "org.chromium.android_webview"
deps = [
":strings_grd",
]
}
grit("generate_aw_resources") {
source = "ui/aw_resources.grd"
outputs = [
"grit/aw_resources.h",
"aw_resources.pak",
]
}
grit("generate_aw_strings") {
source = "ui/aw_strings.grd"
outputs = [
"grit/aw_strings.h",
]
foreach(_locale, locales) {
outputs += [ "aw_strings_${_locale}.pak" ]
}
}
grit("generate_webui_resources") {
source = "../ui/webui/resources/webui_resources.grd"
# The .grd contains references to generated files.
source_is_generated = true
# webui/resources has way too many resources. The whitelist is trim this down
# to a reasonable size
whitelist = rebase_path("ui/grit_resources_whitelist.txt")
inputs = [
whitelist,
]
grit_flags = [
"-w",
whitelist,
]
outputs = [
"grit/webui_resources.h",
"grit/webui_resources_map.cc",
"grit/webui_resources_map.h",
"webui_resources.pak",
]
}
grit("generate_components_resources") {
source = "../components/resources/components_resources.grd"
# The .grd contains references to generated files.
source_is_generated = true
# See :generate_webui_resources for an explanation of the whitelist
whitelist = rebase_path("ui/grit_resources_whitelist.txt")
inputs = [
whitelist,
]
grit_flags = [
"-w",
whitelist,
]
outputs = [
"grit/components_resources.h",
"components_resources.pak",
]
deps = [
"//components/resources:components_resources",
]
}
grit("generate_components_strings") {
source = "../components/components_strings.grd"
# components_strings contains strings from all components. WebView
# will never display most of them, so we try to limit the included
# strings. This whitelist trims about 50% more than the compile-based
# whitelist generated by :system_webview_pak_whitelist.
whitelist = rebase_path("ui/grit_strings_whitelist.txt")
inputs = [
whitelist,
]
grit_flags = [
"-w",
whitelist,
]
outputs = [
"grit/components_strings.h",
"java/res/values-am/components_strings.xml",
"java/res/values-ar/components_strings.xml",
"java/res/values-bg/components_strings.xml",
"java/res/values-ca/components_strings.xml",
"java/res/values-cs/components_strings.xml",
"java/res/values-da/components_strings.xml",
"java/res/values-de/components_strings.xml",
"java/res/values-el/components_strings.xml",
"java/res/values-en-rGB/components_strings.xml",
"java/res/values-es-rUS/components_strings.xml",
"java/res/values-es/components_strings.xml",
"java/res/values-fa/components_strings.xml",
"java/res/values-fi/components_strings.xml",
"java/res/values-fr/components_strings.xml",
"java/res/values-hi/components_strings.xml",
"java/res/values-hr/components_strings.xml",
"java/res/values-hu/components_strings.xml",
"java/res/values-in/components_strings.xml",
"java/res/values-it/components_strings.xml",
"java/res/values-iw/components_strings.xml",
"java/res/values-ja/components_strings.xml",
"java/res/values-ko/components_strings.xml",
"java/res/values-lt/components_strings.xml",
"java/res/values-lv/components_strings.xml",
"java/res/values-nb/components_strings.xml",
"java/res/values-nl/components_strings.xml",
"java/res/values-pl/components_strings.xml",
"java/res/values-pt-rBR/components_strings.xml",
"java/res/values-pt-rPT/components_strings.xml",
"java/res/values-ro/components_strings.xml",
"java/res/values-ru/components_strings.xml",
"java/res/values-sk/components_strings.xml",
"java/res/values-sl/components_strings.xml",
"java/res/values-sr/components_strings.xml",
"java/res/values-sv/components_strings.xml",
"java/res/values-sw/components_strings.xml",
"java/res/values-th/components_strings.xml",
"java/res/values-tl/components_strings.xml",
"java/res/values-tr/components_strings.xml",
"java/res/values-uk/components_strings.xml",
"java/res/values-vi/components_strings.xml",
"java/res/values-zh-rCN/components_strings.xml",
"java/res/values-zh-rTW/components_strings.xml",
"java/res/values/components_strings.xml",
]
foreach(_locale, locales_with_fake_bidi) {
outputs += [ "components_strings_${_locale}.pak" ]
}
}
source_set("webview_entry_point") {
deps = [
":common",
]
sources = [
"lib/webview_entry_point.cc",
]
}
shared_library("libwebviewchromium") {
deps = [
":webview_entry_point",
]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ "//build/config/android:hide_all_but_jni" ]
}
if (android_64bit_target_cpu) {
android_assets("v8_snapshot_secondary_abi_assets") {
_secondary_abi_out_dir =
get_label_info("//v8($android_secondary_abi_toolchain)", "root_out_dir")
assert(android_64bit_target_cpu,
"32-bit targets shouldn't have secondary abi")
arch_suffix = "32"
renaming_sources = [ "$_secondary_abi_out_dir/snapshot_blob.bin" ]
renaming_destinations = [ "snapshot_blob_$arch_suffix.bin" ]
disable_compression = true
deps = [
"//v8($android_secondary_abi_toolchain)",
]
}
shared_library("monochrome") {
deps = [
":webview_entry_point",
]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ "//build/config/android:hide_all_but_jni" ]
}
}
if (enable_resource_whitelist_generation) {
generate_resource_whitelist("system_webview_pak_whitelist") {
deps = [
":libwebviewchromium",
]
input = "$root_out_dir/libwebviewchromium$shlib_extension.whitelist"
output = system_webview_pak_whitelist
}
}
source_set("common") {
sources = [
"browser/address_parser.cc",
"browser/address_parser.h",
"browser/address_parser_internal.cc",
"browser/address_parser_internal.h",
"browser/android_protocol_handler.cc",
"browser/android_protocol_handler.h",
"browser/aw_autofill_client.cc",
"browser/aw_autofill_client.h",
"browser/aw_browser_context.cc",
"browser/aw_browser_context.h",
"browser/aw_browser_main_parts.cc",
"browser/aw_browser_main_parts.h",
"browser/aw_browser_permission_request_delegate.h",
"browser/aw_browser_policy_connector.cc",
"browser/aw_browser_policy_connector.h",
"browser/aw_browser_terminator.cc",
"browser/aw_browser_terminator.h",
"browser/aw_content_browser_client.cc",
"browser/aw_content_browser_client.h",
"browser/aw_contents.cc",
"browser/aw_contents.h",
"browser/aw_contents_client_bridge.cc",
"browser/aw_contents_client_bridge.h",
"browser/aw_contents_io_thread_client.cc",
"browser/aw_contents_io_thread_client.h",
"browser/aw_contents_lifecycle_notifier.cc",
"browser/aw_contents_lifecycle_notifier.h",
"browser/aw_contents_statics.cc",
"browser/aw_cookie_access_policy.cc",
"browser/aw_cookie_access_policy.h",
"browser/aw_debug.cc",
"browser/aw_devtools_manager_delegate.cc",
"browser/aw_devtools_manager_delegate.h",
"browser/aw_devtools_server.cc",
"browser/aw_devtools_server.h",
"browser/aw_download_manager_delegate.cc",
"browser/aw_download_manager_delegate.h",
"browser/aw_field_trial_creator.cc",
"browser/aw_field_trial_creator.h",
"browser/aw_form_database.cc",
"browser/aw_form_database_service.cc",
"browser/aw_form_database_service.h",
"browser/aw_gl_functor.cc",
"browser/aw_gl_functor.h",
"browser/aw_gl_surface.cc",
"browser/aw_gl_surface.h",
"browser/aw_http_auth_handler.cc",
"browser/aw_http_auth_handler.h",
"browser/aw_javascript_dialog_manager.cc",
"browser/aw_javascript_dialog_manager.h",
"browser/aw_login_delegate.cc",
"browser/aw_login_delegate.h",
"browser/aw_media_url_interceptor.cc",
"browser/aw_media_url_interceptor.h",
"browser/aw_metrics_log_uploader.cc",
"browser/aw_metrics_log_uploader.h",
"browser/aw_metrics_service_client.cc",
"browser/aw_metrics_service_client.h",
"browser/aw_pdf_exporter.cc",
"browser/aw_pdf_exporter.h",
"browser/aw_permission_manager.cc",
"browser/aw_permission_manager.h",
"browser/aw_picture.cc",
"browser/aw_picture.h",
"browser/aw_print_manager.cc",
"browser/aw_print_manager.h",
"browser/aw_printing_message_filter.cc",
"browser/aw_printing_message_filter.h",
"browser/aw_quota_manager_bridge.cc",
"browser/aw_quota_manager_bridge.h",
"browser/aw_quota_permission_context.cc",
"browser/aw_quota_permission_context.h",
"browser/aw_render_process_gone_delegate.h",
"browser/aw_render_thread_context_provider.cc",
"browser/aw_render_thread_context_provider.h",
"browser/aw_renderer_priority.h",
"browser/aw_resource_context.cc",
"browser/aw_resource_context.h",
"browser/aw_result_codes.h",
"browser/aw_safe_browsing_blocking_page.cc",
"browser/aw_safe_browsing_blocking_page.h",
"browser/aw_safe_browsing_config_helper.cc",
"browser/aw_safe_browsing_config_helper.h",
"browser/aw_safe_browsing_resource_throttle.cc",
"browser/aw_safe_browsing_resource_throttle.h",
"browser/aw_safe_browsing_ui_manager.cc",
"browser/aw_safe_browsing_ui_manager.h",
"browser/aw_safe_browsing_whitelist_manager.cc",
"browser/aw_safe_browsing_whitelist_manager.h",
"browser/aw_settings.cc",
"browser/aw_settings.h",
"browser/aw_ssl_host_state_delegate.cc",
"browser/aw_ssl_host_state_delegate.h",
"browser/aw_url_checker_delegate_impl.cc",
"browser/aw_url_checker_delegate_impl.h",
"browser/aw_variations_service_client.cc",
"browser/aw_variations_service_client.h",
"browser/aw_web_contents_delegate.cc",
"browser/aw_web_contents_delegate.h",
"browser/aw_web_contents_view_delegate.cc",
"browser/aw_web_contents_view_delegate.h",
"browser/aw_web_ui_controller_factory.cc",
"browser/aw_web_ui_controller_factory.h",
"browser/browser_view_renderer.cc",
"browser/browser_view_renderer.h",
"browser/browser_view_renderer_client.h",
"browser/child_frame.cc",
"browser/child_frame.h",
"browser/command_line_helper.cc",
"browser/command_line_helper.h",
"browser/compositor_frame_consumer.h",
"browser/compositor_frame_producer.h",
"browser/compositor_id.cc",
"browser/compositor_id.h",
"browser/cookie_manager.cc",
"browser/deferred_gpu_command_service.cc",
"browser/deferred_gpu_command_service.h",
"browser/find_helper.cc",
"browser/find_helper.h",
"browser/gl_view_renderer_manager.cc",
"browser/gl_view_renderer_manager.h",
"browser/hardware_renderer.cc",
"browser/hardware_renderer.h",
"browser/icon_helper.cc",
"browser/icon_helper.h",
"browser/input_stream.cc",
"browser/input_stream.h",
"browser/java_browser_view_renderer_helper.cc",
"browser/java_browser_view_renderer_helper.h",
"browser/net/android_stream_reader_url_request_job.cc",
"browser/net/android_stream_reader_url_request_job.h",
"browser/net/aw_cookie_store_wrapper.cc",
"browser/net/aw_cookie_store_wrapper.h",
"browser/net/aw_http_user_agent_settings.cc",
"browser/net/aw_http_user_agent_settings.h",
"browser/net/aw_network_change_notifier.cc",
"browser/net/aw_network_change_notifier.h",
"browser/net/aw_network_change_notifier_factory.cc",
"browser/net/aw_network_change_notifier_factory.h",
"browser/net/aw_network_delegate.cc",
"browser/net/aw_network_delegate.h",
"browser/net/aw_request_interceptor.cc",
"browser/net/aw_request_interceptor.h",
"browser/net/aw_url_request_context_getter.cc",
"browser/net/aw_url_request_context_getter.h",
"browser/net/aw_url_request_job_factory.cc",
"browser/net/aw_url_request_job_factory.h",
"browser/net/aw_web_resource_request.cc",
"browser/net/aw_web_resource_request.h",
"browser/net/aw_web_resource_response.cc",
"browser/net/aw_web_resource_response.h",
"browser/net/init_native_callback.cc",
"browser/net/init_native_callback.h",
"browser/net/input_stream_reader.cc",
"browser/net/input_stream_reader.h",
"browser/net/token_binding_manager.cc",
"browser/net/token_binding_manager.h",
"browser/parent_compositor_draw_constraints.cc",
"browser/parent_compositor_draw_constraints.h",
"browser/parent_output_surface.cc",
"browser/parent_output_surface.h",
"browser/permission/aw_permission_request.cc",
"browser/permission/aw_permission_request.h",
"browser/permission/aw_permission_request_delegate.cc",
"browser/permission/aw_permission_request_delegate.h",
"browser/permission/media_access_permission_request.cc",
"browser/permission/media_access_permission_request.h",
"browser/permission/permission_request_handler.cc",
"browser/permission/permission_request_handler.h",
"browser/permission/permission_request_handler_client.cc",
"browser/permission/permission_request_handler_client.h",
"browser/permission/simple_permission_request.cc",
"browser/permission/simple_permission_request.h",
"browser/popup_touch_handle_drawable.cc",
"browser/popup_touch_handle_drawable.h",
"browser/render_thread_manager.cc",
"browser/render_thread_manager.h",
"browser/render_thread_manager_client.h",
"browser/renderer_host/auto_login_parser.cc",
"browser/renderer_host/auto_login_parser.h",
"browser/renderer_host/aw_render_view_host_ext.cc",
"browser/renderer_host/aw_render_view_host_ext.h",
"browser/renderer_host/aw_resource_dispatcher_host_delegate.cc",
"browser/renderer_host/aw_resource_dispatcher_host_delegate.h",
"browser/scoped_app_gl_state_restore.cc",
"browser/scoped_app_gl_state_restore.h",
"browser/state_serializer.cc",
"browser/state_serializer.h",
"browser/surfaces_instance.cc",
"browser/surfaces_instance.h",
"browser/token_binding_manager_bridge.cc",
"browser/tracing/aw_tracing_delegate.cc",
"browser/tracing/aw_tracing_delegate.h",
"common/android_webview_message_generator.cc",
"common/android_webview_message_generator.h",
"common/aw_content_client.cc",
"common/aw_content_client.h",
"common/aw_descriptors.h",
"common/aw_hit_test_data.cc",
"common/aw_hit_test_data.h",
"common/aw_media_drm_bridge_client.cc",
"common/aw_media_drm_bridge_client.h",
"common/aw_paths.cc",
"common/aw_paths.h",
"common/aw_resource.cc",
"common/aw_resource.h",
"common/aw_switches.cc",
"common/aw_switches.h",
"common/crash_reporter/aw_microdump_crash_reporter.cc",
"common/crash_reporter/aw_microdump_crash_reporter.h",
"common/crash_reporter/crash_keys.cc",
"common/crash_reporter/crash_keys.h",
"common/devtools_instrumentation.h",
"common/render_view_messages.cc",
"common/render_view_messages.h",
"common/url_constants.cc",
"common/url_constants.h",
"gpu/aw_content_gpu_client.cc",
"gpu/aw_content_gpu_client.h",
"lib/aw_main_delegate.cc",
"lib/aw_main_delegate.h",
"lib/webview_jni_onload.cc",
"lib/webview_jni_onload.h",
"public/browser/draw_gl.h",
"public/browser/draw_sw.h",
"renderer/aw_content_renderer_client.cc",
"renderer/aw_content_renderer_client.h",
"renderer/aw_content_settings_client.cc",
"renderer/aw_content_settings_client.h",
"renderer/aw_key_systems.cc",
"renderer/aw_key_systems.h",
"renderer/aw_print_render_frame_helper_delegate.cc",
"renderer/aw_print_render_frame_helper_delegate.h",
"renderer/aw_render_frame_ext.cc",
"renderer/aw_render_frame_ext.h",
"renderer/aw_render_thread_observer.cc",
"renderer/aw_render_thread_observer.h",
"renderer/aw_render_view_ext.cc",
"renderer/aw_render_view_ext.h",
"renderer/print_render_frame_observer.cc",
"renderer/print_render_frame_observer.h",
]
deps = [
":generate_aw_resources",
":generate_aw_strings",
":generate_components_strings",
":native_jni",
"//android_webview:generate_components_strings",
"//android_webview/common:version",
"//base",
"//base/third_party/dynamic_annotations:dynamic_annotations",
"//components/autofill/android:provider",
"//components/autofill/content/browser",
"//components/autofill/content/renderer",
"//components/cdm/browser",
"//components/cdm/renderer",
"//components/crash/content/app",
"//components/crash/content/browser",
"//components/google/core/browser",
"//components/metrics",
"//components/metrics:gpu",
"//components/metrics:net",
"//components/metrics:ui",
"//components/navigation_interception",
"//components/network_session_configurator/common",
"//components/policy:generated",
"//components/policy/core/browser",
"//components/prefs",
"//components/printing/browser",
"//components/printing/common",
"//components/printing/renderer",
"//components/safe_browsing",
"//components/safe_browsing/browser",
"//components/safe_browsing/common",
"//components/safe_browsing/db:safe_browsing_mobile",
"//components/safe_browsing/renderer:throttles",
"//components/safe_browsing/triggers",
"//components/safe_browsing/web_ui",
"//components/spellcheck:build_features",
"//components/supervised_user_error_page",
"//components/supervised_user_error_page:gin",
"//components/url_matcher",
"//components/variations/service",
"//components/version_info",
"//components/visitedlink/browser",
"//components/visitedlink/renderer",
"//components/viz/service",
"//components/web_contents_delegate_android:web_contents_delegate_android",
"//components/web_restrictions:browser",
"//content",
"//content/public/app:both",
"//content/public/browser",
"//content/public/common:content_descriptor_keys",
"//content/public/common:service_names",
"//crypto",
"//gin",
"//gpu/command_buffer/client:gles2_c_lib",
"//gpu/command_buffer/client:gles2_implementation",
"//gpu/command_buffer/common:gles2_utils",
"//gpu/command_buffer/service",
"//gpu/config:crash_keys",
"//gpu/ipc:gl_in_process_context",
"//gpu/skia_bindings",
"//media",
"//media/midi",
"//net",
"//net:extras",
"//printing",
"//services/service_manager/public/cpp",
"//services/viz/public/interfaces",
"//skia",
"//storage/browser",
"//storage/common",
"//third_party/WebKit/public:blink",
"//ui/base",
"//ui/events:gesture_detection",
"//ui/gfx",
"//ui/gl",
"//ui/gl/init",
"//ui/shell_dialogs",
"//v8",
]
if (enable_spellcheck) {
deps += [
"//components/spellcheck/browser",
"//components/spellcheck/renderer",
]
}
configs += [ "//v8:external_startup_data" ]
libs = [ "jnigraphics" ]
}
android_library("android_webview_java") {
java_files = [
"java/src/org/chromium/android_webview/AndroidProtocolHandler.java",
"java/src/org/chromium/android_webview/AutofillActionModeCallback.java",
"java/src/org/chromium/android_webview/AwActionModeCallback.java",
"java/src/org/chromium/android_webview/AwAutofillClient.java",
"java/src/org/chromium/android_webview/AwAutofillManager.java",
"java/src/org/chromium/android_webview/AwAutofillProvider.java",
"java/src/org/chromium/android_webview/AwBrowserContext.java",
"java/src/org/chromium/android_webview/AwBrowserProcess.java",
"java/src/org/chromium/android_webview/AwContentVideoViewEmbedder.java",
"java/src/org/chromium/android_webview/AwContents.java",
"java/src/org/chromium/android_webview/AwConsoleMessage.java",
"java/src/org/chromium/android_webview/AwContentsBackgroundThreadClient.java",
"java/src/org/chromium/android_webview/AwContentsClient.java",
"java/src/org/chromium/android_webview/AwContentsClientBridge.java",
"java/src/org/chromium/android_webview/AwContentsClientCallbackHelper.java",
"java/src/org/chromium/android_webview/AwContentsIoThreadClient.java",
"java/src/org/chromium/android_webview/AwContentsLifecycleNotifier.java",
"java/src/org/chromium/android_webview/AwContentsStatics.java",
"java/src/org/chromium/android_webview/AwCookieManager.java",
"java/src/org/chromium/android_webview/AwDebug.java",
"java/src/org/chromium/android_webview/AwDevToolsServer.java",
"java/src/org/chromium/android_webview/AwFormDatabase.java",
"java/src/org/chromium/android_webview/AwGeolocationPermissions.java",
"java/src/org/chromium/android_webview/AwGLFunctor.java",
"java/src/org/chromium/android_webview/AwHttpAuthHandler.java",
"java/src/org/chromium/android_webview/AwLayoutSizer.java",
"java/src/org/chromium/android_webview/AwMetricsLogUploader.java",
"java/src/org/chromium/android_webview/AwMetricsServiceClient.java",
"java/src/org/chromium/android_webview/AwNetworkChangeNotifierRegistrationPolicy.java",
"java/src/org/chromium/android_webview/AwPdfExporter.java",
"java/src/org/chromium/android_webview/AwPicture.java",
"java/src/org/chromium/android_webview/AwPrintDocumentAdapter.java",
"java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java",
"java/src/org/chromium/android_webview/AwSafeBrowsingResponse.java",
"java/src/org/chromium/android_webview/AwQuotaManagerBridge.java",
"java/src/org/chromium/android_webview/AwRenderProcessGoneDetail.java",
"java/src/org/chromium/android_webview/AwResource.java",
"java/src/org/chromium/android_webview/AwSafeBrowsingConversionHelper.java",
"java/src/org/chromium/android_webview/AwScrollOffsetManager.java",
"java/src/org/chromium/android_webview/AwServiceWorkerClient.java",
"java/src/org/chromium/android_webview/AwServiceWorkerController.java",
"java/src/org/chromium/android_webview/AwServiceWorkerSettings.java",
"java/src/org/chromium/android_webview/AwSettings.java",
"java/src/org/chromium/android_webview/AwSwitches.java",
"java/src/org/chromium/android_webview/AwTokenBindingManager.java",
"java/src/org/chromium/android_webview/AwViewMethods.java",
"java/src/org/chromium/android_webview/AwViewAndroidDelegate.java",
"java/src/org/chromium/android_webview/AwWebContentsDelegate.java",
"java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java",
"java/src/org/chromium/android_webview/AwWebContentsObserver.java",
"java/src/org/chromium/android_webview/AwWebResourceResponse.java",
"java/src/org/chromium/android_webview/AwZoomControls.java",
"java/src/org/chromium/android_webview/CleanupReference.java",
"java/src/org/chromium/android_webview/ClientCertLookupTable.java",
"java/src/org/chromium/android_webview/DefaultVideoPosterRequestHandler.java",
"java/src/org/chromium/android_webview/ErrorCodeConversionHelper.java",
"java/src/org/chromium/android_webview/FullScreenView.java",
"java/src/org/chromium/android_webview/HttpAuthDatabase.java",
"java/src/org/chromium/android_webview/InputStreamUtil.java",
"java/src/org/chromium/android_webview/JavaBrowserViewRendererHelper.java",
"java/src/org/chromium/android_webview/JsPromptResultReceiver.java",
"java/src/org/chromium/android_webview/JsResultHandler.java",
"java/src/org/chromium/android_webview/JsResultReceiver.java",
"java/src/org/chromium/android_webview/NullAwViewMethods.java",
"java/src/org/chromium/android_webview/OverScrollGlow.java",
"java/src/org/chromium/android_webview/PopupTouchHandleDrawable.java",
"java/src/org/chromium/android_webview/ResourcesContextWrapperFactory.java",
"java/src/org/chromium/android_webview/ScrollAccessibilityHelper.java",
"java/src/org/chromium/android_webview/SslUtil.java",
"java/src/org/chromium/android_webview/permission/AwGeolocationCallback.java",
"java/src/org/chromium/android_webview/permission/AwPermissionRequest.java",
"java/src/org/chromium/android_webview/policy/AwPolicyProvider.java",
"java/src/org/chromium/android_webview/variations/AwVariationsConfigurationService.java",
"java/src/org/chromium/android_webview/variations/AwVariationsSeedFetchService.java",
"java/src/org/chromium/android_webview/variations/AwVariationsSeedHandler.java",
"java/src/org/chromium/android_webview/variations/AwVariationsUtils.java",
]
deps = [
":android_webview_commandline_java",
":android_webview_crash_services_java",
":android_webview_platform_services_java",
":resources",
":strings_grd",
":system_webview_manifest",
"//base:base_java",
"//components/autofill/android:autofill_java",
"//components/autofill/android:provider_java",
"//components/background_task_scheduler:background_task_scheduler_java",
"//components/crash/android:java",
"//components/minidump_uploader:minidump_uploader_java",
"//components/navigation_interception/android:navigation_interception_java",
"//components/policy/android:policy_java",
"//components/safe_browsing/android:safe_browsing_java",
"//components/variations/android:variations_java",
"//components/web_contents_delegate_android:web_contents_delegate_android_java",
"//components/web_restrictions:client_java",
"//content/public/android:content_java",
"//device/gamepad:java",
"//device/geolocation:geolocation_java",
"//net/android:net_java",
"//third_party/WebKit/public:blink_headers_java",
"//third_party/android_tools:android_support_annotations_java",
"//ui/android:ui_java",
]
if (enable_spellcheck) {
deps += [ "//components/spellcheck/browser/android:java" ]
}
srcjar_deps = [
":aw_permission_request_resource",
":android_webview_java_enums_srcjar",
":aw_error_ui",
":aw_safe_browsing_action",
"//components/safe_browsing/db:sb_threat_values",
]
# Manifest used for linting (determining unused resources).
android_manifest = system_webview_android_manifest
}
java_strings_grd("strings_grd") {
grd_file = "java/strings/android_webview_strings.grd"
outputs = [
"values-am/android_webview_strings.xml",
"values-ar/android_webview_strings.xml",
"values-bg/android_webview_strings.xml",
"values-ca/android_webview_strings.xml",
"values-cs/android_webview_strings.xml",
"values-da/android_webview_strings.xml",
"values-de/android_webview_strings.xml",
"values-el/android_webview_strings.xml",
"values-en-rGB/android_webview_strings.xml",
"values-es-rUS/android_webview_strings.xml",
"values-es/android_webview_strings.xml",
"values-fa/android_webview_strings.xml",
"values-fi/android_webview_strings.xml",
"values-fr/android_webview_strings.xml",
"values-hi/android_webview_strings.xml",
"values-hr/android_webview_strings.xml",
"values-hu/android_webview_strings.xml",
"values-in/android_webview_strings.xml",
"values-it/android_webview_strings.xml",
"values-iw/android_webview_strings.xml",
"values-ja/android_webview_strings.xml",
"values-ko/android_webview_strings.xml",
"values-lt/android_webview_strings.xml",
"values-lv/android_webview_strings.xml",
"values-nb/android_webview_strings.xml",
"values-nl/android_webview_strings.xml",
"values-pl/android_webview_strings.xml",
"values-pt-rBR/android_webview_strings.xml",
"values-pt-rPT/android_webview_strings.xml",
"values-ro/android_webview_strings.xml",
"values-ru/android_webview_strings.xml",
"values-sk/android_webview_strings.xml",
"values-sl/android_webview_strings.xml",
"values-sr/android_webview_strings.xml",
"values-sv/android_webview_strings.xml",
"values-sw/android_webview_strings.xml",
"values-th/android_webview_strings.xml",
"values-tl/android_webview_strings.xml",
"values-tr/android_webview_strings.xml",
"values-uk/android_webview_strings.xml",
"values-vi/android_webview_strings.xml",
"values-zh-rCN/android_webview_strings.xml",
"values-zh-rTW/android_webview_strings.xml",
"values/android_webview_strings.xml",
]
}
# Separate target to allow for a dependency on GmsCore without pulling in all of
# android_webview_java.
android_library("android_webview_platform_services_java") {
java_files =
[ "java/src/org/chromium/android_webview/PlatformServiceBridge.java" ]
deps = [
"//base:base_java",
]
}
android_library("android_webview_commandline_java") {
java_files = [ "java/src/org/chromium/android_webview/command_line/CommandLineUtil.java" ]
deps = [
"//base:base_java",
]
}
# Keep crash services separate from other WebView code to keep their deps clean
# (and make them easy to move).
android_library("android_webview_crash_services_java") {
java_files = [
"java/src/org/chromium/android_webview/crash/AwMinidumpUploadJobService.java",
"java/src/org/chromium/android_webview/crash/AwMinidumpUploaderDelegate.java",
"java/src/org/chromium/android_webview/crash/CrashReceiverService.java",
]
deps = [
":android_webview_commandline_java",
":android_webview_platform_services_java",
"//base:base_java",
"//components/background_task_scheduler:background_task_scheduler_java",
"//components/minidump_uploader:minidump_uploader_java",
]
srcjar_deps = [ ":crash_receiver_aidl" ]
}
android_aidl("crash_receiver_aidl") {
import_include = [ "java/src" ]
sources = [
"java/src/org/chromium/android_webview/crash/ICrashReceiverService.aidl",
]
}
if (!use_unpublished_apis) {
system_webview_apk_tmpl("system_webview_apk") {
android_manifest = system_webview_android_manifest
android_manifest_dep = ":system_webview_manifest"
deps = [
":system_webview_resources",
"//android_webview/glue",
]
apk_name = "SystemWebView"
}
}

View File

@ -0,0 +1,15 @@
# 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/android/rules.gni")
# Since Monochrome has its own content provider, these two files are put
# in two different targets.
android_library("webview_license_provider_java") {
java_files = [ "//android_webview/apk/java/src/com/android/webview/chromium/LicenseContentProvider.java" ]
}
android_library("webview_license_activity_java") {
java_files = [ "//android_webview/apk/java/src/com/android/webview/chromium/LicenseActivity.java" ]
}

View File

@ -0,0 +1,13 @@
# Copyright 2015 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/util/process_version.gni")
process_version("version") {
sources = [
"//chrome/VERSION",
]
template_file = "aw_version_info_values.h.version"
output = "$root_gen_dir/android_webview/common/aw_version_info_values.h"
}

View File

@ -0,0 +1,57 @@
# Copyright 2015 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/android/config.gni")
import("//build/config/android/rules.gni")
import("generate_resource_rewriter.gni")
import("glue.gni")
webview_public_framework_ijar = "frameworks.public.interface.jar"
generate_interface_jar("public_framework_ijar") {
input_jar = webview_public_framework_jar
output_jar = "$target_out_dir/$webview_public_framework_ijar"
}
generate_resource_rewriter("glue_resource_rewriter") {
# Change deps? please modify glue_library_deps variable.
deps = glue_library_deps
package_name = "com.android.webview.chromium"
}
android_library("glue") {
# Change deps? please modify glue_library_deps variable.
deps = glue_library_deps
srcjar_deps = [ ":glue_resource_rewriter" ]
alternative_android_sdk_ijar_dep = ":public_framework_ijar"
_ijar = webview_public_framework_ijar
_ijar_dir = get_label_info(alternative_android_sdk_ijar_dep, "target_out_dir")
alternative_android_sdk_ijar = "$_ijar_dir/$_ijar"
alternative_android_sdk_jar = webview_public_framework_jar
java_files = [
"java/src/com/android/webview/chromium/CallbackConverter.java",
"java/src/com/android/webview/chromium/ContentSettingsAdapter.java",
"java/src/com/android/webview/chromium/CookieManagerAdapter.java",
"java/src/com/android/webview/chromium/DrawGLFunctor.java",
"java/src/com/android/webview/chromium/GeolocationPermissionsAdapter.java",
"java/src/com/android/webview/chromium/GraphicsUtils.java",
"java/src/com/android/webview/chromium/MonochromeLibraryPreloader.java",
"java/src/com/android/webview/chromium/ServiceWorkerClientAdapter.java",
"java/src/com/android/webview/chromium/ServiceWorkerControllerAdapter.java",
"java/src/com/android/webview/chromium/ServiceWorkerSettingsAdapter.java",
"java/src/com/android/webview/chromium/TokenBindingManagerAdapter.java",
"java/src/com/android/webview/chromium/WebBackForwardListChromium.java",
"java/src/com/android/webview/chromium/WebHistoryItemChromium.java",
"java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java",
"java/src/com/android/webview/chromium/WebMessagePortAdapter.java",
"java/src/com/android/webview/chromium/WebStorageAdapter.java",
"java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java",
"java/src/com/android/webview/chromium/WebViewChromiumFactoryProviderForO.java",
"java/src/com/android/webview/chromium/WebViewChromium.java",
"java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java",
"java/src/com/android/webview/chromium/WebViewDatabaseAdapter.java",
"java/src/com/android/webview/chromium/WebViewDelegateFactory.java",
]
}

View File

@ -0,0 +1,55 @@
# Copyright 2015 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/android/rules.gni")
# Generate ResourceRewriter.java from Android Libraries according the dep
# graph.
# Argument:
# deps
# The same deps of target that uses the generated ResourceRewriter.
# package_name
# The package name of ResourceRewriter.java.
#
# This target generates a single srcjar containing generated
# ResourceRewrite.java which will list the R classes generated by all the
# Android libraries reachabled from the target specified in deps. Add this
# target to srcjar_deps of android_library will call ResourceRewriter.
#
template("generate_resource_rewriter") {
set_sources_assignment_filter([])
assert(defined(invoker.package_name))
_final_target_name = target_name
_build_config = "$target_gen_dir/${target_name}.build_config"
_build_config_target_name = "${target_name}__build_config"
_srcjar = "$target_gen_dir/${target_name}.srcjar"
write_build_config(_build_config_target_name) {
possible_config_deps = invoker.deps
type = "resource_rewriter"
build_config = _build_config
}
action(_final_target_name) {
forward_variables_from(invoker, [ "visibility" ])
inputs = [
_build_config,
]
deps = invoker.deps + [ ":${_build_config_target_name}" ]
script = "//build/android/gyp/generate_resource_rewriter.py"
_rebased_build_config = rebase_path(_build_config)
args = [
"--package-name",
invoker.package_name,
"--dep-packages",
"@FileArg($_rebased_build_config:resources:extra_package_names)",
"--srcjar",
rebase_path(_srcjar),
]
outputs = [
_srcjar,
]
}
}

View File

@ -0,0 +1,17 @@
# Copyright 2015 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.
# This variable shared between 'glue' and 'glue_resource_rewriter' because
# ResourceRewrite.java need to be generated according 'glue' deps.
glue_library_deps = [
"//android_webview:android_webview_java",
"//android_webview:android_webview_commandline_java",
"//android_webview:android_webview_platform_services_java",
"//base:base_java",
"//components/autofill/android:autofill_java",
"//components/autofill/android:provider_java",
"//content/public/android:content_java",
"//net/android:net_java",
"//ui/android:ui_java",
]

View File

@ -0,0 +1,62 @@
# Copyright 2015 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/android/config.gni")
import("//build/config/android/rules.gni")
import("//build/config/locales.gni")
template("system_webview_apk_tmpl") {
android_apk(target_name) {
forward_variables_from(invoker, "*")
deps += [
"//android_webview:assets",
"//android_webview/apk:webview_license_activity_java",
"//android_webview/apk:webview_license_provider_java",
"//base:base_java",
]
if (!defined(alternative_android_sdk_jar)) {
alternative_android_sdk_jar = webview_framework_jar
}
shared_resources = true
shared_libraries = [ "//android_webview:libwebviewchromium" ]
native_lib_version_rule = "//build/util:chrome_version_json"
_native_lib_file =
rebase_path("$root_gen_dir/CHROME_VERSION.json", root_out_dir)
native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)"
if (build_apk_secondary_abi && android_64bit_target_cpu) {
secondary_abi_shared_libraries = [ "//android_webview:libwebviewchromium($android_secondary_abi_toolchain)" ]
}
aapt_locale_whitelist = locales
# Whitelist rationale in https://crbug.com/691733.
exclude_xxxhdpi = true
xxxhdpi_whitelist = [
"*shadow*", # Combination of gradient & transparency cause pixelation.
"*.9.*", # Most nine-patches contain shadows.
]
# Used as an additional apk in test scripts.
never_incremental = true
if (is_java_debug) {
enable_multidex = true
} else {
proguard_enabled = true
if (!defined(proguard_configs)) {
proguard_configs = []
}
proguard_configs += [
"//android_webview/apk/java/proguard.flags",
"//base/android/proguard/chromium_apk.flags",
"//base/android/proguard/chromium_code.flags",
"//base/android/proguard/disable_all_obfuscation.flags",
]
png_to_webp = true
}
command_line_flags_file = "webview-command-line"
}
}

View File

@ -0,0 +1,331 @@
# Copyright 2015 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/android/rules.gni")
import("//device/vr/features/features.gni")
import("//testing/test.gni")
# Mark all targets as test only.
testonly = true
group("test") {
deps = [
":android_webview_unittests",
":webview_instrumentation_test_apk",
]
}
android_apk("webview_instrumentation_apk") {
deps = [
":android_webview_apk_assets",
":android_webview_apk_resources",
"//android_webview:android_webview_java",
"//android_webview:locale_pak_assets",
"//base:base_java",
"//base:base_java_test_support",
"//components/policy/android:policy_java_test_support",
"//content/public/android:content_java",
"//third_party/android_support_test_runner:runner_java",
"//third_party/junit",
"//ui/android:ui_java",
]
apk_name = "WebViewInstrumentation"
android_manifest = "shell/AndroidManifest.xml"
java_files = [
"shell/src/org/chromium/android_webview/shell/AwShellActivity.java",
"shell/src/org/chromium/android_webview/shell/AwShellApplication.java",
"shell/src/org/chromium/android_webview/shell/AwShellResourceProvider.java",
"shell/src/org/chromium/android_webview/shell/AwShellSwitches.java",
"shell/src/org/chromium/android_webview/shell/DrawGL.java",
"shell/src/org/chromium/android_webview/test/AwInstrumentationTestRunner.java",
"shell/src/org/chromium/android_webview/test/AwTestContainerView.java",
"shell/src/org/chromium/android_webview/test/AwTestRunnerActivity.java",
"shell/src/org/chromium/android_webview/test/AwJUnit4ClassRunner.java",
"shell/src/org/chromium/android_webview/test/NullContentsClient.java",
"shell/src/org/chromium/android_webview/test/SecondBrowserProcess.java",
"shell/src/org/chromium/android_webview/test/TestContentProvider.java",
]
shared_libraries = [
":libdrawgl",
":libstandalonelibwebviewchromium",
]
native_lib_version_rule = "//build/util:chrome_version_json"
_native_lib_file =
rebase_path("$root_gen_dir/CHROME_VERSION.json", root_build_dir)
native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)"
enable_multidex = true
command_line_flags_file = "android-webview-command-line"
}
android_resources("android_webview_apk_resources") {
resource_dirs = [ "shell/res" ]
custom_package = "org.chromium.android_webview.shell"
}
android_assets("android_webview_apk_assets") {
deps = [
"//android_webview:pak_file_assets",
"//third_party/icu:icu_assets",
"//v8:v8_external_startup_data_assets",
]
sources = [
"shell/assets/asset_file.html",
"shell/assets/asset_icon.png",
"shell/assets/autofill.html",
"shell/assets/cookie_test.html",
"shell/assets/full_screen_video.js",
"shell/assets/full_screen_video_inside_div_test.html",
"shell/assets/full_screen_video_test.html",
"shell/assets/full_screen_video_test_not_preloaded.html",
"shell/assets/key-system-test.html",
"shell/assets/platform-media-codec-test.html",
"shell/assets/video.3gp",
"shell/assets/video.webm",
"shell/assets/visual_state_during_fullscreen_test.html",
"shell/assets/visual_state_on_page_commit_visible_test.html",
"shell/assets/visual_state_waits_for_js_detached_test.html",
"shell/assets/visual_state_waits_for_js_test.html",
"shell/assets/webvr_not_functional_test.html",
]
}
shared_library("libstandalonelibwebviewchromium") {
sources = [
"../lib/webview_entry_point.cc",
]
ldflags = [ "-Wl,-shared,-Bsymbolic" ]
deps = [
"//android_webview:common",
]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ "//build/config/android:hide_all_but_jni" ]
}
instrumentation_test_apk("webview_instrumentation_test_apk") {
apk_name = "WebViewInstrumentationTest"
apk_under_test = ":webview_instrumentation_apk"
android_manifest = "../javatests/AndroidManifest.xml"
deps = [
"//android_webview:android_webview_crash_services_java",
"//android_webview:android_webview_java",
"//android_webview:android_webview_platform_services_java",
"//android_webview/test/embedded_test_server:aw_net_java_test_support",
"//base:base_java",
"//base:base_java_test_support",
"//components/autofill/android:provider_java",
"//components/minidump_uploader:minidump_uploader_java",
"//components/minidump_uploader:minidump_uploader_javatests",
"//components/policy/android:policy_java",
"//components/policy/android:policy_java_test_support",
"//components/safe_browsing/android:safe_browsing_java",
"//components/variations/android:variations_java",
"//components/web_contents_delegate_android:web_contents_delegate_android_java",
"//content/public/android:content_java",
"//content/public/test/android:content_java_test_support",
"//device/geolocation:geolocation_java",
"//device/geolocation:geolocation_java_test_support",
"//net/android:net_java",
"//net/android:net_java_test_support",
"//third_party/android_support_test_runner:rules_java",
"//third_party/android_support_test_runner:runner_java",
"//third_party/junit",
"//ui/android:ui_java",
]
java_files = [
"../javatests/src/org/chromium/android_webview/test/AcceptLanguageTest.java",
"../javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java",
"../javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java",
"../javatests/src/org/chromium/android_webview/test/ArchiveTest.java",
"../javatests/src/org/chromium/android_webview/test/AwAutofillTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsAnchorViewTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientAutoLoginTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientCallbackHelperTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientGetDefaultVideoPosterTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientOnRenderProcessGoneTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientOnScaleChangedTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientOnUnhandledKeyEventTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsClientVisitedHistoryTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsLifecycleNotifierTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsStaticsTest.java",
"../javatests/src/org/chromium/android_webview/test/AwContentsTest.java",
"../javatests/src/org/chromium/android_webview/test/AwDebugTest.java",
"../javatests/src/org/chromium/android_webview/test/AwFormDatabaseTest.java",
"../javatests/src/org/chromium/android_webview/test/AwImeTest.java",
"../javatests/src/org/chromium/android_webview/test/AwJavaBridgeTest.java",
"../javatests/src/org/chromium/android_webview/test/AwLayoutSizerTest.java",
"../javatests/src/org/chromium/android_webview/test/AwLegacyQuirksTest.java",
"../javatests/src/org/chromium/android_webview/test/AwPermissionManagerTest.java",
"../javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java",
"../javatests/src/org/chromium/android_webview/test/AwScrollOffsetManagerTest.java",
"../javatests/src/org/chromium/android_webview/test/AwSecondBrowserProcessTest.java",
"../javatests/src/org/chromium/android_webview/test/AwServiceWorkerClientTest.java",
"../javatests/src/org/chromium/android_webview/test/AwSettingsTest.java",
"../javatests/src/org/chromium/android_webview/test/AwStrictModeTest.java",
"../javatests/src/org/chromium/android_webview/test/AwTestCommon.java",
"../javatests/src/org/chromium/android_webview/test/AwTestBase.java",
"../javatests/src/org/chromium/android_webview/test/AwActivityTestRule.java",
"../javatests/src/org/chromium/android_webview/test/AwWebContentsObserverTest.java",
"../javatests/src/org/chromium/android_webview/test/AwZoomTest.java",
"../javatests/src/org/chromium/android_webview/test/CleanupReferenceTest.java",
"../javatests/src/org/chromium/android_webview/test/ClearHistoryTest.java",
"../javatests/src/org/chromium/android_webview/test/ClientAddMessageToConsoleTest.java",
"../javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java",
"../javatests/src/org/chromium/android_webview/test/ClientOnPageStartedTest.java",
"../javatests/src/org/chromium/android_webview/test/ClientOnReceivedError2Test.java",
"../javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java",
"../javatests/src/org/chromium/android_webview/test/ClientOnReceivedHttpErrorTest.java",
"../javatests/src/org/chromium/android_webview/test/ConsoleMessagesForBlockedLoadsTest.java",
"../javatests/src/org/chromium/android_webview/test/ContentViewMiscTest.java",
"../javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java",
"../javatests/src/org/chromium/android_webview/test/CookieManagerTest.java",
"../javatests/src/org/chromium/android_webview/test/DisableHardwareAccelerationForTest.java",
"../javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java",
"../javatests/src/org/chromium/android_webview/test/GeolocationTest.java",
"../javatests/src/org/chromium/android_webview/test/GetTitleTest.java",
"../javatests/src/org/chromium/android_webview/test/HttpAuthDatabaseTest.java",
"../javatests/src/org/chromium/android_webview/test/HttpCacheTest.java",
"../javatests/src/org/chromium/android_webview/test/KeySystemTest.java",
"../javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java",
"../javatests/src/org/chromium/android_webview/test/LoadUrlTest.java",
"../javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java",
"../javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java",
"../javatests/src/org/chromium/android_webview/test/PlatformMediaCodecTest.java",
"../javatests/src/org/chromium/android_webview/test/PolicyUrlFilteringTest.java",
"../javatests/src/org/chromium/android_webview/test/PopupWindowTest.java",
"../javatests/src/org/chromium/android_webview/test/PostMessageTest.java",
"../javatests/src/org/chromium/android_webview/test/RenderProcessGoneHelper.java",
"../javatests/src/org/chromium/android_webview/test/SaveRestoreStateTest.java",
"../javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java",
"../javatests/src/org/chromium/android_webview/test/StandaloneAwQuotaManagerBridgeTest.java",
"../javatests/src/org/chromium/android_webview/test/TestAwContents.java",
"../javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java",
"../javatests/src/org/chromium/android_webview/test/TestAwServiceWorkerClient.java",
"../javatests/src/org/chromium/android_webview/test/UserAgentTest.java",
"../javatests/src/org/chromium/android_webview/test/VisualStateTest.java",
"../javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java",
"../javatests/src/org/chromium/android_webview/test/WebViewAsynchronousFindApisTest.java",
"../javatests/src/org/chromium/android_webview/test/WebViewFindApisTestRule.java",
"../javatests/src/org/chromium/android_webview/test/WebViewModalDialogOverrideTest.java",
"../javatests/src/org/chromium/android_webview/test/WebViewWebVrTest.java",
"../javatests/src/org/chromium/android_webview/test/crash/CrashReceiverServiceTest.java",
"../javatests/src/org/chromium/android_webview/test/crash/MinidumpUploaderTest.java",
"../javatests/src/org/chromium/android_webview/test/crash/VisualStateCallbackTest.java",
"../javatests/src/org/chromium/android_webview/test/util/AwQuotaManagerBridgeTestUtil.java",
"../javatests/src/org/chromium/android_webview/test/util/AwTestTouchUtils.java",
"../javatests/src/org/chromium/android_webview/test/util/CommonResources.java",
"../javatests/src/org/chromium/android_webview/test/util/CookieUtils.java",
"../javatests/src/org/chromium/android_webview/test/util/GraphicsTestUtils.java",
"../javatests/src/org/chromium/android_webview/test/util/ImagePageGenerator.java",
"../javatests/src/org/chromium/android_webview/test/util/JSUtils.java",
"../javatests/src/org/chromium/android_webview/test/util/JavascriptEventObserver.java",
"../javatests/src/org/chromium/android_webview/test/util/VideoSurfaceViewUtils.java",
"../javatests/src/org/chromium/android_webview/test/util/VideoTestUtil.java",
"../javatests/src/org/chromium/android_webview/test/util/VideoTestWebServer.java",
"../javatests/src/org/chromium/android_webview/test/variations/AwVariationsConfigurationServiceTest.java",
]
data = [
"data/",
]
# We only want to bother including these on bots set up for VR testing
if (include_vr_data) {
data += [
"//chrome/android/shared_preference_files/test/",
"//third_party/gvr-android-sdk/test-apks/vr_services/vr_services_current.apk",
]
}
additional_apks = [
"//android_webview/test/embedded_test_server:aw_net_test_support_apk",
"//net/android:net_test_support_apk",
]
}
test("android_webview_unittests") {
# Dependencies (e.g. Play services) make the binary reach the dex limit.
enable_multidex = true
deps = [
":android_webview_unittests_assets",
":android_webview_unittests_java",
":android_webview_unittests_jni",
"//android_webview:common",
"//base/test:test_support",
"//content/test:test_support",
"//net:test_support",
"//ui/base:ui_base_jni_headers",
"//ui/gl",
"//ui/gl:test_support",
]
sources = [
"../browser/address_parser_unittest.cc",
"../browser/aw_contents_client_bridge_unittest.cc",
"../browser/aw_form_database_service_unittest.cc",
"../browser/aw_media_url_interceptor_unittest.cc",
"../browser/aw_permission_manager_unittest.cc",
"../browser/aw_safe_browsing_whitelist_manager_unittest.cc",
"../browser/aw_static_cookie_policy_unittest.cc",
"../browser/browser_view_renderer_unittest.cc",
"../browser/command_line_helper_unittest.cc",
"../browser/input_stream_unittest.cc",
"../browser/net/android_stream_reader_url_request_job_unittest.cc",
"../browser/net/aw_cookie_store_wrapper_unittest.cc",
"../browser/net/input_stream_reader_unittest.cc",
"../browser/permission/media_access_permission_request_unittest.cc",
"../browser/permission/permission_request_handler_unittest.cc",
"../browser/renderer_host/auto_login_parser_unittest.cc",
"../browser/state_serializer_unittest.cc",
"../browser/test/fake_window.cc",
"../browser/test/fake_window.h",
"../browser/test/rendering_test.cc",
"../browser/test/rendering_test.h",
"../lib/webview_tests.cc",
]
}
android_assets("android_webview_unittests_assets") {
sources = [
"unittest/assets/asset_file.ogg",
]
}
android_library("android_webview_unittests_java") {
testonly = true
deps = [
"//android_webview:android_webview_java",
"//base:base_java",
"//content/public/test/android:content_java_test_support",
]
java_files = [
"../unittestjava/src/org/chromium/android_webview/unittest/InputStreamUnittest.java",
"../unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java",
]
}
generate_jni("android_webview_unittests_jni") {
jni_package = "android_webview_unittests"
sources = [
"../unittestjava/src/org/chromium/android_webview/unittest/InputStreamUnittest.java",
"../unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java",
]
}
shared_library("libdrawgl") {
sources = [
"shell/src/draw_gl/draw_gl.cc",
]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
}

View File

@ -0,0 +1,71 @@
# 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/android/config.gni")
import("//build/config/android/rules.gni")
android_library("aw_net_java_test_support") {
testonly = true
java_files = [
"java/src/org/chromium/android_webview/test/AwEmbeddedTestServer.java",
"java/src/org/chromium/android_webview/test/AwEmbeddedTestServerImpl.java",
"java/src/org/chromium/android_webview/test/AwEmbeddedTestServerService.java",
]
deps = [
"//base:base_java",
"//base:base_java_test_support",
"//net/android:embedded_test_server_aidl_java",
"//net/android:net_java",
"//net/android:net_java_test_support",
"//net/android:net_java_test_support_provider",
]
}
generate_jni("aw_net_jni_headers") {
sources = [
"java/src/org/chromium/android_webview/test/AwEmbeddedTestServerImpl.java",
]
jni_package = "android_webview/test"
}
source_set("aw_java_test_native_support") {
testonly = true
sources = [
"../../../net/test/embedded_test_server/android/embedded_test_server_android.cc",
"../../../net/test/embedded_test_server/android/embedded_test_server_android.h",
"aw_embedded_test_server.cc",
"aw_test_entry_point.cc",
]
deps = [
"//net:test_support",
]
public_deps = [
":aw_net_jni_headers",
"//net:net_test_jni_headers",
]
}
shared_library("aw_net_java_test_native_support") {
testonly = true
deps = [
":aw_java_test_native_support",
"//net:test_support",
]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ "//build/config/android:hide_all_but_jni" ]
}
android_apk("aw_net_test_support_apk") {
testonly = true
# Used as an additional_apk in test scripts.
never_incremental = true
deps = [
":aw_net_java_test_support",
"//base:base_java",
]
android_manifest = "java/AndroidManifest.xml"
apk_name = "ChromiumNetTestAwSupport"
shared_libraries = [ ":aw_net_java_test_native_support" ]
}

View File

@ -0,0 +1,72 @@
# Copyright 2016 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/android/rules.gni")
import("//testing/test.gni")
group("webview_ui_test_app") {
testonly = true
deps = [
":webview_ui_test_app_apk",
":webview_ui_test_app_test_apk",
]
}
android_apk("webview_ui_test_app_apk") {
apk_name = "WebViewUiTestApp"
android_manifest = "java/AndroidManifest.xml"
deps = [
":webview_ui_test_app_apk_resources",
":webview_ui_test_app_java",
]
}
android_library("webview_ui_test_app_java") {
java_files =
[ "java/src/org/chromium/webview_ui_test/WebViewUiTestActivity.java" ]
deps = [
":webview_ui_test_app_apk_resources",
"//base:base_java",
]
# Manifest used for linting (determining unused resources).
android_manifest = "java/AndroidManifest.xml"
}
android_resources("webview_ui_test_app_apk_resources") {
resource_dirs = [ "java/res" ]
custom_package = "org.chromium.webview_ui_test"
}
instrumentation_test_apk("webview_ui_test_app_test_apk") {
apk_name = "WebViewUiTestAppTest"
apk_under_test = ":webview_ui_test_app_apk"
android_manifest = "javatests/AndroidManifest.xml"
java_files = [
"javatests/src/org/chromium/webview_ui_test/test/ActionModeTest.java",
"javatests/src/org/chromium/webview_ui_test/test/DropDownListTest.java",
"javatests/src/org/chromium/webview_ui_test/test/WebViewJSTest.java",
"javatests/src/org/chromium/webview_ui_test/test/util/Actions.java",
"javatests/src/org/chromium/webview_ui_test/test/util/Atoms.java",
"javatests/src/org/chromium/webview_ui_test/test/util/UseLayout.java",
"javatests/src/org/chromium/webview_ui_test/test/util/WebViewUiTestRule.java",
"javatests/src/org/chromium/webview_ui_test/test/util/WebViewSyncWrapper.java",
]
deps = [
":webview_ui_test_app_apk_resources",
":webview_ui_test_app_java",
"//base:base_java",
"//base:base_java_test_support",
"//third_party/android_support_test_runner:rules_java",
"//third_party/android_support_test_runner:runner_java",
"//third_party/android_tools:android_support_annotations_java",
"//third_party/espresso:espresso_all_java",
"//third_party/hamcrest:hamcrest_java",
"//third_party/junit",
"//third_party/ub-uiautomator:ub_uiautomator_java",
]
data = [
"test/data/",
]
}

View File

@ -0,0 +1,90 @@
# Copyright 2015 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/android/rules.gni")
import("//testing/test.gni")
# Mark all targets as test only.
testonly = true
group("system_webview_shell") {
deps = [
":system_webview_shell_apk",
":system_webview_shell_layout_test_apk",
":system_webview_shell_page_cycler_apk",
]
}
android_apk("system_webview_shell_apk") {
apk_name = "SystemWebViewShell"
java_files = [
"apk/src/org/chromium/webview_shell/JankActivity.java",
"apk/src/org/chromium/webview_shell/PageCyclerTestActivity.java",
"apk/src/org/chromium/webview_shell/StartupTimeActivity.java",
"apk/src/org/chromium/webview_shell/TelemetryActivity.java",
"apk/src/org/chromium/webview_shell/TelemetryMemoryPressureActivity.java",
"apk/src/org/chromium/webview_shell/WebViewCreateDestroyActivity.java",
"apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java",
"apk/src/org/chromium/webview_shell/WebViewLayoutTestActivity.java",
"apk/src/org/chromium/webview_shell/WebViewThreadTestActivity.java",
]
android_manifest = "apk/AndroidManifest.xml"
deps = [
":system_webview_shell_apk_resources",
"//base:base_java",
]
}
android_resources("system_webview_shell_apk_resources") {
resource_dirs = [ "apk/res" ]
custom_package = "org.chromium.webview_shell"
}
instrumentation_test_apk("system_webview_shell_page_cycler_apk") {
apk_name = "SystemWebViewShellPageCycler"
apk_under_test = ":system_webview_shell_apk"
android_manifest = "page_cycler/AndroidManifest.xml"
java_files = [
"page_cycler/src/org/chromium/webview_shell/page_cycler/PageCyclerTest.java",
]
deps = [
"//base:base_java",
"//base:base_java_test_support",
"//content/public/android:content_java",
"//content/public/test/android:content_java_test_support",
"//testing/android/reporter:reporter_java",
"//third_party/junit",
"//third_party/android_support_test_runner:rules_java",
"//third_party/android_support_test_runner:runner_java",
]
}
instrumentation_test_apk("system_webview_shell_layout_test_apk") {
apk_name = "SystemWebViewShellLayoutTest"
apk_under_test = ":system_webview_shell_apk"
android_manifest = "layout_tests/AndroidManifest.xml"
java_files = [
"layout_tests/src/org/chromium/webview_shell/test/WebViewLayoutTest.java",
"layout_tests/src/org/chromium/webview_shell/test/WebViewThreadTest.java",
]
deps = [
"//base:base_java",
"//base:base_java_test_support",
"//testing/android/reporter:reporter_java",
"//third_party/android_support_test_runner:rules_java",
"//third_party/android_support_test_runner:runner_java",
"//third_party/junit",
]
data = [
"test/data/",
"//third_party/WebKit/LayoutTests/platform/linux/virtual/stable/webexposed/",
"//third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/",
"//third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/",
"//third_party/WebKit/LayoutTests/resources/global-interface-listing.js",
"//third_party/WebKit/LayoutTests/virtual/stable/webexposed/",
"//third_party/WebKit/LayoutTests/webexposed/global-interface-listing.html",
"//third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt",
]
additional_apks = [ system_webview_apk_target ]
}

View File

@ -0,0 +1,35 @@
# Copyright 2015 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("//tools/grit/repack.gni")
import("webview_repack_locales_list.gni")
# Wraps repack_locales(), setting the source_patterns and deps required for
# Chrome.
template("webview_repack_locales") {
repack_locales(target_name) {
forward_variables_from(invoker, "*")
if (!defined(deps)) {
deps = []
}
# Adding webview specific pak file? You should add it to
# webview_repack_locales_source_patterns, so it is also included in
# Monochrome.
source_patterns = [
"${root_gen_dir}/android_webview/components_strings_",
"${root_gen_dir}/content/app/strings/content_strings_",
"${root_gen_dir}/ui/strings/app_locale_settings_",
]
deps += [
"//android_webview:generate_components_strings",
"//content/app/strings",
"//ui/strings:app_locale_settings",
]
source_patterns += webview_repack_locales_source_patterns
deps += webview_repack_locales_deps
output_dir = "$root_out_dir/android_webview/locales"
}
}

View File

@ -0,0 +1,10 @@
# Copyright 2016 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.
# For how to add pattern, see additional_source_patterns argument of
# _repack_one_locale in chrome/chrome_repack_locales.gni.
webview_repack_locales_source_patterns =
[ "${root_gen_dir}/android_webview/aw_strings_" ]
webview_repack_locales_deps = [ "//android_webview:generate_aw_strings" ]

67
apps/BUILD.gn Normal file
View File

@ -0,0 +1,67 @@
# Copyright 2014 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/features.gni")
import("//build/config/ui.gni")
import("//extensions/features/features.gni")
assert(!is_android && !is_ios)
assert(enable_extensions,
"Cannot depend on extensions because enable_extensions=false.")
static_library("apps") {
sources = []
sources += [
"app_lifetime_monitor.cc",
"app_lifetime_monitor.h",
"app_lifetime_monitor_factory.cc",
"app_lifetime_monitor_factory.h",
"app_restore_service.cc",
"app_restore_service.h",
"app_restore_service_factory.cc",
"app_restore_service_factory.h",
"browser_context_keyed_service_factories.cc",
"browser_context_keyed_service_factories.h",
"launcher.cc",
"launcher.h",
"metrics_names.h",
"saved_files_service.cc",
"saved_files_service.h",
"saved_files_service_factory.cc",
"saved_files_service_factory.h",
"switches.cc",
"switches.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
deps = [
"//components/keyed_service/content",
"//content/public/browser",
"//content/public/common",
"//extensions/browser",
"//extensions/common",
"//extensions/common/api",
]
if (is_chromeos) {
deps += [ "//components/user_manager" ]
}
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
}
static_library("test_support") {
testonly = true
sources = [
"test/app_window_waiter.cc",
"test/app_window_waiter.h",
]
public_deps = [
"//content/public/browser",
]
}

26
apps/ui/views/BUILD.gn Normal file
View File

@ -0,0 +1,26 @@
# 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")
import("//extensions/features/features.gni")
assert(enable_extensions)
source_set("views") {
sources = [
"app_window_frame_view.cc",
"app_window_frame_view.h",
]
deps = [
"//cc/paint",
"//chrome/app/theme:theme_resources",
"//extensions/browser",
"//extensions/common",
"//skia",
"//ui/gfx",
"//ui/strings",
"//ui/views",
]
}

1781
ash/BUILD.gn Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
# Copyright 2016 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")
source_set("autoclick") {
sources = [
"autoclick_controller_common.cc",
"autoclick_controller_common.h",
"autoclick_controller_common_delegate.h",
"autoclick_ring_handler.cc",
"autoclick_ring_handler.h",
]
deps = [
"//base",
"//cc/paint",
"//skia",
"//ui/aura",
"//ui/compositor",
"//ui/display",
"//ui/events",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/views",
"//ui/wm",
]
}

View File

@ -0,0 +1,56 @@
# Copyright 2016 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")
import("//services/service_manager/public/cpp/service.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//mojo/public/tools/bindings/mojom.gni")
source_set("lib") {
sources = [
"autoclick_application.cc",
"autoclick_application.h",
]
deps = [
"//ash/autoclick/common:autoclick",
"//ash/autoclick/mus/public/interfaces",
"//ash/public/cpp:ash_public_cpp",
"//base",
"//mash/public/interfaces",
"//mojo/common",
"//mojo/public/cpp/bindings",
"//services/service_manager/public/cpp",
"//services/ui/public/cpp",
"//services/ui/public/interfaces",
"//ui/aura",
"//ui/views",
"//ui/views/mus:for_mojo_application",
]
data_deps = [
"//services/ui",
]
}
service("accessibility_autoclick") {
sources = [
"main.cc",
]
deps = [
":lib",
"//base",
"//mojo/public/cpp/bindings",
"//services/service_manager/public/cpp",
"//ui/views/mus:for_mojo_application",
]
resources = [ "$root_out_dir/views_mus_resources.pak" ]
}
service_manifest("manifest") {
name = "accessibility_autoclick"
source = "manifest.json"
}

View File

@ -0,0 +1,11 @@
# Copyright 2016 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("//mojo/public/tools/bindings/mojom.gni")
mojom("interfaces") {
sources = [
"autoclick.mojom",
]
}

View File

@ -0,0 +1,11 @@
// Copyright 2016 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.
module ash.autoclick.mojom;
// Used by Chrome to set the time to wait in milliseconds from when the mouse
// stops moving to when the autoclick event is sent in accessibility_autoclick.
interface AutoclickController {
SetAutoclickDelay(uint32 delay_in_milliseconds);
};

245
ash/mus/BUILD.gn Normal file
View File

@ -0,0 +1,245 @@
# Copyright 2015 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")
import("//mojo/public/tools/bindings/mojom.gni")
import("//services/service_manager/public/cpp/service.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//tools/grit/repack.gni")
assert(is_chromeos)
source_set("lib") {
sources = [
"accelerators/accelerator_controller_delegate_mus.cc",
"accelerators/accelerator_controller_delegate_mus.h",
"accelerators/accelerator_controller_registrar.cc",
"accelerators/accelerator_controller_registrar.h",
"accelerators/accelerator_handler.h",
"accelerators/accelerator_ids.h",
"ash_window_tree_host_mus.cc",
"ash_window_tree_host_mus.h",
"bridge/immersive_handler_factory_mus.cc",
"bridge/immersive_handler_factory_mus.h",
"bridge/shell_port_mash.cc",
"bridge/shell_port_mash.h",
"bridge/workspace_event_handler_mus.cc",
"bridge/workspace_event_handler_mus.h",
"disconnected_app_handler.cc",
"disconnected_app_handler.h",
"display_synchronizer.cc",
"display_synchronizer.h",
"drag_window_resizer.cc",
"drag_window_resizer.h",
"event_matcher_util.cc",
"event_matcher_util.h",
"frame/detached_title_area_renderer.cc",
"frame/detached_title_area_renderer.h",
"keyboard_ui_mus.cc",
"keyboard_ui_mus.h",
"move_event_handler.cc",
"move_event_handler.h",
"network_connect_delegate_mus.cc",
"network_connect_delegate_mus.h",
"non_client_frame_controller.cc",
"non_client_frame_controller.h",
"property_util.cc",
"property_util.h",
"shell_delegate_mus.cc",
"shell_delegate_mus.h",
"top_level_window_factory.cc",
"top_level_window_factory.h",
"touch_transform_setter_mus.cc",
"touch_transform_setter_mus.h",
"wallpaper_delegate_mus.cc",
"wallpaper_delegate_mus.h",
"window_manager.cc",
"window_manager.h",
"window_manager_application.cc",
"window_manager_application.h",
"window_properties.cc",
"window_properties.h",
]
defines = [ "NOTIMPLEMENTED_POLICY=5" ]
deps = [
"//chromeos",
"//chromeos:power_manager_proto",
"//components/user_manager",
"//components/wallpaper",
"//device/bluetooth",
"//services/ui/public/cpp/input_devices",
"//services/ui/public/interfaces/input_devices",
"//ui/app_list/presenter",
"//ui/app_list/presenter:mojom",
"//ui/chromeos",
"//ui/display/manager",
"//ui/events/devices/mojo",
"//ui/keyboard",
"//ui/keyboard:mojom",
"//ui/message_center",
"//ui/wm/public",
]
public_deps = [
"//ash",
"//ash/public/cpp:ash_public_cpp",
"//ash/wayland",
"//base",
"//base:i18n",
"//mash/public/interfaces",
"//mojo/common:common_base",
"//services/service_manager/public/cpp",
"//services/ui/common:mus_common",
"//services/ui/public/cpp",
"//services/ui/public/cpp/input_devices",
"//services/ui/public/interfaces",
"//services/ui/public/interfaces/display",
"//skia",
"//ui/aura",
"//ui/events",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gfx/geometry/mojo",
"//ui/resources",
"//ui/strings",
"//ui/views",
"//ui/views/mus:for_mojo_application",
"//ui/wm",
]
data_deps = [
"//ash/touch_hud/mus:touch_hud",
]
assert_no_deps = [
"//content/public/browser",
"//content/public/common",
]
}
service("mus") {
output_name = "ash"
sources = [
"main.cc",
]
deps = [
":lib",
":resources",
":resources_200",
"//services/service_manager/public/cpp",
]
# TODO(beng): This target relies on //mash/session, but there is a cycle so we
# can't state that dependency here.
data_deps = [
":resources",
":resources_200",
"//services/ui",
]
}
service_manifest("manifest") {
name = "ash"
source = "manifest.json"
}
# TODO: Load locale-specific strings.
# TODO: Avoid duplication between Mash and Chrome pak files: crbug.com/628715.
repack("resources") {
output = "$root_out_dir/ash_mus_resources.pak"
sources = [
"$root_gen_dir/ash/resources/ash_resources_100_percent.pak",
"$root_gen_dir/ash/strings/ash_strings_en-US.pak",
"$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_100_percent.pak",
"$root_gen_dir/ui/chromeos/strings/ui_chromeos_strings_en-US.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
"$root_gen_dir/ui/strings/ui_strings_en-US.pak",
"$root_gen_dir/ui/views/resources/views_resources_100_percent.pak",
]
deps = [
"//ash/resources",
"//ash/strings",
"//ui/chromeos/resources",
"//ui/chromeos/strings",
"//ui/resources",
"//ui/strings",
"//ui/views/mus:resources",
"//ui/views/resources",
]
}
repack("resources_200") {
output = "$root_out_dir/ash_mus_resources_200.pak"
sources = [
"$root_gen_dir/ash/resources/ash_resources_200_percent.pak",
"$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_200_percent.pak",
"$root_gen_dir/ui/resources/ui_resources_200_percent.pak",
"$root_gen_dir/ui/views/resources/views_resources_200_percent.pak",
]
deps = [
"//ash/resources",
"//ui/chromeos/resources",
"//ui/resources",
"//ui/views/resources",
]
}
source_set("unittests") {
testonly = true
sources = [
"app_launch_unittest.cc",
"bridge/shell_port_mash_test_api.h",
"display_synchronizer_unittest.cc",
"non_client_frame_controller_unittest.cc",
"top_level_window_factory_unittest.cc",
"window_manager_unittest.cc",
]
deps = [
":lib",
":resources",
"//ash",
"//ash:test_support_without_content",
"//ash/public/cpp:ash_public_cpp",
"//base",
"//base/test:test_config",
"//base/test:test_support",
"//mash/quick_launch/public/interfaces:constants",
"//mojo/public/cpp/system",
"//services/service_manager/public/cpp:service_test_support",
"//services/ui/common:mus_common",
"//services/ui/public/cpp",
"//services/ui/public/cpp/input_devices",
"//services/ui/public/interfaces",
"//skia",
"//testing/gtest",
"//ui/aura",
"//ui/aura:test_support",
"//ui/base",
"//ui/base:test_support",
"//ui/compositor:test_support",
"//ui/display",
"//ui/events",
"//ui/events:test_support",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
"//ui/gfx/geometry/mojo",
"//ui/message_center",
"//ui/views:test_support",
"//ui/views/mus",
]
data_deps = [
":mus",
"//mash/quick_launch",
]
defines = [ "NOTIMPLEMENTED_POLICY=5" ]
}

View File

@ -0,0 +1,42 @@
# 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("//services/service_manager/public/cpp/service.gni")
import("//services/service_manager/public/service_manifest.gni")
assert(is_chromeos)
service("ash_standalone") {
output_name = "ash_standalone"
testonly = true
sources = [
"ash_standalone_main.cc",
]
deps = [
"//ash:ash_shell_lib",
"//ash/mus:lib",
"//ash/mus:resources",
"//ash/mus:resources_200",
"//services/service_manager/public/cpp",
"//services/ui/public/cpp/input_devices",
"//services/ui/public/interfaces",
"//ui/app_list/presenter",
"//ui/views/examples:views_examples_lib",
]
# TODO(beng): This target relies on //mash/session, but there is a cycle so we
# can't state that dependency here.
data_deps = [
"//ash/mus:resources",
"//ash/mus:resources_200",
"//services/ui",
]
}
service_manifest("manifest") {
name = "ash_standalone"
source = "manifest.json"
}

114
ash/public/cpp/BUILD.gn Normal file
View File

@ -0,0 +1,114 @@
# Copyright 2016 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("//mojo/public/tools/bindings/mojom.gni")
# C++ headers and sources that can be used outside ash.
component("ash_public_cpp") {
sources = [
"app_types.h",
"ash_pref_names.cc",
"ash_pref_names.h",
"ash_public_export.h",
"ash_switches.cc",
"ash_switches.h",
"ash_typography.cc",
"ash_typography.h",
"config.h",
"immersive/immersive_context.cc",
"immersive/immersive_context.h",
"immersive/immersive_focus_watcher.h",
"immersive/immersive_fullscreen_controller.cc",
"immersive/immersive_fullscreen_controller.h",
"immersive/immersive_fullscreen_controller_delegate.h",
"immersive/immersive_gesture_handler.h",
"immersive/immersive_handler_factory.cc",
"immersive/immersive_handler_factory.h",
"immersive/immersive_revealed_lock.cc",
"immersive/immersive_revealed_lock.h",
"mus_property_mirror_ash.cc",
"mus_property_mirror_ash.h",
"remote_shelf_item_delegate.cc",
"remote_shelf_item_delegate.h",
"scale_utility.cc",
"scale_utility.h",
"session_types.h",
"shelf_item.cc",
"shelf_item.h",
"shelf_item_delegate.cc",
"shelf_item_delegate.h",
"shelf_model.cc",
"shelf_model.h",
"shelf_model_observer.h",
"shelf_prefs.cc",
"shelf_prefs.h",
"shelf_types.cc",
"shelf_types.h",
"shell_window_ids.cc",
"shell_window_ids.h",
"stylus_utils.cc",
"stylus_utils.h",
"voice_interaction_state.h",
"window_pin_type.cc",
"window_pin_type.h",
"window_properties.cc",
"window_properties.h",
"window_state_type.cc",
"window_state_type.h",
"window_style.cc",
"window_style.h",
]
defines = [ "ASH_PUBLIC_IMPLEMENTATION" ]
deps = [
"//components/prefs",
"//mojo/common:common_custom_types",
"//skia/public/interfaces",
"//ui/aura",
"//ui/display",
"//ui/events/devices",
"//ui/views",
"//ui/views/mus",
]
public_deps = [
"//ash/public/interfaces:interfaces_internal",
"//base",
"//ui/gfx",
]
allow_circular_includes_from =
[ "//ash/public/interfaces:interfaces_internal" ]
}
# Using a test service because the traits need to pass handles around. Revisit
# this after Deserialize(Serialize()) API works with handles.
mojom("test_interfaces") {
visibility = [ ":unit_tests" ]
sources = [
"shelf_struct_traits_test_service.mojom",
]
public_deps = [
"//ash/public/interfaces:interfaces_internal",
]
}
source_set("unit_tests") {
testonly = true
sources = [
"shelf_model_unittest.cc",
"shelf_struct_traits_unittest.cc",
]
deps = [
":ash_public_cpp",
":test_interfaces",
"//base",
"//testing/gtest",
"//ui/gfx:test_support",
]
}

View File

@ -0,0 +1,13 @@
// 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.
module ash.mojom;
import "ash/public/interfaces/shelf.mojom";
// A test echo interface for traits.
interface ShelfStructTraitsTestService {
[Sync]
EchoShelfItem(ShelfItem in) => (ShelfItem out);
};

View File

@ -0,0 +1,70 @@
# Copyright 2015 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("//mojo/public/tools/bindings/mojom.gni")
# Depend upon //ash/public/cpp:ash_public_cpp, which has a public_dep on this.
# The two targets must be bundled together as the typemaps depend upon
# //ash/public/cpp, and //ash/public/cpp needs to depend on this for generated
# code (such as enums and constants).
mojom("interfaces_internal") {
visibility = [ "//ash/public/cpp:*" ]
sources = [
"accelerator_controller.mojom",
"ash_display_controller.mojom",
"cast_config.mojom",
"constants.mojom",
"event_properties.mojom",
"highlighter_controller.mojom",
"ime_controller.mojom",
"ime_info.mojom",
"locale.mojom",
"lock_screen.mojom",
"login_user_info.mojom",
"media.mojom",
"new_window.mojom",
"night_light_controller.mojom",
"pref_connector.mojom",
"session_controller.mojom",
"shelf.mojom",
"shutdown.mojom",
"system_tray.mojom",
"tablet_mode.mojom",
"tray_action.mojom",
"update.mojom",
"user_info.mojom",
"volume.mojom",
"vpn_list.mojom",
"wallpaper.mojom",
"window_pin_type.mojom",
"window_state_type.mojom",
"window_style.mojom",
]
public_deps = [
"//components/proximity_auth/public/interfaces",
"//components/signin/public/interfaces",
"//mojo/common:common_custom_types",
"//services/preferences/public/interfaces",
"//skia/public/interfaces",
"//ui/events/mojo:interfaces",
"//ui/gfx/image/mojo:interfaces",
]
component_output_prefix = "ash_public_interfaces_internal"
export_class_attribute = "ASH_PUBLIC_EXPORT"
export_define = "ASH_PUBLIC_IMPLEMENTATION=1"
export_header = "ash/public/cpp/ash_public_export.h"
}
mojom("test_interfaces") {
testonly = true
sources = [
"system_tray_test_api.mojom",
]
deps = [
"//mojo/common:common_custom_types",
]
}

View File

@ -0,0 +1,16 @@
// Copyright 2016 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.
module ash.mojom;
import "ash/public/interfaces/volume.mojom";
// Implemented by ash to delegate parts of keyboard accelerator handling back
// to chrome.
interface AcceleratorController {
// Sets the volume controller interface. This lives in chrome because chrome
// owns the D-Bus CrasAudioHandler implementation. Also the accessibility
// manager in chrome needs to know about volume changes.
SetVolumeController(VolumeController controller);
};

View File

@ -0,0 +1,18 @@
// Copyright 2016 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.
module ash.mojom;
// Allows configuring various display related state.
interface AshDisplayController {
// ============================ Virtual Terminal ============================
// Take control of all display output. This is called when switching from the
// virtual terminal back to Chrome in response to a dbus message.
TakeDisplayControl() => (bool status);
// Relinquish control of all display output. This is called when switching
// from Chrome to the virtual terminal in response to a dbus message.
RelinquishDisplayControl() => (bool status);
};

View File

@ -0,0 +1,62 @@
// Copyright 2016 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.
module ash.mojom;
struct CastSink {
string id;
string name;
string domain;
};
enum ContentSource {
UNKNOWN,
TAB,
DESKTOP
};
struct CastRoute {
string id;
string title;
// Is the activity source this computer? ie, are we mirroring the display?
bool is_local_source = false;
// What is source of the content? For example, we could be DIAL casting a
// tab or mirroring the entire desktop.
ContentSource content_source = ContentSource.UNKNOWN;
};
struct SinkAndRoute {
CastSink sink;
CastRoute route;
};
// Allows clients (e.g. Chrome browser) to interface with the cast item in the
// system tray.
interface CastConfig {
// Sets the client interface. This client interface will receive commands from
// ash and provide OnDevicesUpdated() calls.
SetClient(associated CastConfigClient client);
// Invoked whenever there is new sink or route information available.
OnDevicesUpdated(array<SinkAndRoute> device);
};
// This delegate allows the UI code in ash, e.g. |TrayCastDetailedView|,
// to access the cast system.
//
// TODO(erg): Eventually, this should no longer be exported by chrome, but
// should be exported by a separate cast service.
interface CastConfigClient {
// Request fresh data from the backend. When the data is available, all
// registered observers will get called.
RequestDeviceRefresh();
// Initiate a casting session to |sink|.
CastToSink(CastSink sink);
// A user-initiated request to stop the given cast session.
StopCasting(CastRoute route);
};

View File

@ -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.
module ash.mojom;
const string kServiceName = "ash";

View File

@ -0,0 +1,13 @@
// 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.
module ash.mojom;
// This is added to KeyEvents that ash has an accelerator for. This is only used
// for accelerators ash does not handle immediately. That is, those the target
// is given priority to process.
// No value is set for this property, the presence indicates ash has an
// accelerator.
const string kWillProcessAccelerator_KeyEventProperty =
"ash:will-process-accelerator";

View File

@ -0,0 +1,26 @@
// 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.
module ash.mojom;
import "ui/gfx/geometry/mojo/geometry.mojom";
// Interface for ash client (e.g. Chrome) to connect to the highlighter
// controller, the component implementing on-screen content selection
// with a stylus.
interface HighlighterController {
// Sets the client interface.
SetClient(HighlighterControllerClient client);
};
// Interface for ash to notify the client (e.g. Chrome) about the highlighter
// selection and state.
interface HighlighterControllerClient {
// Called when when a valid selection is made. Selected rectangle is in
// screen coordinates, clipped to screen bounds if necessary.
HandleSelection(gfx.mojom.Rect rect);
// Called when the highlighter tool becomes enabled or disabled.
HandleEnabledStateChange(bool enabled);
};

View File

@ -0,0 +1,72 @@
// 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.
module ash.mojom;
import "ash/public/interfaces/ime_info.mojom";
// Interface for ash client (e.g. Chrome) to send input method info to ash.
interface ImeController {
// Sets the client interface.
SetClient(ImeControllerClient client);
// Updates the cached IME information and refreshes the IME menus.
// |current_ime_id| is empty when there is no active IME yet.
RefreshIme(string current_ime_id,
array<ImeInfo> available_imes,
array<ImeMenuItem> menu_items);
// Shows an icon in the IME menu indicating that IMEs are controlled by device
// policy.
SetImesManagedByPolicy(bool managed);
// Shows the IME menu on the shelf instead of inside the system tray menu.
// Users with multiple IMEs that have multiple configurable properties (e.g.
// some Chinese IMEs) prefer this to keeping the IME menu under the primary
// system tray menu.
ShowImeMenuOnShelf(bool show);
// Report caps lock state changes from chrome (which is the source of truth)
// to the tray.
SetCapsLockState(bool enabled);
// Report the enabled state of the various extra input options (currently
// emoji, handwriting, and voice input). |is_extra_input_options_enabled| set
// to false will disable all extra input option UI regardless of the enabled
// state of the individual options (which will be ingored).
SetExtraInputOptionsEnabledState(bool is_extra_input_options_enabled,
bool is_emoji_enabled,
bool is_handwriting_enabled,
bool is_voice_enabled);
};
// Interface for ash to send input method requests to its client (e.g. Chrome).
interface ImeControllerClient {
// Switches to the next input method. Does nothing if only one input method
// is installed.
SwitchToNextIme();
// Switches to the previous input method. Does nothing if only one input
// method is installed.
SwitchToPreviousIme();
// Switches to an input method by |id|. Does nothing if the input method is
// not installed. The ID is usually the output of a call like
// chromeos::extension_ime_util::GetInputMethodIDByEngineID("xkb:jp::jpn"),
// see that function for details. Shows a bubble with the input method short
// name when |show_message| is true.
SwitchImeById(string id, bool show_message);
// Activates an input method menu item. The |key| must be a value from the
// ImeMenuItems provided via RefreshIme. Does nothing if the |key| is invalid.
ActivateImeMenuItem(string key);
// When the caps lock state change originates from the tray (i.e. clicking the
// caps lock toggle from the settings menu from the caps lock icon), propagate
// the change to the client without sending a change notification back to the
// tray.
// TODO(crbug/759435): Ideally this interaction should only be to disable the
// caps lock.
SetCapsLockFromTray(bool enabled);
};

View File

@ -0,0 +1,40 @@
// 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.
module ash.mojom;
import "mojo/common/string16.mojom";
// Metadata about an installed input method.
struct ImeInfo {
// True if the IME is a third-party extension.
bool third_party;
// ID that identifies the IME (e.g., "t:latn-post", "pinyin", "hangul").
string id;
// Long name of the IME, which is used as the user-visible name.
mojo.common.mojom.String16 name;
// Medium name of the IME, which is the same as the short name in most cases.
mojo.common.mojom.String16 medium_name;
// UI indicator for the IME (e.g., "US"). If the IME has no indicator, uses
// the first two characters in its preferred keyboard layout or language code
// (e.g., "ko", "ja", "en-US").
mojo.common.mojom.String16 short_name;
};
// A menu item that sets an IME configuration property.
struct ImeMenuItem {
// True if the item is selected / enabled.
bool checked;
// The key which identifies the property controlled by the menu item, e.g.
// "InputMode.HalfWidthKatakana".
string key;
// The item label, e.g. "Switch to full punctuation mode" or "Hiragana".
mojo.common.mojom.String16 label;
};

View File

@ -0,0 +1,21 @@
// Copyright 2016 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.
module ash.mojom;
// Sent as the response to LocaleNotificationController.OnLocaleChanged().
enum LocaleNotificationResult {
ACCEPT,
REVERT
};
// Used by Chrome to make ash show a notification.
interface LocaleNotificationController {
// Displays a notification in ash prompting the user whether to accept a
// change in the locale. If the user clicks the accept button (or closes the
// notification), OnLocaleChange() returns ACCEPT. If the user clicks the
// revert button, returns REVERT.
OnLocaleChanged(string current, string from, string to)
=> (LocaleNotificationResult result);
};

View File

@ -0,0 +1,124 @@
// 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.
module ash.mojom;
import "ash/public/interfaces/login_user_info.mojom";
import "components/proximity_auth/public/interfaces/auth_type.mojom";
import "components/signin/public/interfaces/account_id.mojom";
import "mojo/common/string16.mojom";
// Allows clients (e.g. Chrome browser) to control the ash lock screen.
interface LockScreen {
// Sets the client interface.
SetClient(LockScreenClient client);
// Displays the lock screen. |did_show| is true iff the lock UI was
// successfully displayed.
ShowLockScreen() => (bool did_show);
// Requests to show error message in the ash lock screen.
// TODO(xiaoyinh): login_attempts is probabaly not needed from chrome,
// remove it when we start to count the login attempts in ash lock screen.
// |login_attempts|: The number of the login authentication attempts.
// |error_text|: The error text to be shown in lock screen.
// |help_link_text|: The help link to be shown in lock screen.
// |help_topic_id|: The id of the help app topic regarding this error.
ShowErrorMessage(int32 login_attempts,
string error_text,
string help_link_text,
int32 help_topic_id);
// Requests to close any displayed error messages in ash lock screen.
ClearErrors();
// Requests to show the custom icon in the user pod.
// |account_id|: The account id of the user in the user pod.
// |icon|: Information regarding the icon.
ShowUserPodCustomIcon(signin.mojom.AccountId account_id,
UserPodCustomIconOptions icon);
// Requests to hide the custom icon in the user pod.
// |account_id|: The account id of the user in the user pod.
HideUserPodCustomIcon(signin.mojom.AccountId account_id);
// Requests to set the authentication type.
// |account_id|: The account id of the user in the user pod.
// |auth_type|: Authentication type.
// |initial_value|: A message shown in the password field of the user pod.
SetAuthType(signin.mojom.AccountId account_id,
proximity_auth.mojom.AuthType auth_type,
mojo.common.mojom.String16 initial_value);
// Requests to load users in the lock screen.
// |users|: A list of users who can unlock the device.
// |show_guest|: Whether to show guest session button.
LoadUsers(array<LoginUserInfo> users, bool show_guest);
// Notification if pin is enabled or disabled for the given user.
// |account_id|: The account id of the user in the user pod.
// |is_enabled|: True if pin unlock is enabled.
SetPinEnabledForUser(signin.mojom.AccountId account_id, bool is_enabled);
// Called when focus is reported to be leaving a lock screen app window.
// Requests focus to be handed off to the next suitable widget.
// |reverse|: Whether the tab order is reversed.
HandleFocusLeavingLockScreenApps(bool reverse);
};
// Allows ash lock screen to control a client (e.g. Chrome browser). Requests
// often involve preferences or talk to cryptohome that is not available to ash.
interface LockScreenClient {
// Request user authentication in chrome.
// If auth succeeds:
// chrome will hide the lock screen and clear any displayed error messages.
// If auth fails:
// chrome will request lock screen to show error messages.
// |account_id|: The account id of the user we are authenticating.
// |hashed_password|: The hashed password of the user.
// |authenticated_by_pin|: True if we are using pin to authenticate.
//
// The result will be set to true if auth was successful, false if not.
AuthenticateUser(signin.mojom.AccountId account_id,
string hashed_password,
bool authenticated_by_pin) => (bool auth_success);
// Request to attempt easy unlock in chrome.
// |account_id|: The account id of the user we are authenticating.
AttemptUnlock(signin.mojom.AccountId account_id);
// Request to hard lock the user pod.
// |account_id|: The account id of the user in the user pod.
HardlockPod(signin.mojom.AccountId account_id);
// Record clicks on the lock icon in the user pod.
// |account_id|: The account id of the user in the user pod.
RecordClickOnLockIcon(signin.mojom.AccountId account_id);
// Focus user pod of user with |account_id|.
OnFocusPod(signin.mojom.AccountId account_id);
// Notify that no user pod is focused.
OnNoPodFocused();
// Load wallpaper of user with |account_id|.
LoadWallpaper(signin.mojom.AccountId account_id);
// Sign out current user.
SignOutUser();
// Close add user screen.
CancelAddUser();
// User with |account_id| has reached maximum incorrect password attempts.
OnMaxIncorrectPasswordAttempted(signin.mojom.AccountId account_id);
// Should pass the focus to the active lock screen app window, if there is
// one. This is called when a lock screen app is reported to be active (using
// tray_action mojo interface), and is next in the tab order.
// |HandleFocusLeavingLockScreenApps| should be called to return focus to the
// lock screen.
// |reverse|: Whether the tab order is reversed.
FocusLockScreenApps(bool reverse);
};

View File

@ -0,0 +1,55 @@
// 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.
module ash.mojom;
import "ash/public/interfaces/user_info.mojom";
import "components/proximity_auth/public/interfaces/auth_type.mojom";
import "mojo/common/string16.mojom";
// Supported multi-profile user behavior values.
// Keep in sync with the enum in md_user_pod_row.js and user_pod_row.js
enum MultiProfileUserBehavior {
UNRESTRICTED = 0,
PRIMARY_ONLY = 1,
NOT_ALLOWED = 2,
OWNER_PRIMARY_ONLY = 3,
};
// Information about the custom icon in the user pod.
struct UserPodCustomIconOptions {
string id;
mojo.common.mojom.String16 tooltip;
bool autoshow_tooltip;
mojo.common.mojom.String16 aria_label;
bool hardlock_on_click;
bool is_trial_run;
};
// Info about a user in login/lock screen.
struct LoginUserInfo {
// User's basic information including account id, email, avatar etc.
UserInfo basic_user_info;
// What method the user can use to sign in.
proximity_auth.mojom.AuthType auth_type;
// True if this user has already signed in.
bool is_signed_in;
// True if this user is the device owner.
bool is_device_owner;
// True if fingerprint unlock is allowed for this user.
bool allow_fingerprint_unlock;
// True if multi-profiles sign in is allowed for this user.
bool is_multiprofile_allowed;
// Enforced policy for multi-profiles sign in.
MultiProfileUserBehavior multiprofile_policy;
// True if this user can be removed.
bool can_remove;
};

View File

@ -0,0 +1,45 @@
// Copyright 2016 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.
module ash.mojom;
// Describes whether media is currently being captured.
enum MediaCaptureState {
NONE = 0,
AUDIO = 1,
VIDEO = 2,
AUDIO_VIDEO = 3
};
// Allows clients (e.g. Chrome browser) to interface with the ash media
// indicators.
interface MediaController {
// Sets the client interface.
SetClient(associated MediaClient client);
// Called when the media capture state changes on the client, or in response
// to a RequestCaptureState() request. Returns an array of MediaCaptureState
// by index of the shell content. (These indexes are unstable, but are
// unlikely to change in practice, see comments in chrome's MediaClient::
// RequestCaptureState()).
NotifyCaptureState(array<MediaCaptureState> state);
};
// This delegate allows the UI code in ash to forward UI commands.
interface MediaClient {
// Handles the Next Track Media shortcut key.
HandleMediaNextTrack();
// Handles the Play/Pause Toggle Media shortcut key.
HandleMediaPlayPause();
// Handles the Previous Track Media shortcut key.
HandleMediaPrevTrack();
// Requests that the client resends the NotifyMediaCaptureChanged() message.
RequestCaptureState();
// Suspends all WebContents-associated media sessions to stop managed players.
SuspendMediaSessions();
};

View File

@ -0,0 +1,45 @@
// Copyright 2016 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.
module ash.mojom;
// An exported object in ash which lets an ash consumer set a client interface.
interface NewWindowController {
SetClient(associated NewWindowClient client);
// Shows the keyboard shortcut overlay. TODO(mash): this calls the client
// function of the same name below, but it should be implemented inside ash.
ShowKeyboardOverlay();
};
// A delegate interface that an ash user sends to ash to handle certain window
// management responsibilities.
interface NewWindowClient {
// Invoked when the user uses Ctrl+T to open a new tab.
NewTab();
// Invoked when the user uses Ctrl-N or Ctrl-Shift-N to open a new window.
NewWindow(bool incognito);
// Invoked when an accelerator is used to open the file manager.
OpenFileManager();
// Invoked when the user opens Crosh.
OpenCrosh();
// Invoked when an accelerator is used to open help center.
OpenGetHelp();
// Invoked when the user uses Shift+Ctrl+T to restore the closed tab.
RestoreTab();
// Shows the keyboard shortcut overlay.
ShowKeyboardOverlay();
// Shows the task manager window.
ShowTaskManager();
// Opens the feedback page for "Report Issue".
OpenFeedbackPage();
};

View File

@ -0,0 +1,55 @@
// 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.
module ash.mojom;
// Represents a geolocation position fix. It's "simple" because it doesn't
// expose all the parameters of the position interface as defined by the
// Geolocation API Specification:
// (https://dev.w3.org/geo/api/spec-source.html#position_interface).
// The NightLightController is only interested in valid latitude and longitude.
// It also doesn't require any specific accuracy. The more accurate the
// positions, the more accurate sunset and sunrise times calculations. However,
// an IP-based geoposition is considered good enough.
struct SimpleGeoposition {
double latitude;
double longitude;
};
// Used by a client (e.g. Chrome) to provide the current user's geoposition.
interface NightLightController {
// These values are written to logs. New enum values can be added, but
// existing enums must never be renumbered or deleted and reused.
enum ScheduleType {
// Automatic toggling of NightLight is turned off.
kNone = 0,
// Turned automatically on at the user's local sunset time, and off at the
// user's local sunrise time.
kSunsetToSunrise = 1,
// Toggled automatically based on the custom set start and end times
// selected by the user from the system settings.
kCustom = 2,
// Must be the last item, used for UMA histograms.
kLast = kCustom,
};
// Sets the client that will be notified of changes in the Night Light
// schedule type.
SetClient(NightLightClient client);
// Provides the NightLightController with the user's geoposition so that it
// can calculate the sunset and sunrise times. This should only be called when
// the schedule type is set to "Sunset to Sunrise".
SetCurrentGeoposition(SimpleGeoposition position);
};
// Used by ash to notify a client (e.g. Chrome) of the changes in the Night
// Light schedule type.
interface NightLightClient {
// Notifies the client with the new schedule type whenever it changes.
OnScheduleTypeChanged(NightLightController.ScheduleType new_type);
};

View File

@ -0,0 +1,24 @@
// 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.
module ash.mojom;
import "components/signin/public/interfaces/account_id.mojom";
import "services/preferences/public/interfaces/preferences.mojom";
const string kPrefConnectorServiceName = "ash_pref_connector";
// A connector of PrefStoreConnectors. Provides ash with access to per-profile
// prefs.
interface PrefConnector {
// Provides a PrefStoreConnector for the signin screen profile prefs. Once
// connected the prefs continue to be available even after the user logs in.
GetPrefStoreConnectorForSigninScreen(
prefs.mojom.PrefStoreConnector& connector);
// Provides, via |connector|, a PrefStoreConnector for |account_id|. If
// |account_id| is invalid or unknown, |connector| will be closed.
GetPrefStoreConnectorForUser(signin.mojom.AccountId account_id,
prefs.mojom.PrefStoreConnector& connector);
};

View File

@ -0,0 +1,199 @@
// Copyright 2016 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.
module ash.mojom;
import "ash/public/interfaces/user_info.mojom";
import "components/signin/public/interfaces/account_id.mojom";
import "mojo/common/time.mojom";
// Matches session_manager::SessionState.
enum SessionState {
// Default value, when session state hasn't been initialized yet.
UNKNOWN,
// Running out of box UI.
OOBE,
// Running login UI (primary user) but user sign in hasn't completed yet.
LOGIN_PRIMARY,
// Running login UI (primary or secondary user), user sign in has been
// completed but login UI hasn't been hidden yet. This means that either
// some session initialization is happening or user has to go through some
// UI flow on the same login UI like select avatar, agree to terms of
// service etc.
LOGGED_IN_NOT_ACTIVE,
// A user(s) has logged in *and* login UI is hidden i.e. user session is
// not blocked.
ACTIVE,
// The session screen is locked.
LOCKED,
// Same as SESSION_STATE_LOGIN_PRIMARY but for multi-profiles sign in i.e.
// when there's at least one user already active in the session.
LOGIN_SECONDARY,
};
// Matches ash::CycleUserDirection.
enum CycleUserDirection {
NEXT, // Cycle to the next user.
PREVIOUS, // Cycle to the previous user.
};
// Info about a user session in ash. May be sent repeatedly for a single user
// because individual fields may change (e.g. the avatar image or custodians).
struct UserSession {
// A user session id for the user session. It is generated by session manager
// (chrome) when a user session starts and never changes during the lifetime
// of the session manager. The number starts at 1 for the first user session
// and incremented by one for each subsequent user session.
uint32 session_id;
// Contains general user information state, like the account id, display name,
// and avatar.
UserInfo user_info;
// For supervised users only, the email address of the custodian account.
// Empty for non-supervised users. Available after profile is loaded.
string custodian_email;
// For supervised users only, the email address of the second custodian
// account, if any. Available after profile is loaded.
string second_custodian_email;
// Whether the settings icon should be enabled in the system tray menu.
// Usually true after login, but can be false for specialized user sessions
// (e.g. adding supervised users).
bool should_enable_settings;
// Similar to |should_show_settings| but for the notification tray.
bool should_show_notification_tray;
};
// Matches ash::AddUserSessionPolicy.
enum AddUserSessionPolicy {
// Adding a user session is allowed.
ALLOWED,
// Disallowed due to primary user's policy.
ERROR_NOT_ALLOWED_PRIMARY_USER,
// Disallowed due to no eligible users.
ERROR_NO_ELIGIBLE_USERS,
// Disallowed due to reaching maximum supported user.
ERROR_MAXIMUM_USERS_REACHED,
};
// Info about an ash session.
struct SessionInfo {
// Whether the screen can be locked.
bool can_lock_screen;
// Whether the screen should be locked automatically before suspending.
bool should_lock_screen_automatically;
// Whether the session is in app mode, which includes a kiosk-like mode for
// fullscreen web content or running a single [forced] Chrome or ARC app.
bool is_running_in_app_mode;
// Sets whether adding a user session to ash is allowed.
AddUserSessionPolicy add_user_session_policy;
// Current state of the ash session.
SessionState state;
};
// Interface for ash client (e.g. Chrome) to set session info for ash.
interface SessionController {
// Sets the client interface.
SetClient(SessionControllerClient client);
// Sets the ash session info.
SetSessionInfo(SessionInfo info);
// Updates a user session. This is called when a user session is added or
// its meta data (e.g. name, avatar) is changed. There is no method to remove
// a user session because ash/chrome does not support that. All users are
// logged out at the same time.
UpdateUserSession(UserSession user_session);
// Sets the order of user sessions. The order is keyed by the session id.
// Currently, session manager set a LRU order with the first one being the
// active user session.
SetUserSessionOrder(array<uint32> user_session_ids);
// Prepares ash for lock screen. Currently this ensures the current active
// window could not be used to mimic the lock screen. Lock screen is created
// after this call returns.
PrepareForLock() => ();
// Runs the pre-lock animation to start locking ash. When the call returns,
// |locked| == true means that the ash post-lock animation is finished and ash
// is fully locked. Otherwise |locked| is false, which means something is
// wrong for the lock and ash is not locked. When the call returns with a true
// |locked|, screen locker runs the post lock jobs such as a11y announcement
// etc. Invoked by the screen locker during initialization.
StartLock() => (bool locked);
// Notifies ash that chrome lock animations are finished. This is the last
// event for locking. SessionController forwards it to PowerEventObserver.
NotifyChromeLockAnimationsComplete();
// Runs the pre-unlock animation. Invoked by the screen locker before
// dismissing. When the mojo call returns, screen locker takes that as a
// signal of finished unlock animation and dismisses itself.
RunUnlockAnimation() => ();
// Notifies that chrome is terminating.
NotifyChromeTerminating();
// Adds a countdown timer to the system tray menu and creates or updates a
// notification saying the session length is limited (e.g. a public session in
// a library). Setting |length_limit| to zero removes the notification.
// NOTE: Chrome enforces the limit, not ash. Ash could enforce it if local
// state prefs and user activity monitoring were available under mustash.
// http://crbug.com/729808
SetSessionLengthLimit(mojo.common.mojom.TimeDelta length_limit,
mojo.common.mojom.TimeTicks start_time);
// Returns whether it's ok to switch the active multiprofile user. May affect
// or be affected by system state such as window overview mode and screen
// casting.
CanSwitchActiveUser() => (bool can_switch);
// Shows a dialog to explain the implications of signing in multiple users.
// If |on_accept| is false, |permanently_accept| is ignored.
ShowMultiprofilesIntroDialog() => (bool on_accept, bool permanently_accept);
// Shows a dialog to confirm that the user wants to teleport a window to
// another desktop. If |on_accept| is false, |permanently_accept| is ignored.
ShowTeleportWarningDialog() => (bool on_accept, bool permanently_accept);
// Shows a dialog that explains that the given user is no longer allowed in
// the session due to a policy change, and aborts the session.
ShowMultiprofilesSessionAbortedDialog(string user_email);
};
// Interface for ash to request session service from its client (e.g. Chrome).
interface SessionControllerClient {
// Requests to lock screen.
RequestLockScreen();
// Requests signing out all users, ending the current session.
RequestSignOut();
// Switch to the active user with |account_id| (if the user has already signed
// in).
SwitchActiveUser(signin.mojom.AccountId account_id);
// Switch the active user to the next or previous user.
CycleActiveUser(CycleUserDirection direction);
// Show the multi-profile login UI to add another user to this session.
ShowMultiProfileLogin();
};

View File

@ -0,0 +1,18 @@
# Copyright 2016 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.
mojom = "//ash/public/interfaces/session_controller.mojom"
public_headers = [
"//ash/public/cpp/session_types.h",
"//components/session_manager/session_manager_types.h",
]
traits_headers = [ "//ash/public/interfaces/session_controller_traits.h" ]
public_deps = [
"//components/session_manager:base",
]
type_mappings = [
"ash.mojom.AddUserSessionPolicy=ash::AddUserSessionPolicy",
"ash.mojom.CycleUserDirection=ash::CycleUserDirection",
"ash.mojom.SessionState=session_manager::SessionState",
]

View File

@ -0,0 +1,169 @@
// Copyright 2016 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.
module ash.mojom;
import "mojo/common/string16.mojom";
import "ui/events/mojo/event.mojom";
import "ui/gfx/image/mojo/image.mojom";
// The types of menu items shown in shelf context and application list menus.
// These values roughly match ui::MenuModel::ItemType (sans TYPE_BUTTON_ITEM).
enum MenuItemType {
COMMAND, // An item that performs an action when selected.
CHECK, // An item that can be selected/checked to toggle a boolean state.
RADIO, // An item that can be selected/checked among a group of choices.
SEPARATOR, // An item that shows a horizontal line separator.
SUBMENU, // An item that presents a submenu within another menu.
};
// The actions that may be performed when a shelf item is selected.
// These values match ash::ShelfAction.
enum ShelfAction {
NONE, // No action was taken.
WINDOW_CREATED, // A new window was created.
WINDOW_ACTIVATED, // An existing inactive window was activated.
WINDOW_MINIMIZED, // The currently active window was minimized.
APP_LIST_SHOWN, // The app list launcher menu was shown.
};
// Represents the status of items in the shelf.
// These values match ash::ShelfItemStatus.
enum ShelfItemStatus {
CLOSED, // A closed shelf item, i.e. has no live instance.
RUNNING, // A shelf item that has live instance.
ACTIVE, // An active shelf item that has focus.
ATTENTION, // A shelf item that needs user's attention.
};
// The type of a shelf item.
// These values match ash::ShelfItemType.
enum ShelfItemType {
PANEL, // A running app panel.
PINNED_APP, // A pinned app, which may be running or not.
APP_LIST, // An item that toggles visiblity of the app list.
BROWSER, // The browser shortcut, the browser may be running or not.
APP, // An unpinned running app window. Supports these app types:
// - Extension "V1" (legacy packaged and hosted) apps,
// - Extension "V2" (platform) apps,
// - ARC (App Runtime for Chrome - Android Play Store) apps.
DIALOG, // An open dialog.
UNDEFINED, // Default value.
};
// Source of the launch or activation request, for tracking.
// These values match ash::ShelfLaunchSource.
enum ShelfLaunchSource {
UNKNOWN, // The item was launched from outside the app list.
APP_LIST, // The item was launched from a generic app list view.
APP_LIST_SEARCH, // The item was launched from an app list search view.
};
// The Shelf controller allows clients (eg. Chrome) to control the ash shelf.
interface ShelfController {
// Observers are immediately notified of the current shelf states when added.
AddObserver(associated ShelfObserver observer);
// Note: ShelfObservers are not notified of ShelfModel changes made by the
// ShelfItem functions below. Chrome is the solitary ShelfObserver and client
// of these functions, so notifications would be cyclical and problematic.
// Add |item| at |index|, which is clamped to be greater than 0 (AppList's
// index) and not exceeding the item count. Use a negative |index| to append.
AddShelfItem(int32 index, ShelfItem item);
// Remove the item with |id|. Bails if |id| is unknown or for the AppList.
RemoveShelfItem(ShelfID id);
// Moves item with |id| to |index|, which is in terms of the model after the
// item is removed, and is clamped to be greater than 0 (AppList's index) and
// not exceeding the item count. Bails if |id| is unknown or for the AppList.
MoveShelfItem(ShelfID id, int32 target_index);
// Updates |item| via ShelfID. Bails if the id is unknown or for the AppList.
// Clients may pass null images to signal no change and avoid transport costs.
UpdateShelfItem(ShelfItem item);
// Sets the |delegate| for the item with |id|.
SetShelfItemDelegate(ShelfID id, ShelfItemDelegate delegate);
};
// A Shelf observer, used to persist profile settings and cache a ShelfModel.
interface ShelfObserver {
// Called when the |item| has been added at |index|.
// This passes null images to avoid transport costs; clients don't use images.
OnShelfItemAdded(int32 index, ShelfItem item);
// Called when the item with |id| has been removed.
OnShelfItemRemoved(ShelfID id);
// Called when the item with |id| has been moved to |index|.
OnShelfItemMoved(ShelfID id, int32 index);
// Called when the |item| with matching ShelfID has been updated.
// This passes null images to avoid transport costs; clients don't use images.
OnShelfItemUpdated(ShelfItem item);
// Called when |delegate| for the item with |id| has been changed.
OnShelfItemDelegateChanged(ShelfID id, ShelfItemDelegate delegate);
};
// ShelfItemDelegate handles shelf item selection, menu command execution, etc.
interface ShelfItemDelegate {
// Called when the user selects a shelf item. The event, display, and source
// info should be provided if known; some implementations use these arguments.
// Defaults: (nullptr, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN)
// The callback reports the action taken and any app menu items to show.
//
// NOTE: This codepath is not currently used for context menu triggering.
// TODO(crbug.com/691099): Remove |display_id| once panels are removed.
ItemSelected(ui.mojom.Event event,
int64 display_id,
ShelfLaunchSource source) => (ShelfAction action,
array<MenuItem>? menu_items);
// Called when spawning a shelf item context menu, returns custom menu items.
// TODO(mash): Clients should push context menu items to Ash's shelf model.
GetContextMenuItems(int64 display_id) => (array<MenuItem> items);
// Called on invocation of a shelf item's context or application menu command.
// |from_context_menu| is true if the command came from a context menu, or
// false if the command came from an application menu. If the |display_id| is
// unknown or irrelevant, callers may pass |display::kInvalidDisplayId|.
ExecuteCommand(bool from_context_menu,
int64 command_id,
int32 event_flags,
int64 display_id);
// Closes all windows associated with this shelf item.
Close();
};
// MenuItems are used to populate application menus for shelf items.
// Note: Some menus only support a subset of these item features (eg. no icons).
struct MenuItem {
MenuItemType type; // The type of the menu item.
int64 command_id; // The client's arbitrary item command id.
mojo.common.mojom.String16 label; // The string label, may be empty.
gfx.mojom.ImageSkia? image; // The image icon, may be null.
array<MenuItem>? submenu; // The optional nested submenu item list.
bool enabled; // The enabled state.
bool checked; // The checked state.
int64 radio_group_id; // The radio group id.
};
// Identifier for shelf items and their windows.
// This structure matches ash::ShelfID.
struct ShelfID {
string app_id; // An app id string, used to match app windows.
// (eg. extension ids, arc ids, "AppList", etc.)
string launch_id; // A string used to support multiple items per app.
// (eg. Citrix may use 'Word' or 'Excel' launch ids)
};
// ShelfItems are used to populate the shelf.
// This structure matches ash::ShelfItem.
struct ShelfItem {
ShelfItemType type; // The type of the shelf item.
gfx.mojom.ImageSkia? image; // The icon shown on the shelf; null for updates
// with no icon change, null for ShelfObservers.
ShelfItemStatus status; // The running/closed/etc. status of the item.
ShelfID shelf_id; // The id for the shelf item and its windows.
mojo.common.mojom.String16 title; // The title to display for tooltips, etc.
bool shows_tooltip; // Whether the tooltip should be shown on hover.
bool pinned_by_policy; // Whether the item is pinned by policy prefs,
// the user cannot un-pin these items.
};

View File

@ -0,0 +1,30 @@
# Copyright 2016 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.
mojom = "//ash/public/interfaces/shelf.mojom"
public_headers = [
"//ash/public/cpp/shelf_item.h",
"//ash/public/cpp/shelf_types.h",
"//ui/base/models/menu_model.h",
]
traits_headers = [ "//ash/public/cpp/shelf_struct_traits.h" ]
sources = [
"//ash/public/cpp/shelf_struct_traits.cc",
]
public_deps = [
"//mojo/common:common_custom_types",
"//ui/base",
"//ui/gfx/image/mojo:struct_traits",
]
type_mappings = [
"ash.mojom.MenuItemType=ui::MenuModel::ItemType",
"ash.mojom.ShelfAction=ash::ShelfAction",
"ash.mojom.ShelfAlignment=ash::ShelfAlignment",
"ash.mojom.ShelfAutoHideBehavior=ash::ShelfAutoHideBehavior",
"ash.mojom.ShelfID=ash::ShelfID",
"ash.mojom.ShelfItem=ash::ShelfItem",
"ash.mojom.ShelfItemStatus=ash::ShelfItemStatus",
"ash.mojom.ShelfItemType=ash::ShelfItemType",
"ash.mojom.ShelfLaunchSource=ash::ShelfLaunchSource",
]

View File

@ -0,0 +1,18 @@
// Copyright 2016 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.
module ash.mojom;
// Interface implemented by ash and used by chrome to provide shutdown policy
// information. Exists because device policy is owned by chrome, not ash.
interface ShutdownController {
// Sets a boolean pref that indicates whether the device automatically reboots
// when the user initiates a shutdown via an UI element. Used in enterprise
// environments for devices that should not be shut down.
SetRebootOnShutdown(bool reboot_on_shutdown);
// Triggers an animated shutdown after the login screen shutdown button was
// pressed.
RequestShutdownFromLoginScreen();
};

View File

@ -0,0 +1,133 @@
// Copyright 2016 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.
module ash.mojom;
import "ash/public/interfaces/update.mojom";
import "mojo/common/string16.mojom";
// Allows clients (e.g. Chrome browser) to control the ash system tray menu.
interface SystemTray {
// Sets the client interface.
SetClient(SystemTrayClient client);
// Sets the enabled state of the tray on the primary display. If not |enabled|
// any open menu will be closed.
SetPrimaryTrayEnabled(bool enabled);
// Sets the visibility of the tray on the primary display.
SetPrimaryTrayVisible(bool visible);
// Sets the clock to use 24 hour time formatting if |use_24_hour| is true.
// Otherwise sets 12 hour time formatting.
SetUse24HourClock(bool use_24_hour);
// Creates or updates an item in the system tray menu with information about
// enterprise management. The item appears if |enterprise_display_domain| is
// not empty or |active_directory_managed| is true.
SetEnterpriseDisplayDomain(string enterprise_display_domain,
bool active_directory_managed);
// Shows or hides an item in the system tray indicating that performance
// tracing is running.
SetPerformanceTracingIconVisible(bool visible);
// Shows an icon in the system tray indicating that a software update is
// available. Once shown the icon persists until reboot. |severity| and
// |factory_reset_required| are used to set the icon, color, and tooltip.
ShowUpdateIcon(UpdateSeverity severity,
bool factory_reset_required,
UpdateType update_type);
// If |visible| is true, shows an icon in the system tray which indicates that
// a software update is available but user's agreement is required as current
// connection is cellular. If |visible| is false, hides the icon because the
// user's one time permission on update over cellular connection has been
// granted.
SetUpdateOverCellularAvailableIconVisible(bool visible);
};
// Allows ash system tray to control a client (e.g. Chrome browser). Requests
// often involve preferences or web UI that is not available to ash.
interface SystemTrayClient {
// Shows general settings UI.
ShowSettings();
// Shows settings related to Bluetooth devices (e.g. to add a device).
ShowBluetoothSettings();
// Shows the web UI dialog to pair a Bluetooth device.
// |address| is the unique device address in the form "XX:XX:XX:XX:XX:XX"
// with hex digits X. |name_for_display| is a human-readable name, not
// necessarily the device name.
ShowBluetoothPairingDialog(string address,
mojo.common.mojom.String16 name_for_display,
bool paired,
bool connected);
// Shows the settings related to date, timezone etc.
ShowDateSettings();
// Shows the dialog to set system time, date, and timezone.
ShowSetTimeDialog();
// Shows settings related to multiple displays.
ShowDisplaySettings();
// Shows settings related to power.
ShowPowerSettings();
// Shows the page that lets you disable performance tracing.
ShowChromeSlow();
// Shows settings related to input methods.
ShowIMESettings();
// Shows the about chrome OS page and checks for updates after the page is
// loaded.
ShowAboutChromeOS();
// Shows the Chromebook help app.
ShowHelp();
// Shows accessibility help.
ShowAccessibilityHelp();
// Shows the settings related to accessibility.
ShowAccessibilitySettings();
// Shows the help center article for the stylus tool palette.
ShowPaletteHelp();
// Shows the settings related to the stylus tool palette.
ShowPaletteSettings();
// Shows information about public account mode.
ShowPublicAccountInfo();
// Shows information about enterprise enrolled devices.
ShowEnterpriseInfo();
// Shows UI to configure or activate the network specified by |network_id|,
// which may include showing payment or captive portal UI when appropriate.
ShowNetworkConfigure(string network_id);
// Shows UI to create a new network connection. The |type| is a Shill/Flimflam
// network type from third_party/cros_system_api/dbus/shill/dbus-constants.h
// ('wifi', 'cellular', etc.).
ShowNetworkCreate(string type);
// Shows the "add network" UI to create a third-party extension-backed VPN
// connection (e.g. Cisco AnyConnect).
ShowThirdPartyVpnCreate(string extension_id);
// Shows settings related to networking. If |network_id| is empty, shows
// general settings. Otherwise shows settings for the individual network.
// On devices |network_id| is a GUID, but on Linux desktop and in tests it can
// be any string.
ShowNetworkSettings(string network_id);
// Attempts to restart the system for update.
RequestRestartForUpdate();
};

View File

@ -0,0 +1,30 @@
// 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.
module ash.mojom;
import "mojo/common/string16.mojom";
// Top-level items in the system tray bubble.
// TODO(jamescook): Consolidate with SystemTrayItem::UmaType.
enum TrayItem {
kEnterprise,
kNetwork,
};
// All methods operate on the system tray on the primary display.
interface SystemTrayTestApi {
// Shows the system tray bubble menu.
ShowBubble() => ();
// Shows the submenu view for |item| in the system tray bubble menu.
ShowDetailedView(TrayItem item) => ();
// Returns true if the view exists in the bubble and is visible.
IsBubbleViewVisible(int32 view_id) => (bool visible);
// Returns the tooltip for a bubble view, or the empty string if the view
// does not exist.
GetBubbleViewTooltip(int32 view_id) => (mojo.common.mojom.String16 tooltip);
};

View File

@ -0,0 +1,18 @@
// Copyright 2016 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.
module ash.mojom;
// Controls tablet mode state in a client app (e.g. chrome).
interface TabletModeClient {
// Fired after the tablet mode has been toggled.
OnTabletModeToggled(bool enabled);
};
// Controls tablet mode state in ash.
interface TabletModeController {
// Sets a client (e.g. chrome). Triggers OnTabletModeToggled() to provide
// the initial state.
SetClient(TabletModeClient client);
};

View File

@ -0,0 +1,115 @@
// 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.
module ash.mojom;
// An action handler state.
enum TrayActionState {
// The action cannot be handled - due to no client being set, the client not
// supporting the action, user session not being locked etc.
kNotAvailable,
// The client supports the action and is not currently handling the action.
kAvailable,
// The client received the request for the action and it is launching the
// flow to handle it.
kLaunching,
// The client is currently handling the action.
kActive,
// The client is currently handling the action, but in background (e.g. the
// handler window for the lock screen action was moved to the background and
// appears underneath the login user pods).
kBackground,
};
// The user action that triggered a request for a new note.
// Used in histograms - should be kept in sync with
// NewLockScreenNoteRequestType histogram enum, and assigned values should
// never be changed.
enum LockScreenNoteOrigin {
// The note request originated from the new note button in the system
// tray - note that this UI element is deprecated.
kTrayAction = 0,
// The user tapped the note action button shown on the lock screen.
kLockScreenButtonTap = 1,
// The user swiped from the note action button shown on the lock screen.
kLockScreenButtonSwipe = 2,
// The user activated the lock screen button shown on the lock screen using
// the keyboard.
kLockScreenButtonKeyboard = 3,
// The user ejected the stylus tool from the device.
kStylusEject = 4,
// Not a real value - used primarily for UMA reporting (to report upper bound
// of valid histogram values).
kCount
};
// Reason for closing a lock screen note, and consequentially closing any
// existing note handler app windows.
// Used primarily for metrics reporting.
// IMPORTANT: The values should be kept in sync with
// LockScreenNoteTakingExitReason histogram enum, and assigned values should
// never be changed.
enum CloseLockScreenNoteReason {
// The user session was unlocked.
kSessionUnlock = 0,
// The user session was shut down (e.g. due to user sign-out).
kShutdown = 1,
// The user display was completely dimmed (e.g. due to user inactivity).
kScreenDimmed = 2,
// Device suspended.
kSuspend = 3,
// The app window associated with the note was closed by the app.
kAppWindowClosed = 4,
// The note taking app's support for the lock screen note taking was disabled
// (e.g. because of a policy update).
kAppLockScreenSupportDisabled = 5,
// The user pressed "Unlock" button on the lock screen UI.
kUnlockButtonPressed = 6,
// Not a real value - used primarily for UMA reporting (to report upper bound
// of valid histogram values).
kCount
};
// Used by a client (e.g. Chrome) to set up a handler for a tray action, and
// notify ash on the action handler's state changes. A tray action is one of
// predefined actions (currently only the "new note on lock screen" action is
// supported) that appear as an ash status area button if the client declares
// the action as available. Clicking the button invokes a client method that
// requests the action associated with the button to be handled.
interface TrayAction {
// Sets the client to be used to handle action requests.
// |lock_screen_note_state|: The current lock screen note action state
// associated with the client.
SetClient(TrayActionClient client, TrayActionState lock_screen_note_state);
// Updates action state for the lock screen note action. If called with no
// client set, the state change will not take effect until a client is set.
// Null client is equivalent to kNotAvailable state.
UpdateLockScreenNoteState(TrayActionState state);
};
// Used by ash to request Chrome to handle an action.
interface TrayActionClient {
// Requests a lock screen note action to be handled.
RequestNewLockScreenNote(LockScreenNoteOrigin origin);
// Closes lock screen note.
CloseLockScreenNote(CloseLockScreenNoteReason reason);
};

View File

@ -0,0 +1,10 @@
# Copyright 2016 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.
typemaps = [
"//ash/public/interfaces/session_controller.typemap",
"//ash/public/interfaces/shelf.typemap",
"//ash/public/interfaces/user_info.typemap",
"//ash/public/interfaces/wallpaper.typemap",
]

View File

@ -0,0 +1,23 @@
// Copyright 2016 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.
module ash.mojom;
// Urgency of a pending software update. Sets the system tray update icon color.
// TODO(jamescook): UpgradeDetector::UpgradeNotificationAnnoyanceLevel could be
// replaced with this if this moves into a component shared with non-ash chrome.
enum UpdateSeverity {
NONE,
LOW,
ELEVATED,
HIGH,
SEVERE,
CRITICAL,
};
// The type of update being applied. Sets the string in the system tray.
enum UpdateType {
FLASH,
SYSTEM,
};

View File

@ -0,0 +1,54 @@
// 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.
module ash.mojom;
import "components/signin/public/interfaces/account_id.mojom";
import "ui/gfx/image/mojo/image.mojom";
// Matches user_manager::UserType.
enum UserType {
// Regular user, has a user name and password.
REGULAR,
// Guest user, logs in without authentication.
GUEST,
// Public account user, logs in without authentication. Available only if
// enabled through policy.
PUBLIC_ACCOUNT,
// Supervised user, logs in only with local authentication.
SUPERVISED,
// Kiosk app robot, logs in without authentication.
KIOSK,
// Child user, with supervised options.
CHILD,
// Android app in kiosk mode, logs in without authentication.
ARC_KIOSK,
// Active Directory user. Authenticates against Active Directory server.
ACTIVE_DIRECTORY,
};
// Info about a user. May be sent repeatedly for a single user because
// individual fields may change (e.g. the avatar image or custodians).
struct UserInfo {
UserType type;
signin.mojom.AccountId account_id;
string display_name;
string display_email;
gfx.mojom.ImageSkia avatar;
// The raw bytes for the avatar. Useful if the avatar is animated.
// TODO(crbug.com/770373): Use a shared buffer (mojo.Blob), as this may be
// large enough to congest IPC.
array<uint8> avatar_bytes;
// True if this user has a newly created profile (first time login on the
// device)
bool is_new_profile;
};

View File

@ -0,0 +1,11 @@
# 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.
mojom = "//ash/public/interfaces/user_info.mojom"
public_headers = [ "//components/user_manager/user_type.h" ]
traits_headers = [ "//ash/public/interfaces/user_info_traits.h" ]
public_deps = [
"//components/user_manager",
]
type_mappings = [ "ash.mojom.UserType=user_manager::UserType" ]

View File

@ -0,0 +1,20 @@
// Copyright 2016 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.
module ash.mojom;
// Implemented by Chrome and used by ash to request audio volume changes.
// Implemented by Chrome because it's currently the only client of audio dbus
// interfaces (via CrasAudioHandler).
// TODO(crbug.com/644336): Flip this pattern, ash should implement the volume
// control interface or both ash and chrome should directly access the
// CrasAudioHandler volume control functions.
interface VolumeController {
// Mute the audio volume.
VolumeMute();
// Decrease the audio volume.
VolumeDown();
// Increase the audio volume.
VolumeUp();
};

View File

@ -0,0 +1,20 @@
// Copyright 2016 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.
module ash.mojom;
// Describes a third-party VPN provided by an extension (e.g. Cisco AnyConnect).
struct ThirdPartyVpnProvider {
string name;
string extension_id;
};
// Manages the VPN provider list in ash. Allows extension-backed VPN providers
// to be added. Ash handles the built-in OpenVPN / L2TP provider internally.
interface VpnList {
// Sets the list of third-party VPN providers. The |providers| array may be
// empty to clear the list (e.g. after the last third-party VPN extension is
// uninstalled).
SetThirdPartyVpnProviders(array<ThirdPartyVpnProvider> providers);
};

View File

@ -0,0 +1,69 @@
// Copyright 2016 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.
module ash.mojom;
import "mojo/common/time.mojom";
import "skia/public/interfaces/bitmap.mojom";
// These values match wallpaper::WallpaperLayout.
enum WallpaperLayout {
CENTER,
CENTER_CROPPED,
STRETCH,
TILE,
};
// These values match wallpaper::WallpaperType.
enum WallpaperType {
DAILY,
CUSTOMIZED,
DEFAULT,
ONLINE,
POLICY,
THIRDPARTY,
DEVICE,
};
// This corresponds to wallpaper::WallpaperInfo.
struct WallpaperInfo {
string location;
WallpaperLayout layout;
WallpaperType type;
mojo.common.mojom.Time date;
};
// Used by Chrome to set the wallpaper displayed by ash.
interface WallpaperController {
// Calling this method triggers an initial notification of the wallpaper
// state. Observers are automatically removed as their connections are closed.
AddObserver(associated WallpaperObserver observer);
// Set the wallpaper picker interface, to let ash trigger Chrome's picker.
SetWallpaperPicker(WallpaperPicker picker);
// Set the wallpaper bitmap and info used for the ash desktop background.
// A null or empty |wallpaper| bitmap is treated as a no-op.
// TODO(crbug.com/655875): Optimize ash wallpaper transport; avoid sending
// large bitmaps over Mojo; use shared memory like BitmapUploader, etc.
SetWallpaper(skia.mojom.Bitmap? wallpaper, WallpaperInfo info);
// Runs to get wallpaper prominent colors.
GetWallpaperColors() => (array<uint32> prominent_colors);
};
// Used to listen for wallpaper state changed.
interface WallpaperObserver {
// Called when the colors extracted from the current wallpaper change. May
// be called as a side effect of changing the wallpaper on the
// WallpaperController, e.g. WallpaperController::SetWallpaperImage().
// Colors are ordered and are referenced in wallpaper::ColorProfileType.
OnWallpaperColorsChanged(array<uint32> prominent_colors);
};
// Used by ash to trigger Chrome's wallpaper picker functionality.
interface WallpaperPicker {
// Open the wallpaper picker window.
Open();
};

View File

@ -0,0 +1,15 @@
# Copyright 2016 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.
mojom = "//ash/public/interfaces/wallpaper.mojom"
public_headers = [ "//components/wallpaper/wallpaper_info.h" ]
traits_headers = [ "//ash/public/cpp/wallpaper_struct_traits.h" ]
sources = [
"//ash/public/cpp/wallpaper_struct_traits.cc",
]
type_mappings = [
"ash.mojom.WallpaperLayout=wallpaper::WallpaperLayout",
"ash.mojom.WallpaperType=wallpaper::WallpaperType",
"ash.mojom.WallpaperInfo=wallpaper::WallpaperInfo",
]

View File

@ -0,0 +1,20 @@
// 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.
module ash.mojom;
// The window's pin type enum.
enum WindowPinType {
NONE,
// The window is pinned on top of other windows.
PINNED,
// The window is pinned on top of other windows. It is similar to
// PINNED but does not allow user to exit the mode by shortcut key.
TRUSTED_PINNED,
};
// The window's pin type. Maps to ash::kWindowPinTypeKey.
const string kWindowPinType_Property = "ash:window-pin-type";

View File

@ -0,0 +1,38 @@
// 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.
module ash.mojom;
// A superset of ui.mojom.ShowState. Ash has more states than the general
// ui::ShowState enum. These need to be communicated back to chrome.
// The separate enum is defined here because we don't want to leak
// these type to ui/base until they're stable and we know for sure
// that they'll persist over time.
enum WindowStateType {
// States which correspond to ui.mojom.ShowState.
DEFAULT,
NORMAL,
MINIMIZED,
MAXIMIZED,
INACTIVE,
FULLSCREEN,
// Additional ash states.
LEFT_SNAPPED,
RIGHT_SNAPPED,
// A window is in this state when it is automatically placed and
// sized by the window manager. (it's newly opened, or pushed to the side
// due to new window, for example).
AUTO_POSITIONED,
// A window is pinned on top of other windows with fullscreenized.
// Corresponding shelf should be hidden, also most of windows other than the
// pinned one should be hidden.
PINNED,
TRUSTED_PINNED,
};
// The window's extended state. Maps to ash::aura::kWindowStateTypeKey.
const string kWindowStateType_Property = "ash:window-state-type";

View File

@ -0,0 +1,13 @@
// 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.
module ash.mojom;
// Used to specify how the frame decorations and style should look.
enum WindowStyle {
DEFAULT = 0,
BROWSER,
};
const string kAshWindowStyle_InitProperty = "ash:window-style";

83
ash/resources/BUILD.gn Normal file
View File

@ -0,0 +1,83 @@
# Copyright 2014 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("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")
import("//ui/base/ui_features.gni")
assert(is_chromeos)
assert(enable_hidpi)
grit("resources") {
source = "ash_resources.grd"
outputs = [
"grit/ash_resources.h",
"ash_resources_100_percent.pak",
"ash_resources_200_percent.pak",
]
}
# Repacks resources needed for ash_unittests, etc. at a given scale.
# TODO(msw): Use ui_test.pak instead of its pieces? (no 200% support?)
template("ash_test_resources") {
percent = invoker.percent
repack("ash_test_resources_${target_name}") {
output = "$root_build_dir/${target_name}.pak"
sources = [
"$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak",
"$root_gen_dir/ui/app_list/resources/app_list_resources_${percent}_percent.pak",
"$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak",
"$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
"$root_gen_dir/ui/views/resources/views_resources_${percent}_percent.pak",
]
if (percent == "100") {
sources += [ "$root_gen_dir/ui/resources/webui_resources.pak" ]
}
if (defined(invoker.sources)) {
sources += invoker.sources
}
deps = [
"//ash/resources",
"//ui/app_list/resources",
"//ui/chromeos/resources",
"//ui/resources",
"//ui/views/resources",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (percent == "100") {
# TODO(msw): This seems bad, but follows repack_ui_test_pak's example.
deps += [ "//third_party/WebKit/public:resources_grit" ]
sources += [ "$root_gen_dir/blink/public/resources/blink_resources.pak" ]
}
}
}
ash_test_resources("100_percent") {
percent = "100"
}
ash_test_resources("200_percent") {
percent = "200"
}
# There is no with_content_200_percent as content resources are only available
# at 100%.
ash_test_resources("with_content_100_percent") {
percent = "100"
sources = [
"$root_gen_dir/content/content_resources.pak",
]
deps = [
"//content:resources",
]
}

View File

@ -0,0 +1,303 @@
# Copyright 2016 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("//components/vector_icons/vector_icons.gni")
aggregate_vector_icons("ash_vector_icons") {
icon_directory = "."
icons = [
"captive_portal.1x.icon",
"captive_portal.icon",
"check_circle.1x.icon",
"check_circle.icon",
"ime_menu_emoticon.1x.icon",
"ime_menu_emoticon.icon",
"ime_menu_microphone.1x.icon",
"ime_menu_microphone.icon",
"ime_menu_on_screen_keyboard.1x.icon",
"ime_menu_on_screen_keyboard.icon",
"ime_menu_write.1x.icon",
"ime_menu_write.icon",
"lock_screen_alert.1x.icon",
"lock_screen_alert.icon",
"lock_screen_arrow.1x.icon",
"lock_screen_arrow.icon",
"lock_screen_backspace.1x.icon",
"lock_screen_backspace.icon",
"lock_screen_dropdown.1x.icon",
"lock_screen_dropdown.icon",
"network_badge_add_other.1x.icon",
"network_badge_add_other.icon",
"network_badge_captive_portal.1x.icon",
"network_badge_captive_portal.icon",
"network_badge_off.1x.icon",
"network_badge_off.icon",
"network_badge_roaming.1x.icon",
"network_badge_roaming.icon",
"network_badge_secure.1x.icon",
"network_badge_secure.icon",
"network_badge_technology_1x.1x.icon",
"network_badge_technology_1x.icon",
"network_badge_technology_3g.1x.icon",
"network_badge_technology_3g.icon",
"network_badge_technology_4g.1x.icon",
"network_badge_technology_4g.icon",
"network_badge_technology_edge.1x.icon",
"network_badge_technology_edge.icon",
"network_badge_technology_evdo.1x.icon",
"network_badge_technology_evdo.icon",
"network_badge_technology_gprs.1x.icon",
"network_badge_technology_gprs.icon",
"network_badge_technology_hspa.1x.icon",
"network_badge_technology_hspa.icon",
"network_badge_technology_hspa_plus.1x.icon",
"network_badge_technology_hspa_plus.icon",
"network_badge_technology_lte.1x.icon",
"network_badge_technology_lte.icon",
"network_badge_technology_lte_advanced.1x.icon",
"network_badge_technology_lte_advanced.icon",
"network_badge_vpn.1x.icon",
"network_badge_vpn.icon",
"network_ethernet.1x.icon",
"network_ethernet.icon",
"network_mobile_not_connected_x.1x.icon",
"network_mobile_not_connected_x.icon",
"network_vpn.1x.icon",
"network_vpn.icon",
"notification_accessibility.icon",
"notification_accessibility_braille.icon",
"notification_battery_critical.icon",
"notification_battery_fluctuating.icon",
"notification_battery_low.icon",
"notification_bluetooth_battery_warning.icon",
"notification_bluetooth.icon",
"notification_capslock.icon",
"notification_center_all_done.icon",
"notification_center_clear_all.icon",
"notification_center_do_not_disturb_off.icon",
"notification_center_do_not_disturb_on.icon",
"notification_center_settings.icon",
"notification_charging_usb_c.icon",
"notification_chromevox.icon",
"notification_display_error.icon",
"notification_feedback_button.1x.icon",
"notification_feedback_button.icon",
"notification_low_power_battery.icon",
"notification_monitor_warning.icon",
"notification_screen.icon",
"notification_screenshare.icon",
"notification_settings.icon",
"notification_sms_sync.icon",
"notification_stylus_battery_warning.icon",
"notification_supervised.icon",
"notification_timer.icon",
"palette_action_capture_region.1x.icon",
"palette_action_capture_region.icon",
"palette_action_capture_screen.1x.icon",
"palette_action_capture_screen.icon",
"palette_action_create_note.1x.icon",
"palette_action_create_note.icon",
"palette_mode_laser_pointer.1x.icon",
"palette_mode_laser_pointer.icon",
"palette_mode_magnify.1x.icon",
"palette_mode_magnify.icon",
"palette_mode_metalayer.1x.icon",
"palette_mode_metalayer.icon",
"palette_tray_icon_capture_region.1x.icon",
"palette_tray_icon_capture_region.icon",
"palette_tray_icon_default.1x.icon",
"palette_tray_icon_default.icon",
"palette_tray_icon_laser_pointer.1x.icon",
"palette_tray_icon_laser_pointer.icon",
"palette_tray_icon_magnify.1x.icon",
"palette_tray_icon_magnify.icon",
"palette_tray_icon_metalayer.1x.icon",
"palette_tray_icon_metalayer.icon",
"shelf_back.1x.icon",
"shelf_back.icon",
"shelf_cancel_button.1x.icon",
"shelf_cancel_button.icon",
"shelf_keyboard.1x.icon",
"shelf_keyboard.icon",
"shelf_logout.1x.icon",
"shelf_logout.icon",
"shelf_notifications.1x.icon",
"shelf_notifications.icon",
"shelf_overflow.1x.icon",
"shelf_overflow.icon",
"shelf_overview.1x.icon",
"shelf_overview.icon",
"shelf_shutdown_button.1x.icon",
"shelf_shutdown_button.icon",
"shelf_sign_out_button.1x.icon",
"shelf_sign_out_button.icon",
"shelf_unlock_button.1x.icon",
"shelf_unlock_button.icon",
"splitview_nosnap_warning.icon",
"system_menu_accessibility.1x.icon",
"system_menu_accessibility.icon",
"system_menu_accessibility_auto_click.1x.icon",
"system_menu_accessibility_auto_click.icon",
"system_menu_accessibility_chromevox.1x.icon",
"system_menu_accessibility_chromevox.icon",
"system_menu_accessibility_contrast.1x.icon",
"system_menu_accessibility_contrast.icon",
"system_menu_accessibility_screen_magnifier.1x.icon",
"system_menu_audio_input.icon",
"system_menu_audio_input.1x.icon",
"system_menu_audio_output.icon",
"system_menu_audio_output.1x.icon",
"system_menu_accessibility_screen_magnifier.icon",
"system_menu_add_connection.1x.icon",
"system_menu_add_connection.icon",
"system_menu_arrow_back.1x.icon",
"system_menu_arrow_back.icon",
"system_menu_arrow_right.1x.icon",
"system_menu_arrow_right.icon",
"system_menu_bluetooth.1x.icon",
"system_menu_bluetooth.icon",
"system_menu_bluetooth_connected.1x.icon",
"system_menu_bluetooth_connected.icon",
"system_menu_bluetooth_disabled.1x.icon",
"system_menu_bluetooth_disabled.icon",
"system_menu_brightness.1x.icon",
"system_menu_brightness.icon",
"system_menu_business.1x.icon",
"system_menu_business.icon",
"system_menu_caps_lock.1x.icon",
"system_menu_caps_lock.icon",
"system_menu_cast.1x.icon",
"system_menu_cast.icon",
"system_menu_cast_device.1x.icon",
"system_menu_cast_device.icon",
"system_menu_cast_enabled.1x.icon",
"system_menu_cast_enabled.icon",
"system_menu_child_user.1x.icon",
"system_menu_child_user.icon",
"system_menu_computer.1x.icon",
"system_menu_computer.icon",
"system_menu_gamepad.1x.icon",
"system_menu_gamepad.icon",
"system_menu_guest.1x.icon",
"system_menu_guest.icon",
"system_menu_hdmi.1x.icon",
"system_menu_hdmi.icon",
"system_menu_headset.1x.icon",
"system_menu_headset.icon",
"system_menu_help.1x.icon",
"system_menu_help.icon",
"system_menu_info.1x.icon",
"system_menu_info.icon",
"system_menu_keyboard.1x.icon",
"system_menu_keyboard.icon",
"system_menu_keyboard_brightness.1x.icon",
"system_menu_keyboard_brightness.icon",
"system_menu_lock.1x.icon",
"system_menu_lock.icon",
"system_menu_mouse.1x.icon",
"system_menu_mouse.icon",
"system_menu_phone.1x.icon",
"system_menu_phone.icon",
"system_menu_power.1x.icon",
"system_menu_power.icon",
"system_menu_rotation_lock_auto.1x.icon",
"system_menu_rotation_lock_auto.icon",
"system_menu_rotation_lock_landscape.1x.icon",
"system_menu_rotation_lock_landscape.icon",
"system_menu_rotation_lock_portrait.1x.icon",
"system_menu_rotation_lock_portrait.icon",
"system_menu_screen_share.1x.icon",
"system_menu_screen_share.icon",
"system_menu_settings.1x.icon",
"system_menu_settings.icon",
"system_menu_sms.icon",
"system_menu_supervised_user.1x.icon",
"system_menu_supervised_user.icon",
"system_menu_tablet.1x.icon",
"system_menu_tablet.icon",
"system_menu_timer.1x.icon",
"system_menu_tracing.1x.icon",
"system_menu_tracing.icon",
"system_menu_timer.icon",
"system_menu_update.1x.icon",
"system_menu_update.icon",
"system_menu_new_user.1x.icon",
"system_menu_new_user.icon",
"system_menu_night_light_off.1x.icon",
"system_menu_night_light_off.icon",
"system_menu_night_light_on.1x.icon",
"system_menu_night_light_on.icon",
"system_menu_usb.1x.icon",
"system_menu_usb.icon",
"system_menu_videocam.1x.icon",
"system_menu_videocam.icon",
"system_menu_volume_high.1x.icon",
"system_menu_volume_high.icon",
"system_menu_volume_low.1x.icon",
"system_menu_volume_low.icon",
"system_menu_volume_medium.1x.icon",
"system_menu_volume_medium.icon",
"system_menu_volume_mute.1x.icon",
"system_menu_volume_mute.icon",
"system_tray_accessibility.1x.icon",
"system_tray_accessibility.icon",
"system_tray_battery_alert.1x.icon",
"system_tray_battery_alert.icon",
"system_tray_battery_bolt.1x.icon",
"system_tray_battery_bolt.icon",
"system_tray_battery_unreliable.1x.icon",
"system_tray_battery_unreliable.icon",
"system_tray_battery_x.1x.icon",
"system_tray_battery_x.icon",
"system_tray_caps_lock.1x.icon",
"system_tray_caps_lock.icon",
"system_tray_cast.1x.icon",
"system_tray_cast.icon",
"system_tray_night_light.1x.icon",
"system_tray_night_light.icon",
"system_tray_recording.1x.icon",
"system_tray_recording.icon",
"system_tray_rotation_lock_auto.1x.icon",
"system_tray_rotation_lock_auto.icon",
"system_tray_rotation_lock_locked.1x.icon",
"system_tray_rotation_lock_locked.icon",
"system_tray_screen_share.1x.icon",
"system_tray_screen_share.icon",
"system_tray_tracing.1x.icon",
"system_tray_tracing.icon",
"system_tray_update.1x.icon",
"system_tray_update.icon",
"system_tray_volume_mute.1x.icon",
"system_tray_volume_mute.icon",
"touch_calibration_complete_check.1x.icon",
"touch_calibration_complete_check.icon",
"touch_calibration_hand.icon",
"tray_action_new_lock_screen_note.1x.icon",
"tray_action_new_lock_screen_note.icon",
"window_control_close.1x.icon",
"window_control_close.icon",
"window_control_left_snapped.1x.icon",
"window_control_left_snapped.icon",
"window_control_maximize.1x.icon",
"window_control_maximize.icon",
"window_control_minimize.1x.icon",
"window_control_minimize.icon",
"window_control_restore.1x.icon",
"window_control_restore.icon",
"window_control_right_snapped.1x.icon",
"window_control_right_snapped.icon",
]
}
source_set("vector_icons") {
sources = get_target_outputs(":ash_vector_icons")
deps = [
":ash_vector_icons",
"//base",
"//skia",
"//ui/gfx",
]
}

102
ash/strings/BUILD.gn Normal file
View File

@ -0,0 +1,102 @@
# Copyright 2014 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("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")
assert(is_chromeos)
grit("strings") {
source = "../ash_strings.grd"
outputs = [
"grit/ash_strings.h",
"ash_strings_am.pak",
"ash_strings_ar.pak",
"ash_strings_bg.pak",
"ash_strings_bn.pak",
"ash_strings_ca.pak",
"ash_strings_cs.pak",
"ash_strings_da.pak",
"ash_strings_de.pak",
"ash_strings_el.pak",
"ash_strings_en-GB.pak",
"ash_strings_en-US.pak",
"ash_strings_es.pak",
"ash_strings_es-419.pak",
"ash_strings_et.pak",
"ash_strings_fa.pak",
"ash_strings_fake-bidi.pak",
"ash_strings_fi.pak",
"ash_strings_fil.pak",
"ash_strings_fr.pak",
"ash_strings_gu.pak",
"ash_strings_he.pak",
"ash_strings_hi.pak",
"ash_strings_hr.pak",
"ash_strings_hu.pak",
"ash_strings_id.pak",
"ash_strings_it.pak",
"ash_strings_ja.pak",
"ash_strings_kn.pak",
"ash_strings_ko.pak",
"ash_strings_lt.pak",
"ash_strings_lv.pak",
"ash_strings_ml.pak",
"ash_strings_mr.pak",
"ash_strings_ms.pak",
"ash_strings_nl.pak",
"ash_strings_nb.pak",
"ash_strings_pl.pak",
"ash_strings_pt-BR.pak",
"ash_strings_pt-PT.pak",
"ash_strings_ro.pak",
"ash_strings_ru.pak",
"ash_strings_sk.pak",
"ash_strings_sl.pak",
"ash_strings_sr.pak",
"ash_strings_sv.pak",
"ash_strings_sw.pak",
"ash_strings_ta.pak",
"ash_strings_te.pak",
"ash_strings_th.pak",
"ash_strings_tr.pak",
"ash_strings_uk.pak",
"ash_strings_vi.pak",
"ash_strings_zh-CN.pak",
"ash_strings_zh-TW.pak",
]
}
# Creates locale-specific pak files with strings needed for ash_unittests, etc.
template("repack_one_locale_ash") {
locale = invoker.locale
output = invoker.output
repack(target_name) {
# Each input pak file should also have a deps line for completeness.
sources = [
"$root_gen_dir/ash/strings/ash_strings_${locale}.pak",
"$root_gen_dir/components/strings/components_strings_${locale}.pak",
"$root_gen_dir/device/bluetooth/strings/bluetooth_strings_${locale}.pak",
"$root_gen_dir/ui/chromeos/strings/ui_chromeos_strings_${locale}.pak",
"$root_gen_dir/ui/strings/app_locale_settings_${locale}.pak",
"$root_gen_dir/ui/strings/ui_strings_${locale}.pak",
]
deps = [
"//ash/strings",
"//components/strings",
"//device/bluetooth/strings",
"//ui/chromeos/strings",
"//ui/strings:app_locale_settings",
"//ui/strings:ui_strings",
]
}
}
# Creates a pak file containing en-US strings for ash_unittests, etc.
repack_one_locale_ash("ash_test_strings") {
output = "$root_build_dir/ash_test_strings.pak"
locale = "en-US"
}

26
ash/touch_hud/BUILD.gn Normal file
View File

@ -0,0 +1,26 @@
# Copyright 2016 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")
component("touch_hud") {
sources = [
"ash_touch_hud_export.h",
"touch_hud_renderer.cc",
"touch_hud_renderer.h",
]
defines = [ "ASH_TOUCH_HUD_IMPLEMENTATION" ]
deps = [
"//base",
"//cc/paint",
"//skia",
"//ui/compositor",
"//ui/events",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/views",
]
}

View File

@ -0,0 +1,54 @@
# Copyright 2016 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")
import("//services/service_manager/public/cpp/service.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//mojo/public/tools/bindings/mojom.gni")
source_set("lib") {
sources = [
"touch_hud_application.cc",
"touch_hud_application.h",
]
deps = [
"//ash/public/cpp:ash_public_cpp",
"//ash/touch_hud",
"//base",
"//mash/public/interfaces",
"//mojo/common",
"//mojo/public/cpp/bindings",
"//services/service_manager/public/cpp",
"//services/ui/public/cpp",
"//services/ui/public/interfaces",
"//ui/views",
"//ui/views/mus:for_mojo_application",
]
data_deps = [
"//services/ui",
]
}
service("touch_hud") {
sources = [
"main.cc",
]
deps = [
":lib",
"//base",
"//mojo/public/cpp/bindings",
"//services/service_manager/public/cpp",
"//ui/views/mus:for_mojo_application",
]
resources = [ "$root_out_dir/views_mus_resources.pak" ]
}
service_manifest("manifest") {
name = "touch_hud"
source = "manifest.json"
}

20
ash/wayland/BUILD.gn Normal file
View File

@ -0,0 +1,20 @@
# 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.
assert(is_chromeos)
source_set("wayland") {
sources = [
"wayland_server_controller.cc",
"wayland_server_controller.h",
]
deps = [
"//ash/public/cpp:ash_public_cpp",
"//base",
"//components/exo",
"//components/exo/wayland",
"//skia",
]
}

2817
base/BUILD.gn Normal file

File diff suppressed because it is too large Load Diff

16
base/DEPS Normal file
View File

@ -0,0 +1,16 @@
include_rules = [
"+jni",
"+third_party/ashmem",
"+third_party/apple_apsl",
"+third_party/ced",
"+third_party/lss",
"+third_party/modp_b64",
"+third_party/tcmalloc",
# These are implicitly brought in from the root, and we don't want them.
"-ipc",
"-url",
# ICU dependendencies must be separate from the rest of base.
"-i18n",
]

45
base/OWNERS Normal file
View File

@ -0,0 +1,45 @@
# About src/base:
#
# Chromium is a very mature project, most things that are generally useful are
# already here, and that things not here aren't generally useful.
#
# Base is pulled into many projects. For example, various ChromeOS daemons. So
# the bar for adding stuff is that it must have demonstrated wide
# applicability. Prefer to add things closer to where they're used (i.e. "not
# base"), and pull into base only when needed. In a project our size,
# sometimes even duplication is OK and inevitable.
#
# Adding a new logging macro DPVELOG_NE is not more clear than just
# writing the stuff you want to log in a regular logging statement, even
# if it makes your calling code longer. Just add it to your own code.
#
# If the code in question does not need to be used inside base, but will have
# multiple consumers across the codebase, consider placing it in a new directory
# under components/ instead.
danakj@chromium.org
dcheng@chromium.org
gab@chromium.org
mark@chromium.org
thakis@chromium.org
thestig@chromium.org
# For Bind/Callback:
per-file bind*=tzik@chromium.org
per-file callback*=tzik@chromium.org
# For Android-specific changes:
per-file *android*=file://base/android/OWNERS
per-file BUILD.gn=file://base/android/OWNERS
# For Fuchsia-specific changes:
per-file *_fuchsia*=file://build/fuchsia/OWNERS
# For FeatureList API:
per-file feature_list*=asvitkine@chromium.org
per-file feature_list*=isherman@chromium.org
# For TCMalloc tests:
per-file security_unittest.cc=jln@chromium.org
# COMPONENT: Internals>Core

49
base/PRESUBMIT.py Normal file
View File

@ -0,0 +1,49 @@
# Copyright (c) 2012 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.
"""Chromium presubmit script for src/base.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into depot_tools.
"""
def _CheckNoInterfacesInBase(input_api, output_api):
"""Checks to make sure no files in libbase.a have |@interface|."""
pattern = input_api.re.compile(r'^\s*@interface', input_api.re.MULTILINE)
files = []
for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
if (f.LocalPath().startswith('base/') and
not "/ios/" in f.LocalPath() and
not "/test/" in f.LocalPath() and
not f.LocalPath().endswith('_unittest.mm') and
not f.LocalPath().endswith('mac/sdk_forward_declarations.h')):
contents = input_api.ReadFile(f)
if pattern.search(contents):
files.append(f)
if len(files):
return [ output_api.PresubmitError(
'Objective-C interfaces or categories are forbidden in libbase. ' +
'See http://groups.google.com/a/chromium.org/group/chromium-dev/' +
'browse_thread/thread/efb28c10435987fd',
files) ]
return []
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
results.extend(_CheckNoInterfacesInBase(input_api, output_api))
return results
def CheckChangeOnUpload(input_api, output_api):
results = []
results.extend(_CommonChecks(input_api, output_api))
return results
def CheckChangeOnCommit(input_api, output_api):
results = []
results.extend(_CommonChecks(input_api, output_api))
return results

274
base/allocator/BUILD.gn Normal file
View File

@ -0,0 +1,274 @@
# Copyright (c) 2013 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/buildflag_header.gni")
import("//build/config/allocator.gni")
import("//build/config/compiler/compiler.gni")
declare_args() {
# Provide a way to force disable debugallocation in Debug builds,
# e.g. for profiling (it's more rare to profile Debug builds,
# but people sometimes need to do that).
enable_debugallocation = is_debug
}
# This "allocator" meta-target will forward to the default allocator according
# to the build settings.
group("allocator") {
public_deps = []
deps = []
if (use_allocator == "tcmalloc") {
deps += [ ":tcmalloc" ]
}
}
config("tcmalloc_flags") {
defines = []
if (enable_debugallocation) {
defines += [
# Use debugallocation for Debug builds to catch problems early
# and cleanly, http://crbug.com/30715 .
"TCMALLOC_FOR_DEBUGALLOCATION",
]
}
if (use_allocator_shim) {
defines += [ "TCMALLOC_DONT_REPLACE_SYSTEM_ALLOC" ]
}
if (is_clang) {
cflags = [
# tcmalloc initializes some fields in the wrong order.
"-Wno-reorder",
# tcmalloc contains some unused local template specializations.
"-Wno-unused-function",
# tcmalloc uses COMPILE_ASSERT without static_assert but with typedefs.
"-Wno-unused-local-typedefs",
# for magic2_ in debugallocation.cc (only built in Debug builds) typedefs.
"-Wno-unused-private-field",
]
} else {
cflags = []
}
if (is_linux || is_android) {
# We enable all warnings by default, but upstream disables a few.
# Keep "-Wno-*" flags in sync with upstream by comparing against:
# http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.am
cflags += [
"-Wno-sign-compare",
"-Wno-unused-result",
]
}
}
if (use_allocator == "tcmalloc") {
# tcmalloc currently won't compile on Android.
source_set("tcmalloc") {
tcmalloc_dir = "//third_party/tcmalloc/chromium"
# Don't check tcmalloc's includes. These files include various files like
# base/foo.h and they actually refer to tcmalloc's forked copy of base
# rather than the regular one, which confuses the header checker.
check_includes = false
sources = [
# Generated for our configuration from tcmalloc's build
# and checked in.
"$tcmalloc_dir/src/config.h",
"$tcmalloc_dir/src/config_android.h",
"$tcmalloc_dir/src/config_linux.h",
"$tcmalloc_dir/src/config_win.h",
# tcmalloc native and forked files.
"$tcmalloc_dir/src/base/abort.cc",
"$tcmalloc_dir/src/base/abort.h",
"$tcmalloc_dir/src/base/arm_instruction_set_select.h",
"$tcmalloc_dir/src/base/atomicops-internals-arm-generic.h",
"$tcmalloc_dir/src/base/atomicops-internals-arm-v6plus.h",
"$tcmalloc_dir/src/base/atomicops-internals-linuxppc.h",
"$tcmalloc_dir/src/base/atomicops-internals-macosx.h",
"$tcmalloc_dir/src/base/atomicops-internals-windows.h",
"$tcmalloc_dir/src/base/atomicops-internals-x86.cc",
"$tcmalloc_dir/src/base/atomicops-internals-x86.h",
"$tcmalloc_dir/src/base/atomicops.h",
"$tcmalloc_dir/src/base/commandlineflags.h",
"$tcmalloc_dir/src/base/cycleclock.h",
# We don't list dynamic_annotations.c since its copy is already
# present in the dynamic_annotations target.
"$tcmalloc_dir/src/base/elf_mem_image.cc",
"$tcmalloc_dir/src/base/elf_mem_image.h",
"$tcmalloc_dir/src/base/linuxthreads.cc",
"$tcmalloc_dir/src/base/linuxthreads.h",
"$tcmalloc_dir/src/base/logging.cc",
"$tcmalloc_dir/src/base/logging.h",
"$tcmalloc_dir/src/base/low_level_alloc.cc",
"$tcmalloc_dir/src/base/low_level_alloc.h",
"$tcmalloc_dir/src/base/spinlock.cc",
"$tcmalloc_dir/src/base/spinlock.h",
"$tcmalloc_dir/src/base/spinlock_internal.cc",
"$tcmalloc_dir/src/base/spinlock_internal.h",
"$tcmalloc_dir/src/base/synchronization_profiling.h",
"$tcmalloc_dir/src/base/sysinfo.cc",
"$tcmalloc_dir/src/base/sysinfo.h",
"$tcmalloc_dir/src/base/vdso_support.cc",
"$tcmalloc_dir/src/base/vdso_support.h",
"$tcmalloc_dir/src/central_freelist.cc",
"$tcmalloc_dir/src/central_freelist.h",
"$tcmalloc_dir/src/common.cc",
"$tcmalloc_dir/src/common.h",
# #included by debugallocation_shim.cc
#"$tcmalloc_dir/src/debugallocation.cc",
"$tcmalloc_dir/src/free_list.cc",
"$tcmalloc_dir/src/free_list.h",
"$tcmalloc_dir/src/gperftools/heap-profiler.h",
"$tcmalloc_dir/src/gperftools/malloc_extension.h",
"$tcmalloc_dir/src/gperftools/malloc_hook.h",
"$tcmalloc_dir/src/gperftools/stacktrace.h",
"$tcmalloc_dir/src/heap-profile-table.cc",
"$tcmalloc_dir/src/heap-profile-table.h",
"$tcmalloc_dir/src/heap-profiler.cc",
"$tcmalloc_dir/src/internal_logging.cc",
"$tcmalloc_dir/src/internal_logging.h",
"$tcmalloc_dir/src/linked_list.h",
"$tcmalloc_dir/src/malloc_extension.cc",
"$tcmalloc_dir/src/malloc_hook-inl.h",
"$tcmalloc_dir/src/malloc_hook.cc",
"$tcmalloc_dir/src/maybe_threads.cc",
"$tcmalloc_dir/src/maybe_threads.h",
"$tcmalloc_dir/src/memory_region_map.cc",
"$tcmalloc_dir/src/memory_region_map.h",
"$tcmalloc_dir/src/page_heap.cc",
"$tcmalloc_dir/src/page_heap.h",
"$tcmalloc_dir/src/raw_printer.cc",
"$tcmalloc_dir/src/raw_printer.h",
"$tcmalloc_dir/src/sampler.cc",
"$tcmalloc_dir/src/sampler.h",
"$tcmalloc_dir/src/span.cc",
"$tcmalloc_dir/src/span.h",
"$tcmalloc_dir/src/stack_trace_table.cc",
"$tcmalloc_dir/src/stack_trace_table.h",
"$tcmalloc_dir/src/stacktrace.cc",
"$tcmalloc_dir/src/static_vars.cc",
"$tcmalloc_dir/src/static_vars.h",
"$tcmalloc_dir/src/symbolize.cc",
"$tcmalloc_dir/src/symbolize.h",
"$tcmalloc_dir/src/system-alloc.cc",
"$tcmalloc_dir/src/system-alloc.h",
# #included by debugallocation_shim.cc
#"$tcmalloc_dir/src/tcmalloc.cc",
#"$tcmalloc_dir/src/tcmalloc.h",
"$tcmalloc_dir/src/thread_cache.cc",
"$tcmalloc_dir/src/thread_cache.h",
"$tcmalloc_dir/src/windows/port.cc",
"$tcmalloc_dir/src/windows/port.h",
"debugallocation_shim.cc",
# These are both #included by allocator_shim for maximal linking.
#"generic_allocators.cc",
#"win_allocator.cc",
]
# Disable the heap checker in tcmalloc.
defines = [ "NO_HEAP_CHECK" ]
include_dirs = [
".",
"$tcmalloc_dir/src/base",
"$tcmalloc_dir/src",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//build/config/compiler:no_chromium_code",
":tcmalloc_flags",
]
# Thumb mode disabled due to bug in clang integrated assembler
# TODO(https://llvm.org/bugs/show_bug.cgi?id=31058)
configs -= [ "//build/config/compiler:compiler_arm_thumb" ]
configs += [ "//build/config/compiler:compiler_arm" ]
# TODO(crbug.com/633719) Make tcmalloc work with AFDO if possible.
configs -= [ "//build/config/compiler:afdo" ]
deps = []
if (enable_profiling) {
sources += [
"$tcmalloc_dir/src/base/thread_lister.c",
"$tcmalloc_dir/src/base/thread_lister.h",
"$tcmalloc_dir/src/profile-handler.cc",
"$tcmalloc_dir/src/profile-handler.h",
"$tcmalloc_dir/src/profiledata.cc",
"$tcmalloc_dir/src/profiledata.h",
"$tcmalloc_dir/src/profiler.cc",
]
defines += [ "ENABLE_PROFILING=1" ]
}
if (is_linux || is_android) {
sources -= [
"$tcmalloc_dir/src/system-alloc.h",
"$tcmalloc_dir/src/windows/port.cc",
"$tcmalloc_dir/src/windows/port.h",
]
# Compiling tcmalloc with -fvisibility=default is only necessary when
# not using the allocator shim, which provides the correct visibility
# annotations for those symbols which need to be exported (see
# //base/allocator/allocator_shim_override_glibc_weak_symbols.h and
# //base/allocator/allocator_shim_internals.h for the definition of
# SHIM_ALWAYS_EXPORT).
if (!use_allocator_shim) {
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
}
ldflags = [
# Don't let linker rip this symbol out, otherwise the heap&cpu
# profilers will not initialize properly on startup.
"-Wl,-uIsHeapProfilerRunning,-uProfilerStart",
# Do the same for heap leak checker.
"-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_MMapPKvS0_jiiix,-u_Z22InitialMallocHook_SbrkPKvi",
"-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_MMapPKvS0_miiil,-u_Z22InitialMallocHook_SbrkPKvl",
"-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakChecker14UnIgnoreObjectEPKv",
]
}
# Make sure the allocation library is optimized as much as possible when
# we"re in release mode.
if (!is_debug) {
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
deps += [ "//base/third_party/dynamic_annotations" ]
}
} # use_allocator == "tcmalloc"
buildflag_header("features") {
header = "features.h"
flags = [ "USE_ALLOCATOR_SHIM=$use_allocator_shim" ]
}
# Used to shim malloc symbols on Android. see //base/allocator/README.md.
config("wrap_malloc_symbols") {
ldflags = [
"-Wl,-wrap,calloc",
"-Wl,-wrap,free",
"-Wl,-wrap,malloc",
"-Wl,-wrap,memalign",
"-Wl,-wrap,posix_memalign",
"-Wl,-wrap,pvalloc",
"-Wl,-wrap,realloc",
"-Wl,-wrap,valloc",
]
}

7
base/allocator/OWNERS Normal file
View File

@ -0,0 +1,7 @@
primiano@chromium.org
wfh@chromium.org
# For changes to tcmalloc it is advisable to ask jar@chromium.org
# before proceeding.
# COMPONENT: Internals

197
base/allocator/README.md Normal file
View File

@ -0,0 +1,197 @@
This document describes how malloc / new calls are routed in the various Chrome
platforms.
Bare in mind that the chromium codebase does not always just use `malloc()`.
Some examples:
- Large parts of the renderer (Blink) use two home-brewed allocators,
PartitionAlloc and BlinkGC (Oilpan).
- Some subsystems, such as the V8 JavaScript engine, handle memory management
autonomously.
- Various parts of the codebase use abstractions such as `SharedMemory` or
`DiscardableMemory` which, similarly to the above, have their own page-level
memory management.
Background
----------
The `allocator` target defines at compile-time the platform-specific choice of
the allocator and extra-hooks which services calls to malloc/new. The relevant
build-time flags involved are `use_allocator` and `use_allocator_shim`.
The default choices are as follows:
**Windows**
`use_allocator: winheap`, the default Windows heap.
Additionally, `static_library` (i.e. non-component) builds have a shim
layer wrapping malloc/new, which is controlled by `use_allocator_shim`.
The shim layer provides extra security features, such as preventing large
allocations that can hit signed vs. unsigned bugs in third_party code.
**Linux Desktop / CrOS**
`use_allocator: tcmalloc`, a forked copy of tcmalloc which resides in
`third_party/tcmalloc/chromium`. Setting `use_allocator: none` causes the build
to fall back to the system (Glibc) symbols.
**Android**
`use_allocator: none`, always use the allocator symbols coming from Android's
libc (Bionic). As it is developed as part of the OS, it is considered to be
optimized for small devices and more memory-efficient than other choices.
The actual implementation backing malloc symbols in Bionic is up to the board
config and can vary (typically *dlmalloc* or *jemalloc* on most Nexus devices).
**Mac/iOS**
`use_allocator: none`, we always use the system's allocator implementation.
In addition, when building for `asan` / `msan` / `syzyasan` `valgrind`, the
both the allocator and the shim layer are disabled.
Layering and build deps
-----------------------
The `allocator` target provides both the source files for tcmalloc (where
applicable) and the linker flags required for the Windows shim layer.
The `base` target is (almost) the only one depending on `allocator`. No other
targets should depend on it, with the exception of the very few executables /
dynamic libraries that don't depend, either directly or indirectly, on `base`
within the scope of a linker unit.
More importantly, **no other place outside of `/base` should depend on the
specific allocator** (e.g., directly include `third_party/tcmalloc`).
If such a functional dependency is required that should be achieved using
abstractions in `base` (see `/base/allocator/allocator_extension.h` and
`/base/memory/`)
**Why `base` depends on `allocator`?**
Because it needs to provide services that depend on the actual allocator
implementation. In the past `base` used to pretend to be allocator-agnostic
and get the dependencies injected by other layers. This ended up being an
inconsistent mess.
See the [allocator cleanup doc][url-allocator-cleanup] for more context.
Linker unit targets (executables and shared libraries) that depend in some way
on `base` (most of the targets in the codebase) get automatically the correct
set of linker flags to pull in tcmalloc or the Windows shim-layer.
Source code
-----------
This directory contains just the allocator (i.e. shim) layer that switches
between the different underlying memory allocation implementations.
The tcmalloc library originates outside of Chromium and exists in
`../../third_party/tcmalloc` (currently, the actual location is defined in the
allocator.gyp file). The third party sources use a vendor-branch SCM pattern to
track Chromium-specific changes independently from upstream changes.
The general intent is to push local changes upstream so that over
time we no longer need any forked files.
Unified allocator shim
----------------------
On most platforms, Chrome overrides the malloc / operator new symbols (and
corresponding free / delete and other variants). This is to enforce security
checks and lately to enable the
[memory-infra heap profiler][url-memory-infra-heap-profiler].
Historically each platform had its special logic for defining the allocator
symbols in different places of the codebase. The unified allocator shim is
a project aimed to unify the symbol definition and allocator routing logic in
a central place.
- Full documentation: [Allocator shim design doc][url-allocator-shim].
- Current state: Available and enabled by default on Android, CrOS, Linux,
Mac OS and Windows.
- Tracking bug: [https://crbug.com/550886][crbug.com/550886].
- Build-time flag: `use_allocator_shim`.
**Overview of the unified allocator shim**
The allocator shim consists of three stages:
```
+-------------------------+ +-----------------------+ +----------------+
| malloc & friends | -> | shim layer | -> | Routing to |
| symbols definition | | implementation | | allocator |
+-------------------------+ +-----------------------+ +----------------+
| - libc symbols (malloc, | | - Security checks | | - tcmalloc |
| calloc, free, ...) | | - Chain of dispatchers| | - glibc |
| - C++ symbols (operator | | that can intercept | | - Android |
| new, delete, ...) | | and override | | bionic |
| - glibc weak symbols | | allocations | | - WinHeap |
| (__libc_malloc, ...) | +-----------------------+ +----------------+
+-------------------------+
```
**1. malloc symbols definition**
This stage takes care of overriding the symbols `malloc`, `free`,
`operator new`, `operator delete` and friends and routing those calls inside the
allocator shim (next point).
This is taken care of by the headers in `allocator_shim_override_*`.
*On Linux/CrOS*: the allocator symbols are defined as exported global symbols
in `allocator_shim_override_libc_symbols.h` (for `malloc`, `free` and friends)
and in `allocator_shim_override_cpp_symbols.h` (for `operator new`,
`operator delete` and friends).
This enables proper interposition of malloc symbols referenced by the main
executable and any third party libraries. Symbol resolution on Linux is a breadth first search that starts from the root link unit, that is the executable
(see EXECUTABLE AND LINKABLE FORMAT (ELF) - Portable Formats Specification).
Additionally, when tcmalloc is the default allocator, some extra glibc symbols
are also defined in `allocator_shim_override_glibc_weak_symbols.h`, for subtle
reasons explained in that file.
The Linux/CrOS shim was introduced by
[crrev.com/1675143004](https://crrev.com/1675143004).
*On Android*: load-time symbol interposition (unlike the Linux/CrOS case) is not
possible. This is because Android processes are `fork()`-ed from the Android
zygote, which pre-loads libc.so and only later native code gets loaded via
`dlopen()` (symbols from `dlopen()`-ed libraries get a different resolution
scope).
In this case, the approach instead of wrapping symbol resolution at link time
(i.e. during the build), via the `--Wl,-wrap,malloc` linker flag.
The use of this wrapping flag causes:
- All references to allocator symbols in the Chrome codebase to be rewritten as
references to `__wrap_malloc` and friends. The `__wrap_malloc` symbols are
defined in the `allocator_shim_override_linker_wrapped_symbols.h` and
route allocator calls inside the shim layer.
- The reference to the original `malloc` symbols (which typically is defined by
the system's libc.so) are accessible via the special `__real_malloc` and
friends symbols (which will be relocated, at load time, against `malloc`).
In summary, this approach is transparent to the dynamic loader, which still sees
undefined symbol references to malloc symbols.
These symbols will be resolved against libc.so as usual.
More details in [crrev.com/1719433002](https://crrev.com/1719433002).
**2. Shim layer implementation**
This stage contains the actual shim implementation. This consists of:
- A singly linked list of dispatchers (structs with function pointers to `malloc`-like functions). Dispatchers can be dynamically inserted at runtime
(using the `InsertAllocatorDispatch` API). They can intercept and override
allocator calls.
- The security checks (suicide on malloc-failure via `std::new_handler`, etc).
This happens inside `allocator_shim.cc`
**3. Final allocator routing**
The final element of the aforementioned dispatcher chain is statically defined
at build time and ultimately routes the allocator calls to the actual allocator
(as described in the *Background* section above). This is taken care of by the
headers in `allocator_shim_default_dispatch_to_*` files.
Appendixes
----------
**How does the Windows shim layer replace the malloc symbols?**
The mechanism for hooking LIBCMT in Windows is rather tricky. The core
problem is that by default, the Windows library does not declare malloc and
free as weak symbols. Because of this, they cannot be overridden. To work
around this, we start with the LIBCMT.LIB, and manually remove all allocator
related functions from it using the visual studio library tool. Once removed,
we can now link against the library and provide custom versions of the
allocator related functionality.
See the script `preb_libc.py` in this folder.
Related links
-------------
- [Unified allocator shim doc - Feb 2016][url-allocator-shim]
- [Allocator cleanup doc - Jan 2016][url-allocator-cleanup]
- [Proposal to use PartitionAlloc as default allocator](https://crbug.com/339604)
- [Memory-Infra: Tools to profile memory usage in Chrome](/docs/memory-infra/README.md)
[url-allocator-cleanup]: https://docs.google.com/document/d/1V77Kgp_4tfaaWPEZVxNevoD02wXiatnAv7Ssgr0hmjg/edit?usp=sharing
[url-memory-infra-heap-profiler]: /docs/memory-infra/heap_profiler.md
[url-allocator-shim]: https://docs.google.com/document/d/1yKlO1AO4XjpDad9rjcBOI15EKdAGsuGO_IeZy0g0kxo/edit?usp=sharing

View File

@ -0,0 +1,46 @@
// Copyright 2016 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.
#include "base/allocator/allocator_check.h"
#include "base/allocator/features.h"
#include "build/build_config.h"
#if defined(OS_WIN)
#include "base/allocator/winheap_stubs_win.h"
#endif
#if defined(OS_LINUX)
#include <malloc.h>
#endif
#if defined(OS_MACOSX)
#include "base/allocator/allocator_interception_mac.h"
#endif
namespace base {
namespace allocator {
bool IsAllocatorInitialized() {
#if defined(OS_WIN) && BUILDFLAG(USE_ALLOCATOR_SHIM)
// Set by allocator_shim_override_ucrt_symbols_win.h when the
// shimmed _set_new_mode() is called.
return g_is_win_shim_layer_initialized;
#elif defined(OS_LINUX) && defined(USE_TCMALLOC) && \
!defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
// From third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h.
// TODO(primiano): replace with an include once base can depend on allocator.
#define TC_MALLOPT_IS_OVERRIDDEN_BY_TCMALLOC 0xbeef42
return (mallopt(TC_MALLOPT_IS_OVERRIDDEN_BY_TCMALLOC, 0) ==
TC_MALLOPT_IS_OVERRIDDEN_BY_TCMALLOC);
#elif defined(OS_MACOSX) && !defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
// From allocator_interception_mac.mm.
return base::allocator::g_replaced_default_zone;
#else
return true;
#endif
}
} // namespace allocator
} // namespace base

View File

@ -0,0 +1,18 @@
// Copyright 2016 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.
#ifndef BASE_ALLOCATOR_ALLOCATOR_ALLOCATOR_CHECK_H_
#define BASE_ALLOCATOR_ALLOCATOR_ALLOCATOR_CHECK_H_
#include "base/base_export.h"
namespace base {
namespace allocator {
BASE_EXPORT bool IsAllocatorInitialized();
} // namespace allocator
} // namespace base
#endif // BASE_ALLOCATOR_ALLOCATOR_ALLOCATOR_CHECK_H_

View File

@ -0,0 +1,60 @@
// Copyright (c) 2012 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.
#include "base/allocator/allocator_extension.h"
#include "base/logging.h"
#if defined(USE_TCMALLOC)
#include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
#include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h"
#include "third_party/tcmalloc/chromium/src/gperftools/malloc_hook.h"
#endif
namespace base {
namespace allocator {
void ReleaseFreeMemory() {
#if defined(USE_TCMALLOC)
::MallocExtension::instance()->ReleaseFreeMemory();
#endif
}
bool GetNumericProperty(const char* name, size_t* value) {
#if defined(USE_TCMALLOC)
return ::MallocExtension::instance()->GetNumericProperty(name, value);
#endif
return false;
}
bool IsHeapProfilerRunning() {
#if defined(USE_TCMALLOC)
return ::IsHeapProfilerRunning();
#endif
return false;
}
void SetHooks(AllocHookFunc alloc_hook, FreeHookFunc free_hook) {
// TODO(sque): Use allocator shim layer instead.
#if defined(USE_TCMALLOC)
// Make sure no hooks get overwritten.
auto prev_alloc_hook = MallocHook::SetNewHook(alloc_hook);
if (alloc_hook)
DCHECK(!prev_alloc_hook);
auto prev_free_hook = MallocHook::SetDeleteHook(free_hook);
if (free_hook)
DCHECK(!prev_free_hook);
#endif
}
int GetCallStack(void** stack, int max_stack_size) {
#if defined(USE_TCMALLOC)
return MallocHook::GetCallerStackTrace(stack, max_stack_size, 0);
#endif
return 0;
}
} // namespace allocator
} // namespace base

View File

@ -0,0 +1,51 @@
// Copyright (c) 2012 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.
#ifndef BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H_
#define BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H_
#include <stddef.h> // for size_t
#include "base/base_export.h"
#include "build/build_config.h"
namespace base {
namespace allocator {
// Callback types for alloc and free.
using AllocHookFunc = void (*)(const void*, size_t);
using FreeHookFunc = void (*)(const void*);
// Request that the allocator release any free memory it knows about to the
// system.
BASE_EXPORT void ReleaseFreeMemory();
// Get the named property's |value|. Returns true if the property is known.
// Returns false if the property is not a valid property name for the current
// allocator implementation.
// |name| or |value| cannot be NULL
BASE_EXPORT bool GetNumericProperty(const char* name, size_t* value);
BASE_EXPORT bool IsHeapProfilerRunning();
// Register callbacks for alloc and free. Can only store one callback at a time
// for each of alloc and free.
BASE_EXPORT void SetHooks(AllocHookFunc alloc_hook, FreeHookFunc free_hook);
// Attempts to unwind the call stack from the current location where this
// function is being called from. Must be called from a hook function registered
// by calling SetSingle{Alloc,Free}Hook, directly or indirectly.
//
// Arguments:
// stack: pointer to a pre-allocated array of void*'s.
// max_stack_size: indicates the size of the array in |stack|.
//
// Returns the number of call stack frames stored in |stack|, or 0 if no call
// stack information is available.
BASE_EXPORT int GetCallStack(void** stack, int max_stack_size);
} // namespace allocator
} // namespace base
#endif // BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H_

View File

@ -0,0 +1,56 @@
// 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.
#ifndef BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_
#define BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_
#include <stddef.h>
#include "base/base_export.h"
#include "third_party/apple_apsl/malloc.h"
namespace base {
namespace allocator {
struct MallocZoneFunctions;
// Saves the function pointers currently used by the default zone.
void StoreFunctionsForDefaultZone();
// Same as StoreFunctionsForDefaultZone, but for all malloc zones.
void StoreFunctionsForAllZones();
// For all malloc zones that have been stored, replace their functions with
// |functions|.
void ReplaceFunctionsForStoredZones(const MallocZoneFunctions* functions);
extern bool g_replaced_default_zone;
// Calls the original implementation of malloc/calloc prior to interception.
bool UncheckedMallocMac(size_t size, void** result);
bool UncheckedCallocMac(size_t num_items, size_t size, void** result);
// Intercepts calls to default and purgeable malloc zones. Intercepts Core
// Foundation and Objective-C allocations.
// Has no effect on the default malloc zone if the allocator shim already
// performs that interception.
BASE_EXPORT void InterceptAllocationsMac();
// Updates all malloc zones to use their original functions.
// Also calls ClearAllMallocZonesForTesting.
BASE_EXPORT void UninterceptMallocZonesForTesting();
// Periodically checks for, and shims new malloc zones. Stops checking after 1
// minute.
BASE_EXPORT void PeriodicallyShimNewMallocZones();
// Exposed for testing.
BASE_EXPORT void ShimNewMallocZones();
BASE_EXPORT void ReplaceZoneFunctions(ChromeMallocZone* zone,
const MallocZoneFunctions* functions);
} // namespace allocator
} // namespace base
#endif // BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_

View File

@ -0,0 +1,568 @@
// 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.
// This file contains all the logic necessary to intercept allocations on
// macOS. "malloc zones" are an abstraction that allows the process to intercept
// all malloc-related functions. There is no good mechanism [short of
// interposition] to determine new malloc zones are added, so there's no clean
// mechanism to intercept all malloc zones. This file contains logic to
// intercept the default and purgeable zones, which always exist. A cursory
// review of Chrome seems to imply that non-default zones are almost never used.
//
// This file also contains logic to intercept Core Foundation and Objective-C
// allocations. The implementations forward to the default malloc zone, so the
// only reason to intercept these calls is to re-label OOM crashes with slightly
// more details.
#include "base/allocator/allocator_interception_mac.h"
#include <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
#include <errno.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
#import <objc/runtime.h>
#include <stddef.h>
#include <new>
#include "base/allocator/features.h"
#include "base/allocator/malloc_zone_functions_mac.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/mac/mac_util.h"
#include "base/mac/mach_logging.h"
#include "base/process/memory.h"
#include "base/scoped_clear_errno.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "build/build_config.h"
#include "third_party/apple_apsl/CFBase.h"
namespace base {
namespace allocator {
bool g_replaced_default_zone = false;
namespace {
bool g_oom_killer_enabled;
// Starting with Mac OS X 10.7, the zone allocators set up by the system are
// read-only, to prevent them from being overwritten in an attack. However,
// blindly unprotecting and reprotecting the zone allocators fails with
// GuardMalloc because GuardMalloc sets up its zone allocator using a block of
// memory in its bss. Explicit saving/restoring of the protection is required.
//
// This function takes a pointer to a malloc zone, de-protects it if necessary,
// and returns (in the out parameters) a region of memory (if any) to be
// re-protected when modifications are complete. This approach assumes that
// there is no contention for the protection of this memory.
void DeprotectMallocZone(ChromeMallocZone* default_zone,
mach_vm_address_t* reprotection_start,
mach_vm_size_t* reprotection_length,
vm_prot_t* reprotection_value) {
mach_port_t unused;
*reprotection_start = reinterpret_cast<mach_vm_address_t>(default_zone);
struct vm_region_basic_info_64 info;
mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT_64;
kern_return_t result = mach_vm_region(
mach_task_self(), reprotection_start, reprotection_length,
VM_REGION_BASIC_INFO_64, reinterpret_cast<vm_region_info_t>(&info),
&count, &unused);
MACH_CHECK(result == KERN_SUCCESS, result) << "mach_vm_region";
// The kernel always returns a null object for VM_REGION_BASIC_INFO_64, but
// balance it with a deallocate in case this ever changes. See 10.9.2
// xnu-2422.90.20/osfmk/vm/vm_map.c vm_map_region.
mach_port_deallocate(mach_task_self(), unused);
// Does the region fully enclose the zone pointers? Possibly unwarranted
// simplification used: using the size of a full version 8 malloc zone rather
// than the actual smaller size if the passed-in zone is not version 8.
CHECK(*reprotection_start <=
reinterpret_cast<mach_vm_address_t>(default_zone));
mach_vm_size_t zone_offset =
reinterpret_cast<mach_vm_size_t>(default_zone) -
reinterpret_cast<mach_vm_size_t>(*reprotection_start);
CHECK(zone_offset + sizeof(ChromeMallocZone) <= *reprotection_length);
if (info.protection & VM_PROT_WRITE) {
// No change needed; the zone is already writable.
*reprotection_start = 0;
*reprotection_length = 0;
*reprotection_value = VM_PROT_NONE;
} else {
*reprotection_value = info.protection;
result = mach_vm_protect(mach_task_self(), *reprotection_start,
*reprotection_length, false,
info.protection | VM_PROT_WRITE);
MACH_CHECK(result == KERN_SUCCESS, result) << "mach_vm_protect";
}
}
#if !defined(ADDRESS_SANITIZER)
MallocZoneFunctions g_old_zone;
MallocZoneFunctions g_old_purgeable_zone;
void* oom_killer_malloc(struct _malloc_zone_t* zone, size_t size) {
void* result = g_old_zone.malloc(zone, size);
if (!result && size)
TerminateBecauseOutOfMemory(size);
return result;
}
void* oom_killer_calloc(struct _malloc_zone_t* zone,
size_t num_items,
size_t size) {
void* result = g_old_zone.calloc(zone, num_items, size);
if (!result && num_items && size)
TerminateBecauseOutOfMemory(num_items * size);
return result;
}
void* oom_killer_valloc(struct _malloc_zone_t* zone, size_t size) {
void* result = g_old_zone.valloc(zone, size);
if (!result && size)
TerminateBecauseOutOfMemory(size);
return result;
}
void oom_killer_free(struct _malloc_zone_t* zone, void* ptr) {
g_old_zone.free(zone, ptr);
}
void* oom_killer_realloc(struct _malloc_zone_t* zone, void* ptr, size_t size) {
void* result = g_old_zone.realloc(zone, ptr, size);
if (!result && size)
TerminateBecauseOutOfMemory(size);
return result;
}
void* oom_killer_memalign(struct _malloc_zone_t* zone,
size_t alignment,
size_t size) {
void* result = g_old_zone.memalign(zone, alignment, size);
// Only die if posix_memalign would have returned ENOMEM, since there are
// other reasons why NULL might be returned (see
// http://opensource.apple.com/source/Libc/Libc-583/gen/malloc.c ).
if (!result && size && alignment >= sizeof(void*) &&
(alignment & (alignment - 1)) == 0) {
TerminateBecauseOutOfMemory(size);
}
return result;
}
void* oom_killer_malloc_purgeable(struct _malloc_zone_t* zone, size_t size) {
void* result = g_old_purgeable_zone.malloc(zone, size);
if (!result && size)
TerminateBecauseOutOfMemory(size);
return result;
}
void* oom_killer_calloc_purgeable(struct _malloc_zone_t* zone,
size_t num_items,
size_t size) {
void* result = g_old_purgeable_zone.calloc(zone, num_items, size);
if (!result && num_items && size)
TerminateBecauseOutOfMemory(num_items * size);
return result;
}
void* oom_killer_valloc_purgeable(struct _malloc_zone_t* zone, size_t size) {
void* result = g_old_purgeable_zone.valloc(zone, size);
if (!result && size)
TerminateBecauseOutOfMemory(size);
return result;
}
void oom_killer_free_purgeable(struct _malloc_zone_t* zone, void* ptr) {
g_old_purgeable_zone.free(zone, ptr);
}
void* oom_killer_realloc_purgeable(struct _malloc_zone_t* zone,
void* ptr,
size_t size) {
void* result = g_old_purgeable_zone.realloc(zone, ptr, size);
if (!result && size)
TerminateBecauseOutOfMemory(size);
return result;
}
void* oom_killer_memalign_purgeable(struct _malloc_zone_t* zone,
size_t alignment,
size_t size) {
void* result = g_old_purgeable_zone.memalign(zone, alignment, size);
// Only die if posix_memalign would have returned ENOMEM, since there are
// other reasons why NULL might be returned (see
// http://opensource.apple.com/source/Libc/Libc-583/gen/malloc.c ).
if (!result && size && alignment >= sizeof(void*) &&
(alignment & (alignment - 1)) == 0) {
TerminateBecauseOutOfMemory(size);
}
return result;
}
#endif // !defined(ADDRESS_SANITIZER)
#if !defined(ADDRESS_SANITIZER)
// === Core Foundation CFAllocators ===
bool CanGetContextForCFAllocator() {
return !base::mac::IsOSLaterThan10_13_DontCallThis();
}
CFAllocatorContext* ContextForCFAllocator(CFAllocatorRef allocator) {
ChromeCFAllocatorLions* our_allocator = const_cast<ChromeCFAllocatorLions*>(
reinterpret_cast<const ChromeCFAllocatorLions*>(allocator));
return &our_allocator->_context;
}
CFAllocatorAllocateCallBack g_old_cfallocator_system_default;
CFAllocatorAllocateCallBack g_old_cfallocator_malloc;
CFAllocatorAllocateCallBack g_old_cfallocator_malloc_zone;
void* oom_killer_cfallocator_system_default(CFIndex alloc_size,
CFOptionFlags hint,
void* info) {
void* result = g_old_cfallocator_system_default(alloc_size, hint, info);
if (!result)
TerminateBecauseOutOfMemory(alloc_size);
return result;
}
void* oom_killer_cfallocator_malloc(CFIndex alloc_size,
CFOptionFlags hint,
void* info) {
void* result = g_old_cfallocator_malloc(alloc_size, hint, info);
if (!result)
TerminateBecauseOutOfMemory(alloc_size);
return result;
}
void* oom_killer_cfallocator_malloc_zone(CFIndex alloc_size,
CFOptionFlags hint,
void* info) {
void* result = g_old_cfallocator_malloc_zone(alloc_size, hint, info);
if (!result)
TerminateBecauseOutOfMemory(alloc_size);
return result;
}
#endif // !defined(ADDRESS_SANITIZER)
// === Cocoa NSObject allocation ===
typedef id (*allocWithZone_t)(id, SEL, NSZone*);
allocWithZone_t g_old_allocWithZone;
id oom_killer_allocWithZone(id self, SEL _cmd, NSZone* zone) {
id result = g_old_allocWithZone(self, _cmd, zone);
if (!result)
TerminateBecauseOutOfMemory(0);
return result;
}
void UninterceptMallocZoneForTesting(struct _malloc_zone_t* zone) {
ChromeMallocZone* chrome_zone = reinterpret_cast<ChromeMallocZone*>(zone);
if (!IsMallocZoneAlreadyStored(chrome_zone))
return;
MallocZoneFunctions& functions = GetFunctionsForZone(zone);
ReplaceZoneFunctions(chrome_zone, &functions);
}
} // namespace
bool UncheckedMallocMac(size_t size, void** result) {
#if defined(ADDRESS_SANITIZER)
*result = malloc(size);
#else
if (g_old_zone.malloc) {
*result = g_old_zone.malloc(malloc_default_zone(), size);
} else {
*result = malloc(size);
}
#endif // defined(ADDRESS_SANITIZER)
return *result != NULL;
}
bool UncheckedCallocMac(size_t num_items, size_t size, void** result) {
#if defined(ADDRESS_SANITIZER)
*result = calloc(num_items, size);
#else
if (g_old_zone.calloc) {
*result = g_old_zone.calloc(malloc_default_zone(), num_items, size);
} else {
*result = calloc(num_items, size);
}
#endif // defined(ADDRESS_SANITIZER)
return *result != NULL;
}
void StoreFunctionsForDefaultZone() {
ChromeMallocZone* default_zone = reinterpret_cast<ChromeMallocZone*>(
malloc_default_zone());
StoreMallocZone(default_zone);
}
void StoreFunctionsForAllZones() {
// This ensures that the default zone is always at the front of the array,
// which is important for performance.
StoreFunctionsForDefaultZone();
vm_address_t* zones;
unsigned int count;
kern_return_t kr = malloc_get_all_zones(mach_task_self(), 0, &zones, &count);
if (kr != KERN_SUCCESS)
return;
for (unsigned int i = 0; i < count; ++i) {
ChromeMallocZone* zone = reinterpret_cast<ChromeMallocZone*>(zones[i]);
StoreMallocZone(zone);
}
}
void ReplaceFunctionsForStoredZones(const MallocZoneFunctions* functions) {
// The default zone does not get returned in malloc_get_all_zones().
ChromeMallocZone* default_zone =
reinterpret_cast<ChromeMallocZone*>(malloc_default_zone());
if (DoesMallocZoneNeedReplacing(default_zone, functions)) {
ReplaceZoneFunctions(default_zone, functions);
}
vm_address_t* zones;
unsigned int count;
kern_return_t kr =
malloc_get_all_zones(mach_task_self(), nullptr, &zones, &count);
if (kr != KERN_SUCCESS)
return;
for (unsigned int i = 0; i < count; ++i) {
ChromeMallocZone* zone = reinterpret_cast<ChromeMallocZone*>(zones[i]);
if (DoesMallocZoneNeedReplacing(zone, functions)) {
ReplaceZoneFunctions(zone, functions);
}
}
g_replaced_default_zone = true;
}
void InterceptAllocationsMac() {
if (g_oom_killer_enabled)
return;
g_oom_killer_enabled = true;
// === C malloc/calloc/valloc/realloc/posix_memalign ===
// This approach is not perfect, as requests for amounts of memory larger than
// MALLOC_ABSOLUTE_MAX_SIZE (currently SIZE_T_MAX - (2 * PAGE_SIZE)) will
// still fail with a NULL rather than dying (see
// http://opensource.apple.com/source/Libc/Libc-583/gen/malloc.c for details).
// Unfortunately, it's the best we can do. Also note that this does not affect
// allocations from non-default zones.
#if !defined(ADDRESS_SANITIZER)
// Don't do anything special on OOM for the malloc zones replaced by
// AddressSanitizer, as modifying or protecting them may not work correctly.
ChromeMallocZone* default_zone =
reinterpret_cast<ChromeMallocZone*>(malloc_default_zone());
if (!IsMallocZoneAlreadyStored(default_zone)) {
StoreZoneFunctions(default_zone, &g_old_zone);
MallocZoneFunctions new_functions = {};
new_functions.malloc = oom_killer_malloc;
new_functions.calloc = oom_killer_calloc;
new_functions.valloc = oom_killer_valloc;
new_functions.free = oom_killer_free;
new_functions.realloc = oom_killer_realloc;
new_functions.memalign = oom_killer_memalign;
ReplaceZoneFunctions(default_zone, &new_functions);
g_replaced_default_zone = true;
}
ChromeMallocZone* purgeable_zone =
reinterpret_cast<ChromeMallocZone*>(malloc_default_purgeable_zone());
if (purgeable_zone && !IsMallocZoneAlreadyStored(purgeable_zone)) {
StoreZoneFunctions(purgeable_zone, &g_old_purgeable_zone);
MallocZoneFunctions new_functions = {};
new_functions.malloc = oom_killer_malloc_purgeable;
new_functions.calloc = oom_killer_calloc_purgeable;
new_functions.valloc = oom_killer_valloc_purgeable;
new_functions.free = oom_killer_free_purgeable;
new_functions.realloc = oom_killer_realloc_purgeable;
new_functions.memalign = oom_killer_memalign_purgeable;
ReplaceZoneFunctions(purgeable_zone, &new_functions);
}
#endif
// === C malloc_zone_batch_malloc ===
// batch_malloc is omitted because the default malloc zone's implementation
// only supports batch_malloc for "tiny" allocations from the free list. It
// will fail for allocations larger than "tiny", and will only allocate as
// many blocks as it's able to from the free list. These factors mean that it
// can return less than the requested memory even in a non-out-of-memory
// situation. There's no good way to detect whether a batch_malloc failure is
// due to these other factors, or due to genuine memory or address space
// exhaustion. The fact that it only allocates space from the "tiny" free list
// means that it's likely that a failure will not be due to memory exhaustion.
// Similarly, these constraints on batch_malloc mean that callers must always
// be expecting to receive less memory than was requested, even in situations
// where memory pressure is not a concern. Finally, the only public interface
// to batch_malloc is malloc_zone_batch_malloc, which is specific to the
// system's malloc implementation. It's unlikely that anyone's even heard of
// it.
#ifndef ADDRESS_SANITIZER
// === Core Foundation CFAllocators ===
// This will not catch allocation done by custom allocators, but will catch
// all allocation done by system-provided ones.
CHECK(!g_old_cfallocator_system_default && !g_old_cfallocator_malloc &&
!g_old_cfallocator_malloc_zone)
<< "Old allocators unexpectedly non-null";
bool cf_allocator_internals_known = CanGetContextForCFAllocator();
if (cf_allocator_internals_known) {
CFAllocatorContext* context =
ContextForCFAllocator(kCFAllocatorSystemDefault);
CHECK(context) << "Failed to get context for kCFAllocatorSystemDefault.";
g_old_cfallocator_system_default = context->allocate;
CHECK(g_old_cfallocator_system_default)
<< "Failed to get kCFAllocatorSystemDefault allocation function.";
context->allocate = oom_killer_cfallocator_system_default;
context = ContextForCFAllocator(kCFAllocatorMalloc);
CHECK(context) << "Failed to get context for kCFAllocatorMalloc.";
g_old_cfallocator_malloc = context->allocate;
CHECK(g_old_cfallocator_malloc)
<< "Failed to get kCFAllocatorMalloc allocation function.";
context->allocate = oom_killer_cfallocator_malloc;
context = ContextForCFAllocator(kCFAllocatorMallocZone);
CHECK(context) << "Failed to get context for kCFAllocatorMallocZone.";
g_old_cfallocator_malloc_zone = context->allocate;
CHECK(g_old_cfallocator_malloc_zone)
<< "Failed to get kCFAllocatorMallocZone allocation function.";
context->allocate = oom_killer_cfallocator_malloc_zone;
} else {
DLOG(WARNING) << "Internals of CFAllocator not known; out-of-memory "
"failures via CFAllocator will not result in termination. "
"http://crbug.com/45650";
}
#endif
// === Cocoa NSObject allocation ===
// Note that both +[NSObject new] and +[NSObject alloc] call through to
// +[NSObject allocWithZone:].
CHECK(!g_old_allocWithZone) << "Old allocator unexpectedly non-null";
Class nsobject_class = [NSObject class];
Method orig_method =
class_getClassMethod(nsobject_class, @selector(allocWithZone:));
g_old_allocWithZone =
reinterpret_cast<allocWithZone_t>(method_getImplementation(orig_method));
CHECK(g_old_allocWithZone)
<< "Failed to get allocWithZone allocation function.";
method_setImplementation(orig_method,
reinterpret_cast<IMP>(oom_killer_allocWithZone));
}
void UninterceptMallocZonesForTesting() {
UninterceptMallocZoneForTesting(malloc_default_zone());
vm_address_t* zones;
unsigned int count;
kern_return_t kr = malloc_get_all_zones(mach_task_self(), 0, &zones, &count);
CHECK(kr == KERN_SUCCESS);
for (unsigned int i = 0; i < count; ++i) {
UninterceptMallocZoneForTesting(
reinterpret_cast<struct _malloc_zone_t*>(zones[i]));
}
ClearAllMallocZonesForTesting();
}
namespace {
void ShimNewMallocZonesAndReschedule(base::Time end_time,
base::TimeDelta delay) {
ShimNewMallocZones();
if (base::Time::Now() > end_time)
return;
base::TimeDelta next_delay = delay * 2;
SequencedTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::Bind(&ShimNewMallocZonesAndReschedule, end_time, next_delay),
delay);
}
} // namespace
void PeriodicallyShimNewMallocZones() {
base::Time end_time = base::Time::Now() + base::TimeDelta::FromMinutes(1);
base::TimeDelta initial_delay = base::TimeDelta::FromSeconds(1);
ShimNewMallocZonesAndReschedule(end_time, initial_delay);
}
void ShimNewMallocZones() {
StoreFunctionsForAllZones();
// Use the functions for the default zone as a template to replace those
// new zones.
ChromeMallocZone* default_zone =
reinterpret_cast<ChromeMallocZone*>(malloc_default_zone());
DCHECK(IsMallocZoneAlreadyStored(default_zone));
MallocZoneFunctions new_functions;
StoreZoneFunctions(default_zone, &new_functions);
ReplaceFunctionsForStoredZones(&new_functions);
}
void ReplaceZoneFunctions(ChromeMallocZone* zone,
const MallocZoneFunctions* functions) {
// Remove protection.
mach_vm_address_t reprotection_start = 0;
mach_vm_size_t reprotection_length = 0;
vm_prot_t reprotection_value = VM_PROT_NONE;
DeprotectMallocZone(zone, &reprotection_start, &reprotection_length,
&reprotection_value);
CHECK(functions->malloc && functions->calloc && functions->valloc &&
functions->free && functions->realloc);
zone->malloc = functions->malloc;
zone->calloc = functions->calloc;
zone->valloc = functions->valloc;
zone->free = functions->free;
zone->realloc = functions->realloc;
if (functions->batch_malloc)
zone->batch_malloc = functions->batch_malloc;
if (functions->batch_free)
zone->batch_free = functions->batch_free;
if (functions->size)
zone->size = functions->size;
if (zone->version >= 5 && functions->memalign) {
zone->memalign = functions->memalign;
}
if (zone->version >= 6 && functions->free_definite_size) {
zone->free_definite_size = functions->free_definite_size;
}
// Restore protection if it was active.
if (reprotection_start) {
kern_return_t result =
mach_vm_protect(mach_task_self(), reprotection_start,
reprotection_length, false, reprotection_value);
MACH_CHECK(result == KERN_SUCCESS, result) << "mach_vm_protect";
}
}
} // namespace allocator
} // namespace base

View File

@ -0,0 +1,353 @@
// Copyright 2016 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.
#include "base/allocator/allocator_shim.h"
#include <errno.h>
#include <new>
#include "base/atomicops.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/process/process_metrics.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#if !defined(OS_WIN)
#include <unistd.h>
#else
#include "base/allocator/winheap_stubs_win.h"
#endif
#if defined(OS_MACOSX)
#include <malloc/malloc.h>
#include "base/allocator/allocator_interception_mac.h"
#endif
// No calls to malloc / new in this file. They would would cause re-entrancy of
// the shim, which is hard to deal with. Keep this code as simple as possible
// and don't use any external C++ object here, not even //base ones. Even if
// they are safe to use today, in future they might be refactored.
namespace {
using namespace base;
subtle::AtomicWord g_chain_head = reinterpret_cast<subtle::AtomicWord>(
&allocator::AllocatorDispatch::default_dispatch);
bool g_call_new_handler_on_malloc_failure = false;
#if !defined(OS_WIN)
subtle::Atomic32 g_new_handler_lock = 0;
#endif
inline size_t GetCachedPageSize() {
static size_t pagesize = 0;
if (!pagesize)
pagesize = base::GetPageSize();
return pagesize;
}
// Calls the std::new handler thread-safely. Returns true if a new_handler was
// set and called, false if no new_handler was set.
bool CallNewHandler(size_t size) {
#if defined(OS_WIN)
return base::allocator::WinCallNewHandler(size);
#else
// TODO(primiano): C++11 has introduced std::get_new_handler() which is
// supposed to be thread safe and would avoid the spinlock boilerplate here.
// However, it is not available in the headers in the current Debian Jessie
// sysroot, which has libstdc++ 4.8. The function is available in libstdc++
// 4.9 and newer, but it will be a few more years before a newer sysroot
// becomes available.
std::new_handler nh;
{
while (subtle::Acquire_CompareAndSwap(&g_new_handler_lock, 0, 1))
PlatformThread::YieldCurrentThread();
nh = std::set_new_handler(0);
ignore_result(std::set_new_handler(nh));
subtle::Release_Store(&g_new_handler_lock, 0);
}
if (!nh)
return false;
(*nh)();
// Assume the new_handler will abort if it fails. Exception are disabled and
// we don't support the case of a new_handler throwing std::bad_balloc.
return true;
#endif
}
inline const allocator::AllocatorDispatch* GetChainHead() {
// TODO(primiano): Just use NoBarrier_Load once crbug.com/593344 is fixed.
// Unfortunately due to that bug NoBarrier_Load() is mistakenly fully
// barriered on Linux+Clang, and that causes visible perf regressons.
return reinterpret_cast<const allocator::AllocatorDispatch*>(
#if defined(OS_LINUX) && defined(__clang__)
*static_cast<const volatile subtle::AtomicWord*>(&g_chain_head)
#else
subtle::NoBarrier_Load(&g_chain_head)
#endif
);
}
} // namespace
namespace base {
namespace allocator {
void SetCallNewHandlerOnMallocFailure(bool value) {
g_call_new_handler_on_malloc_failure = value;
}
void* UncheckedAlloc(size_t size) {
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
return chain_head->alloc_function(chain_head, size, nullptr);
}
void InsertAllocatorDispatch(AllocatorDispatch* dispatch) {
// Loop in case of (an unlikely) race on setting the list head.
size_t kMaxRetries = 7;
for (size_t i = 0; i < kMaxRetries; ++i) {
const AllocatorDispatch* chain_head = GetChainHead();
dispatch->next = chain_head;
// This function guarantees to be thread-safe w.r.t. concurrent
// insertions. It also has to guarantee that all the threads always
// see a consistent chain, hence the MemoryBarrier() below.
// InsertAllocatorDispatch() is NOT a fastpath, as opposite to malloc(), so
// we don't really want this to be a release-store with a corresponding
// acquire-load during malloc().
subtle::MemoryBarrier();
subtle::AtomicWord old_value =
reinterpret_cast<subtle::AtomicWord>(chain_head);
// Set the chain head to the new dispatch atomically. If we lose the race,
// the comparison will fail, and the new head of chain will be returned.
if (subtle::NoBarrier_CompareAndSwap(
&g_chain_head, old_value,
reinterpret_cast<subtle::AtomicWord>(dispatch)) == old_value) {
// Success.
return;
}
}
CHECK(false); // Too many retries, this shouldn't happen.
}
void RemoveAllocatorDispatchForTesting(AllocatorDispatch* dispatch) {
DCHECK_EQ(GetChainHead(), dispatch);
subtle::NoBarrier_Store(&g_chain_head,
reinterpret_cast<subtle::AtomicWord>(dispatch->next));
}
} // namespace allocator
} // namespace base
// The Shim* functions below are the entry-points into the shim-layer and
// are supposed to be invoked by the allocator_shim_override_*
// headers to route the malloc / new symbols through the shim layer.
// They are defined as ALWAYS_INLINE in order to remove a level of indirection
// between the system-defined entry points and the shim implementations.
extern "C" {
// The general pattern for allocations is:
// - Try to allocate, if succeded return the pointer.
// - If the allocation failed:
// - Call the std::new_handler if it was a C++ allocation.
// - Call the std::new_handler if it was a malloc() (or calloc() or similar)
// AND SetCallNewHandlerOnMallocFailure(true).
// - If the std::new_handler is NOT set just return nullptr.
// - If the std::new_handler is set:
// - Assume it will abort() if it fails (very likely the new_handler will
// just suicide priting a message).
// - Assume it did succeed if it returns, in which case reattempt the alloc.
ALWAYS_INLINE void* ShimCppNew(size_t size) {
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
void* ptr;
do {
void* context = nullptr;
#if defined(OS_MACOSX)
context = malloc_default_zone();
#endif
ptr = chain_head->alloc_function(chain_head, size, context);
} while (!ptr && CallNewHandler(size));
return ptr;
}
ALWAYS_INLINE void ShimCppDelete(void* address) {
void* context = nullptr;
#if defined(OS_MACOSX)
context = malloc_default_zone();
#endif
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
return chain_head->free_function(chain_head, address, context);
}
ALWAYS_INLINE void* ShimMalloc(size_t size, void* context) {
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
void* ptr;
do {
ptr = chain_head->alloc_function(chain_head, size, context);
} while (!ptr && g_call_new_handler_on_malloc_failure &&
CallNewHandler(size));
return ptr;
}
ALWAYS_INLINE void* ShimCalloc(size_t n, size_t size, void* context) {
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
void* ptr;
do {
ptr = chain_head->alloc_zero_initialized_function(chain_head, n, size,
context);
} while (!ptr && g_call_new_handler_on_malloc_failure &&
CallNewHandler(size));
return ptr;
}
ALWAYS_INLINE void* ShimRealloc(void* address, size_t size, void* context) {
// realloc(size == 0) means free() and might return a nullptr. We should
// not call the std::new_handler in that case, though.
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
void* ptr;
do {
ptr = chain_head->realloc_function(chain_head, address, size, context);
} while (!ptr && size && g_call_new_handler_on_malloc_failure &&
CallNewHandler(size));
return ptr;
}
ALWAYS_INLINE void* ShimMemalign(size_t alignment, size_t size, void* context) {
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
void* ptr;
do {
ptr = chain_head->alloc_aligned_function(chain_head, alignment, size,
context);
} while (!ptr && g_call_new_handler_on_malloc_failure &&
CallNewHandler(size));
return ptr;
}
ALWAYS_INLINE int ShimPosixMemalign(void** res, size_t alignment, size_t size) {
// posix_memalign is supposed to check the arguments. See tc_posix_memalign()
// in tc_malloc.cc.
if (((alignment % sizeof(void*)) != 0) ||
((alignment & (alignment - 1)) != 0) || (alignment == 0)) {
return EINVAL;
}
void* ptr = ShimMemalign(alignment, size, nullptr);
*res = ptr;
return ptr ? 0 : ENOMEM;
}
ALWAYS_INLINE void* ShimValloc(size_t size, void* context) {
return ShimMemalign(GetCachedPageSize(), size, context);
}
ALWAYS_INLINE void* ShimPvalloc(size_t size) {
// pvalloc(0) should allocate one page, according to its man page.
if (size == 0) {
size = GetCachedPageSize();
} else {
size = (size + GetCachedPageSize() - 1) & ~(GetCachedPageSize() - 1);
}
// The third argument is nullptr because pvalloc is glibc only and does not
// exist on OSX/BSD systems.
return ShimMemalign(GetCachedPageSize(), size, nullptr);
}
ALWAYS_INLINE void ShimFree(void* address, void* context) {
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
return chain_head->free_function(chain_head, address, context);
}
ALWAYS_INLINE size_t ShimGetSizeEstimate(const void* address, void* context) {
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
return chain_head->get_size_estimate_function(
chain_head, const_cast<void*>(address), context);
}
ALWAYS_INLINE unsigned ShimBatchMalloc(size_t size,
void** results,
unsigned num_requested,
void* context) {
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
return chain_head->batch_malloc_function(chain_head, size, results,
num_requested, context);
}
ALWAYS_INLINE void ShimBatchFree(void** to_be_freed,
unsigned num_to_be_freed,
void* context) {
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
return chain_head->batch_free_function(chain_head, to_be_freed,
num_to_be_freed, context);
}
ALWAYS_INLINE void ShimFreeDefiniteSize(void* ptr, size_t size, void* context) {
const allocator::AllocatorDispatch* const chain_head = GetChainHead();
return chain_head->free_definite_size_function(chain_head, ptr, size,
context);
}
} // extern "C"
#if !defined(OS_WIN) && !defined(OS_MACOSX)
// Cpp symbols (new / delete) should always be routed through the shim layer
// except on Windows and macOS where the malloc intercept is deep enough that it
// also catches the cpp calls.
#include "base/allocator/allocator_shim_override_cpp_symbols.h"
#endif
#if defined(OS_ANDROID)
// Android does not support symbol interposition. The way malloc symbols are
// intercepted on Android is by using link-time -wrap flags.
#include "base/allocator/allocator_shim_override_linker_wrapped_symbols.h"
#elif defined(OS_WIN)
// On Windows we use plain link-time overriding of the CRT symbols.
#include "base/allocator/allocator_shim_override_ucrt_symbols_win.h"
#elif defined(OS_MACOSX)
#include "base/allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.h"
#include "base/allocator/allocator_shim_override_mac_symbols.h"
#else
#include "base/allocator/allocator_shim_override_libc_symbols.h"
#endif
// In the case of tcmalloc we also want to plumb into the glibc hooks
// to avoid that allocations made in glibc itself (e.g., strdup()) get
// accidentally performed on the glibc heap instead of the tcmalloc one.
#if defined(USE_TCMALLOC)
#include "base/allocator/allocator_shim_override_glibc_weak_symbols.h"
#endif
#if defined(OS_MACOSX)
namespace base {
namespace allocator {
void InitializeAllocatorShim() {
// Prepares the default dispatch. After the intercepted malloc calls have
// traversed the shim this will route them to the default malloc zone.
InitializeDefaultDispatchToMacAllocator();
MallocZoneFunctions functions = MallocZoneFunctionsToReplaceDefault();
// This replaces the default malloc zone, causing calls to malloc & friends
// from the codebase to be routed to ShimMalloc() above.
base::allocator::ReplaceFunctionsForStoredZones(&functions);
}
} // namespace allocator
} // namespace base
#endif
// Cross-checks.
#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
#error The allocator shim should not be compiled when building for memory tools.
#endif
#if (defined(__GNUC__) && defined(__EXCEPTIONS)) || \
(defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS)
#error This code cannot be used when exceptions are turned on.
#endif

View File

@ -0,0 +1,133 @@
// Copyright 2016 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.
#ifndef BASE_ALLOCATOR_ALLOCATOR_SHIM_H_
#define BASE_ALLOCATOR_ALLOCATOR_SHIM_H_
#include <stddef.h>
#include "base/base_export.h"
#include "build/build_config.h"
namespace base {
namespace allocator {
// Allocator Shim API. Allows to to:
// - Configure the behavior of the allocator (what to do on OOM failures).
// - Install new hooks (AllocatorDispatch) in the allocator chain.
// When this shim layer is enabled, the route of an allocation is as-follows:
//
// [allocator_shim_override_*.h] Intercept malloc() / operator new calls:
// The override_* headers define the symbols required to intercept calls to
// malloc() and operator new (if not overridden by specific C++ classes).
//
// [allocator_shim.cc] Routing allocation calls to the shim:
// The headers above route the calls to the internal ShimMalloc(), ShimFree(),
// ShimCppNew() etc. methods defined in allocator_shim.cc.
// These methods will: (1) forward the allocation call to the front of the
// AllocatorDispatch chain. (2) perform security hardenings (e.g., might
// call std::new_handler on OOM failure).
//
// [allocator_shim_default_dispatch_to_*.cc] The AllocatorDispatch chain:
// It is a singly linked list where each element is a struct with function
// pointers (|malloc_function|, |free_function|, etc). Normally the chain
// consists of a single AllocatorDispatch element, herein called
// the "default dispatch", which is statically defined at build time and
// ultimately routes the calls to the actual allocator defined by the build
// config (tcmalloc, glibc, ...).
//
// It is possible to dynamically insert further AllocatorDispatch stages
// to the front of the chain, for debugging / profiling purposes.
//
// All the functions must be thred safe. The shim does not enforce any
// serialization. This is to route to thread-aware allocators (e.g, tcmalloc)
// wihout introducing unnecessary perf hits.
struct AllocatorDispatch {
using AllocFn = void*(const AllocatorDispatch* self,
size_t size,
void* context);
using AllocZeroInitializedFn = void*(const AllocatorDispatch* self,
size_t n,
size_t size,
void* context);
using AllocAlignedFn = void*(const AllocatorDispatch* self,
size_t alignment,
size_t size,
void* context);
using ReallocFn = void*(const AllocatorDispatch* self,
void* address,
size_t size,
void* context);
using FreeFn = void(const AllocatorDispatch* self,
void* address,
void* context);
// Returns the best available estimate for the actual amount of memory
// consumed by the allocation |address|. If possible, this should include
// heap overhead or at least a decent estimate of the full cost of the
// allocation. If no good estimate is possible, returns zero.
using GetSizeEstimateFn = size_t(const AllocatorDispatch* self,
void* address,
void* context);
using BatchMallocFn = unsigned(const AllocatorDispatch* self,
size_t size,
void** results,
unsigned num_requested,
void* context);
using BatchFreeFn = void(const AllocatorDispatch* self,
void** to_be_freed,
unsigned num_to_be_freed,
void* context);
using FreeDefiniteSizeFn = void(const AllocatorDispatch* self,
void* ptr,
size_t size,
void* context);
AllocFn* const alloc_function;
AllocZeroInitializedFn* const alloc_zero_initialized_function;
AllocAlignedFn* const alloc_aligned_function;
ReallocFn* const realloc_function;
FreeFn* const free_function;
GetSizeEstimateFn* const get_size_estimate_function;
BatchMallocFn* const batch_malloc_function;
BatchFreeFn* const batch_free_function;
FreeDefiniteSizeFn* const free_definite_size_function;
const AllocatorDispatch* next;
// |default_dispatch| is statically defined by one (and only one) of the
// allocator_shim_default_dispatch_to_*.cc files, depending on the build
// configuration.
static const AllocatorDispatch default_dispatch;
};
// When true makes malloc behave like new, w.r.t calling the new_handler if
// the allocation fails (see set_new_mode() in Windows).
BASE_EXPORT void SetCallNewHandlerOnMallocFailure(bool value);
// Allocates |size| bytes or returns nullptr. It does NOT call the new_handler,
// regardless of SetCallNewHandlerOnMallocFailure().
BASE_EXPORT void* UncheckedAlloc(size_t size);
// Inserts |dispatch| in front of the allocator chain. This method is
// thread-safe w.r.t concurrent invocations of InsertAllocatorDispatch().
// The callers have responsibility for inserting a single dispatch no more
// than once.
BASE_EXPORT void InsertAllocatorDispatch(AllocatorDispatch* dispatch);
// Test-only. Rationale: (1) lack of use cases; (2) dealing safely with a
// removal of arbitrary elements from a singly linked list would require a lock
// in malloc(), which we really don't want.
BASE_EXPORT void RemoveAllocatorDispatchForTesting(AllocatorDispatch* dispatch);
#if defined(OS_MACOSX)
// On macOS, the allocator shim needs to be turned on during runtime.
BASE_EXPORT void InitializeAllocatorShim();
#endif // defined(OS_MACOSX)
} // namespace allocator
} // namespace base
#endif // BASE_ALLOCATOR_ALLOCATOR_SHIM_H_

View File

@ -0,0 +1,75 @@
// Copyright 2016 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.
#include "base/allocator/allocator_shim.h"
#include <malloc.h>
// This translation unit defines a default dispatch for the allocator shim which
// routes allocations to libc functions.
// The code here is strongly inspired from tcmalloc's libc_override_glibc.h.
extern "C" {
void* __libc_malloc(size_t size);
void* __libc_calloc(size_t n, size_t size);
void* __libc_realloc(void* address, size_t size);
void* __libc_memalign(size_t alignment, size_t size);
void __libc_free(void* ptr);
} // extern "C"
namespace {
using base::allocator::AllocatorDispatch;
void* GlibcMalloc(const AllocatorDispatch*, size_t size, void* context) {
return __libc_malloc(size);
}
void* GlibcCalloc(const AllocatorDispatch*,
size_t n,
size_t size,
void* context) {
return __libc_calloc(n, size);
}
void* GlibcRealloc(const AllocatorDispatch*,
void* address,
size_t size,
void* context) {
return __libc_realloc(address, size);
}
void* GlibcMemalign(const AllocatorDispatch*,
size_t alignment,
size_t size,
void* context) {
return __libc_memalign(alignment, size);
}
void GlibcFree(const AllocatorDispatch*, void* address, void* context) {
__libc_free(address);
}
size_t GlibcGetSizeEstimate(const AllocatorDispatch*,
void* address,
void* context) {
// TODO(siggi, primiano): malloc_usable_size may need redirection in the
// presence of interposing shims that divert allocations.
return malloc_usable_size(address);
}
} // namespace
const AllocatorDispatch AllocatorDispatch::default_dispatch = {
&GlibcMalloc, /* alloc_function */
&GlibcCalloc, /* alloc_zero_initialized_function */
&GlibcMemalign, /* alloc_aligned_function */
&GlibcRealloc, /* realloc_function */
&GlibcFree, /* free_function */
&GlibcGetSizeEstimate, /* get_size_estimate_function */
nullptr, /* batch_malloc_function */
nullptr, /* batch_free_function */
nullptr, /* free_definite_size_function */
nullptr, /* next */
};

View File

@ -0,0 +1,110 @@
// Copyright 2016 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.
#include <malloc.h>
#include "base/allocator/allocator_shim.h"
#include "build/build_config.h"
#if defined(OS_ANDROID) && __ANDROID_API__ < 17
#include <dlfcn.h>
#endif
// This translation unit defines a default dispatch for the allocator shim which
// routes allocations to the original libc functions when using the link-time
// -Wl,-wrap,malloc approach (see README.md).
// The __real_X functions here are special symbols that the linker will relocate
// against the real "X" undefined symbol, so that __real_malloc becomes the
// equivalent of what an undefined malloc symbol reference would have been.
// This is the counterpart of allocator_shim_override_linker_wrapped_symbols.h,
// which routes the __wrap_X functions into the shim.
extern "C" {
void* __real_malloc(size_t);
void* __real_calloc(size_t, size_t);
void* __real_realloc(void*, size_t);
void* __real_memalign(size_t, size_t);
void* __real_free(void*);
} // extern "C"
namespace {
using base::allocator::AllocatorDispatch;
void* RealMalloc(const AllocatorDispatch*, size_t size, void* context) {
return __real_malloc(size);
}
void* RealCalloc(const AllocatorDispatch*,
size_t n,
size_t size,
void* context) {
return __real_calloc(n, size);
}
void* RealRealloc(const AllocatorDispatch*,
void* address,
size_t size,
void* context) {
return __real_realloc(address, size);
}
void* RealMemalign(const AllocatorDispatch*,
size_t alignment,
size_t size,
void* context) {
return __real_memalign(alignment, size);
}
void RealFree(const AllocatorDispatch*, void* address, void* context) {
__real_free(address);
}
#if defined(OS_ANDROID) && __ANDROID_API__ < 17
size_t DummyMallocUsableSize(const void*) { return 0; }
#endif
size_t RealSizeEstimate(const AllocatorDispatch*,
void* address,
void* context) {
#if defined(OS_ANDROID)
#if __ANDROID_API__ < 17
// malloc_usable_size() is available only starting from API 17.
// TODO(dskiba): remove once we start building against 17+.
using MallocUsableSizeFunction = decltype(malloc_usable_size)*;
static MallocUsableSizeFunction usable_size_function = nullptr;
if (!usable_size_function) {
void* function_ptr = dlsym(RTLD_DEFAULT, "malloc_usable_size");
if (function_ptr) {
usable_size_function = reinterpret_cast<MallocUsableSizeFunction>(
function_ptr);
} else {
usable_size_function = &DummyMallocUsableSize;
}
}
return usable_size_function(address);
#else
return malloc_usable_size(address);
#endif
#endif // OS_ANDROID
// TODO(primiano): This should be redirected to malloc_usable_size or
// the like.
return 0;
}
} // namespace
const AllocatorDispatch AllocatorDispatch::default_dispatch = {
&RealMalloc, /* alloc_function */
&RealCalloc, /* alloc_zero_initialized_function */
&RealMemalign, /* alloc_aligned_function */
&RealRealloc, /* realloc_function */
&RealFree, /* free_function */
&RealSizeEstimate, /* get_size_estimate_function */
nullptr, /* batch_malloc_function */
nullptr, /* batch_free_function */
nullptr, /* free_definite_size_function */
nullptr, /* next */
};

View File

@ -0,0 +1,109 @@
// 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.
#include "base/allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.h"
#include <utility>
#include "base/allocator/allocator_interception_mac.h"
#include "base/allocator/allocator_shim.h"
#include "base/allocator/malloc_zone_functions_mac.h"
namespace base {
namespace allocator {
namespace {
void* MallocImpl(const AllocatorDispatch*, size_t size, void* context) {
MallocZoneFunctions& functions = GetFunctionsForZone(context);
return functions.malloc(reinterpret_cast<struct _malloc_zone_t*>(context),
size);
}
void* CallocImpl(const AllocatorDispatch*,
size_t n,
size_t size,
void* context) {
MallocZoneFunctions& functions = GetFunctionsForZone(context);
return functions.calloc(reinterpret_cast<struct _malloc_zone_t*>(context), n,
size);
}
void* MemalignImpl(const AllocatorDispatch*,
size_t alignment,
size_t size,
void* context) {
MallocZoneFunctions& functions = GetFunctionsForZone(context);
return functions.memalign(reinterpret_cast<struct _malloc_zone_t*>(context),
alignment, size);
}
void* ReallocImpl(const AllocatorDispatch*,
void* ptr,
size_t size,
void* context) {
MallocZoneFunctions& functions = GetFunctionsForZone(context);
return functions.realloc(reinterpret_cast<struct _malloc_zone_t*>(context),
ptr, size);
}
void FreeImpl(const AllocatorDispatch*, void* ptr, void* context) {
MallocZoneFunctions& functions = GetFunctionsForZone(context);
functions.free(reinterpret_cast<struct _malloc_zone_t*>(context), ptr);
}
size_t GetSizeEstimateImpl(const AllocatorDispatch*, void* ptr, void* context) {
MallocZoneFunctions& functions = GetFunctionsForZone(context);
return functions.size(reinterpret_cast<struct _malloc_zone_t*>(context), ptr);
}
unsigned BatchMallocImpl(const AllocatorDispatch* self,
size_t size,
void** results,
unsigned num_requested,
void* context) {
MallocZoneFunctions& functions = GetFunctionsForZone(context);
return functions.batch_malloc(
reinterpret_cast<struct _malloc_zone_t*>(context), size, results,
num_requested);
}
void BatchFreeImpl(const AllocatorDispatch* self,
void** to_be_freed,
unsigned num_to_be_freed,
void* context) {
MallocZoneFunctions& functions = GetFunctionsForZone(context);
functions.batch_free(reinterpret_cast<struct _malloc_zone_t*>(context),
to_be_freed, num_to_be_freed);
}
void FreeDefiniteSizeImpl(const AllocatorDispatch* self,
void* ptr,
size_t size,
void* context) {
MallocZoneFunctions& functions = GetFunctionsForZone(context);
functions.free_definite_size(
reinterpret_cast<struct _malloc_zone_t*>(context), ptr, size);
}
} // namespace
void InitializeDefaultDispatchToMacAllocator() {
StoreFunctionsForAllZones();
}
const AllocatorDispatch AllocatorDispatch::default_dispatch = {
&MallocImpl, /* alloc_function */
&CallocImpl, /* alloc_zero_initialized_function */
&MemalignImpl, /* alloc_aligned_function */
&ReallocImpl, /* realloc_function */
&FreeImpl, /* free_function */
&GetSizeEstimateImpl, /* get_size_estimate_function */
&BatchMallocImpl, /* batch_malloc_function */
&BatchFreeImpl, /* batch_free_function */
&FreeDefiniteSizeImpl, /* free_definite_size_function */
nullptr, /* next */
};
} // namespace allocator
} // namespace base

View File

@ -0,0 +1,19 @@
// 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.
#ifndef BASE_ALLOCATOR_ALLOCATOR_SHIM_DEFAULT_DISPATCH_TO_ZONED_MALLOC_H_
#define BASE_ALLOCATOR_ALLOCATOR_SHIM_DEFAULT_DISPATCH_TO_ZONED_MALLOC_H_
namespace base {
namespace allocator {
// This initializes AllocatorDispatch::default_dispatch by saving pointers to
// the functions in the current default malloc zone. This must be called before
// the default malloc zone is changed to have its intended effect.
void InitializeDefaultDispatchToMacAllocator();
} // namespace allocator
} // namespace base
#endif // BASE_ALLOCATOR_ALLOCATOR_SHIM_DEFAULT_DISPATCH_TO_ZONED_MALLOC_H_

View File

@ -0,0 +1,92 @@
// Copyright 2016 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.
#include "base/allocator/allocator_shim.h"
#include "base/allocator/allocator_shim_internals.h"
#include "third_party/tcmalloc/chromium/src/config.h"
#include "third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h"
namespace {
using base::allocator::AllocatorDispatch;
void* TCMalloc(const AllocatorDispatch*, size_t size, void* context) {
return tc_malloc(size);
}
void* TCCalloc(const AllocatorDispatch*, size_t n, size_t size, void* context) {
return tc_calloc(n, size);
}
void* TCMemalign(const AllocatorDispatch*,
size_t alignment,
size_t size,
void* context) {
return tc_memalign(alignment, size);
}
void* TCRealloc(const AllocatorDispatch*,
void* address,
size_t size,
void* context) {
return tc_realloc(address, size);
}
void TCFree(const AllocatorDispatch*, void* address, void* context) {
tc_free(address);
}
size_t TCGetSizeEstimate(const AllocatorDispatch*,
void* address,
void* context) {
return tc_malloc_size(address);
}
} // namespace
const AllocatorDispatch AllocatorDispatch::default_dispatch = {
&TCMalloc, /* alloc_function */
&TCCalloc, /* alloc_zero_initialized_function */
&TCMemalign, /* alloc_aligned_function */
&TCRealloc, /* realloc_function */
&TCFree, /* free_function */
&TCGetSizeEstimate, /* get_size_estimate_function */
nullptr, /* batch_malloc_function */
nullptr, /* batch_free_function */
nullptr, /* free_definite_size_function */
nullptr, /* next */
};
// In the case of tcmalloc we have also to route the diagnostic symbols,
// which are not part of the unified shim layer, to tcmalloc for consistency.
extern "C" {
SHIM_ALWAYS_EXPORT void malloc_stats(void) __THROW {
return tc_malloc_stats();
}
SHIM_ALWAYS_EXPORT int mallopt(int cmd, int value) __THROW {
return tc_mallopt(cmd, value);
}
#ifdef HAVE_STRUCT_MALLINFO
SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
return tc_mallinfo();
}
#endif
SHIM_ALWAYS_EXPORT size_t malloc_size(void* address) __THROW {
return tc_malloc_size(address);
}
#if defined(__ANDROID__)
SHIM_ALWAYS_EXPORT size_t malloc_usable_size(const void* address) __THROW {
#else
SHIM_ALWAYS_EXPORT size_t malloc_usable_size(void* address) __THROW {
#endif
return tc_malloc_size(address);
}
} // extern "C"

View File

@ -0,0 +1,79 @@
// Copyright 2016 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.
#include "base/allocator/allocator_shim.h"
#include "base/allocator/winheap_stubs_win.h"
#include "base/logging.h"
namespace {
using base::allocator::AllocatorDispatch;
void* DefaultWinHeapMallocImpl(const AllocatorDispatch*,
size_t size,
void* context) {
return base::allocator::WinHeapMalloc(size);
}
void* DefaultWinHeapCallocImpl(const AllocatorDispatch* self,
size_t n,
size_t elem_size,
void* context) {
// Overflow check.
const size_t size = n * elem_size;
if (elem_size != 0 && size / elem_size != n)
return nullptr;
void* result = DefaultWinHeapMallocImpl(self, size, context);
if (result) {
memset(result, 0, size);
}
return result;
}
void* DefaultWinHeapMemalignImpl(const AllocatorDispatch* self,
size_t alignment,
size_t size,
void* context) {
CHECK(false) << "The windows heap does not support memalign.";
return nullptr;
}
void* DefaultWinHeapReallocImpl(const AllocatorDispatch* self,
void* address,
size_t size,
void* context) {
return base::allocator::WinHeapRealloc(address, size);
}
void DefaultWinHeapFreeImpl(const AllocatorDispatch*,
void* address,
void* context) {
base::allocator::WinHeapFree(address);
}
size_t DefaultWinHeapGetSizeEstimateImpl(const AllocatorDispatch*,
void* address,
void* context) {
return base::allocator::WinHeapGetSizeEstimate(address);
}
} // namespace
// Guarantee that default_dispatch is compile-time initialized to avoid using
// it before initialization (allocations before main in release builds with
// optimizations disabled).
constexpr AllocatorDispatch AllocatorDispatch::default_dispatch = {
&DefaultWinHeapMallocImpl,
&DefaultWinHeapCallocImpl,
&DefaultWinHeapMemalignImpl,
&DefaultWinHeapReallocImpl,
&DefaultWinHeapFreeImpl,
&DefaultWinHeapGetSizeEstimateImpl,
nullptr, /* batch_malloc_function */
nullptr, /* batch_free_function */
nullptr, /* free_definite_size_function */
nullptr, /* next */
};

View File

@ -0,0 +1,44 @@
// Copyright 2016 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.
#ifndef BASE_ALLOCATOR_ALLOCATOR_SHIM_INTERNALS_H_
#define BASE_ALLOCATOR_ALLOCATOR_SHIM_INTERNALS_H_
#if defined(__GNUC__)
#include <sys/cdefs.h> // for __THROW
#ifndef __THROW // Not a glibc system
#ifdef _NOEXCEPT // LLVM libc++ uses noexcept instead
#define __THROW _NOEXCEPT
#else
#define __THROW
#endif // !_NOEXCEPT
#endif
// Shim layer symbols need to be ALWAYS exported, regardless of component build.
//
// If an exported symbol is linked into a DSO, it may be preempted by a
// definition in the main executable. If this happens to an allocator symbol, it
// will mean that the DSO will use the main executable's allocator. This is
// normally relatively harmless -- regular allocations should all use the same
// allocator, but if the DSO tries to hook the allocator it will not see any
// allocations.
//
// However, if LLVM LTO is enabled, the compiler may inline the shim layer
// symbols into callers. The end result is that allocator calls in DSOs may use
// either the main executable's allocator or the DSO's allocator, depending on
// whether the call was inlined. This is arguably a bug in LLVM caused by its
// somewhat irregular handling of symbol interposition (see llvm.org/PR23501).
// To work around the bug we use noinline to prevent the symbols from being
// inlined.
//
// In the long run we probably want to avoid linking the allocator bits into
// DSOs altogether. This will save a little space and stop giving DSOs the false
// impression that they can hook the allocator.
#define SHIM_ALWAYS_EXPORT __attribute__((visibility("default"), noinline))
#endif // __GNUC__
#endif // BASE_ALLOCATOR_ALLOCATOR_SHIM_INTERNALS_H_

View File

@ -0,0 +1,51 @@
// Copyright 2016 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.
#ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_CPP_SYMBOLS_H_
#error This header is meant to be included only once by allocator_shim.cc
#endif
#define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_CPP_SYMBOLS_H_
// Preempt the default new/delete C++ symbols so they call the shim entry
// points. This file is strongly inspired by tcmalloc's
// libc_override_redefine.h.
#include <new>
#include "base/allocator/allocator_shim_internals.h"
SHIM_ALWAYS_EXPORT void* operator new(size_t size) {
return ShimCppNew(size);
}
SHIM_ALWAYS_EXPORT void operator delete(void* p) __THROW {
ShimCppDelete(p);
}
SHIM_ALWAYS_EXPORT void* operator new[](size_t size) {
return ShimCppNew(size);
}
SHIM_ALWAYS_EXPORT void operator delete[](void* p) __THROW {
ShimCppDelete(p);
}
SHIM_ALWAYS_EXPORT void* operator new(size_t size,
const std::nothrow_t&) __THROW {
return ShimCppNew(size);
}
SHIM_ALWAYS_EXPORT void* operator new[](size_t size,
const std::nothrow_t&) __THROW {
return ShimCppNew(size);
}
SHIM_ALWAYS_EXPORT void operator delete(void* p, const std::nothrow_t&) __THROW {
ShimCppDelete(p);
}
SHIM_ALWAYS_EXPORT void operator delete[](void* p,
const std::nothrow_t&) __THROW {
ShimCppDelete(p);
}

View File

@ -0,0 +1,119 @@
// Copyright 2016 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.
#ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_
#error This header is meant to be included only once by allocator_shim.cc
#endif
#define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_
// Alias the internal Glibc symbols to the shim entry points.
// This file is strongly inspired by tcmalloc's libc_override_glibc.h.
// Effectively this file does two things:
// 1) Re-define the __malloc_hook & co symbols. Those symbols are defined as
// weak in glibc and are meant to be defined strongly by client processes
// to hook calls initiated from within glibc.
// 2) Re-define Glibc-specific symbols (__libc_malloc). The historical reason
// is that in the past (in RedHat 9) we had instances of libraries that were
// allocating via malloc() and freeing using __libc_free().
// See tcmalloc's libc_override_glibc.h for more context.
#include <features.h> // for __GLIBC__
#include <malloc.h>
#include <unistd.h>
#include <new>
#include "base/allocator/allocator_shim_internals.h"
// __MALLOC_HOOK_VOLATILE not defined in all Glibc headers.
#if !defined(__MALLOC_HOOK_VOLATILE)
#define MALLOC_HOOK_MAYBE_VOLATILE /**/
#else
#define MALLOC_HOOK_MAYBE_VOLATILE __MALLOC_HOOK_VOLATILE
#endif
extern "C" {
// 1) Re-define malloc_hook weak symbols.
namespace {
void* GlibcMallocHook(size_t size, const void* caller) {
return ShimMalloc(size, nullptr);
}
void* GlibcReallocHook(void* ptr, size_t size, const void* caller) {
return ShimRealloc(ptr, size, nullptr);
}
void GlibcFreeHook(void* ptr, const void* caller) {
return ShimFree(ptr, nullptr);
}
void* GlibcMemalignHook(size_t align, size_t size, const void* caller) {
return ShimMemalign(align, size, nullptr);
}
} // namespace
__attribute__((visibility("default"))) void* (
*MALLOC_HOOK_MAYBE_VOLATILE __malloc_hook)(size_t,
const void*) = &GlibcMallocHook;
__attribute__((visibility("default"))) void* (
*MALLOC_HOOK_MAYBE_VOLATILE __realloc_hook)(void*, size_t, const void*) =
&GlibcReallocHook;
__attribute__((visibility("default"))) void (
*MALLOC_HOOK_MAYBE_VOLATILE __free_hook)(void*,
const void*) = &GlibcFreeHook;
__attribute__((visibility("default"))) void* (
*MALLOC_HOOK_MAYBE_VOLATILE __memalign_hook)(size_t, size_t, const void*) =
&GlibcMemalignHook;
// 2) Redefine libc symbols themselves.
SHIM_ALWAYS_EXPORT void* __libc_malloc(size_t size) {
return ShimMalloc(size, nullptr);
}
SHIM_ALWAYS_EXPORT void __libc_free(void* ptr) {
ShimFree(ptr, nullptr);
}
SHIM_ALWAYS_EXPORT void* __libc_realloc(void* ptr, size_t size) {
return ShimRealloc(ptr, size, nullptr);
}
SHIM_ALWAYS_EXPORT void* __libc_calloc(size_t n, size_t size) {
return ShimCalloc(n, size, nullptr);
}
SHIM_ALWAYS_EXPORT void __libc_cfree(void* ptr) {
return ShimFree(ptr, nullptr);
}
SHIM_ALWAYS_EXPORT void* __libc_memalign(size_t align, size_t s) {
return ShimMemalign(align, s, nullptr);
}
SHIM_ALWAYS_EXPORT void* __libc_valloc(size_t size) {
return ShimValloc(size, nullptr);
}
SHIM_ALWAYS_EXPORT void* __libc_pvalloc(size_t size) {
return ShimPvalloc(size);
}
SHIM_ALWAYS_EXPORT int __posix_memalign(void** r, size_t a, size_t s) {
return ShimPosixMemalign(r, a, s);
}
} // extern "C"
// Safety check.
#if !defined(__GLIBC__)
#error The target platform does not seem to use Glibc. Disable the allocator \
shim by setting use_allocator_shim=false in GN args.
#endif

View File

@ -0,0 +1,63 @@
// Copyright 2016 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.
// Its purpose is to preempt the Libc symbols for malloc/new so they call the
// shim layer entry points.
#ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_LIBC_SYMBOLS_H_
#error This header is meant to be included only once by allocator_shim.cc
#endif
#define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_LIBC_SYMBOLS_H_
#include <malloc.h>
#include "base/allocator/allocator_shim_internals.h"
extern "C" {
SHIM_ALWAYS_EXPORT void* malloc(size_t size) __THROW {
return ShimMalloc(size, nullptr);
}
SHIM_ALWAYS_EXPORT void free(void* ptr) __THROW {
ShimFree(ptr, nullptr);
}
SHIM_ALWAYS_EXPORT void* realloc(void* ptr, size_t size) __THROW {
return ShimRealloc(ptr, size, nullptr);
}
SHIM_ALWAYS_EXPORT void* calloc(size_t n, size_t size) __THROW {
return ShimCalloc(n, size, nullptr);
}
SHIM_ALWAYS_EXPORT void cfree(void* ptr) __THROW {
ShimFree(ptr, nullptr);
}
SHIM_ALWAYS_EXPORT void* memalign(size_t align, size_t s) __THROW {
return ShimMemalign(align, s, nullptr);
}
SHIM_ALWAYS_EXPORT void* valloc(size_t size) __THROW {
return ShimValloc(size, nullptr);
}
SHIM_ALWAYS_EXPORT void* pvalloc(size_t size) __THROW {
return ShimPvalloc(size);
}
SHIM_ALWAYS_EXPORT int posix_memalign(void** r, size_t a, size_t s) __THROW {
return ShimPosixMemalign(r, a, s);
}
// The default dispatch translation unit has to define also the following
// symbols (unless they are ultimately routed to the system symbols):
// void malloc_stats(void);
// int mallopt(int, int);
// struct mallinfo mallinfo(void);
// size_t malloc_size(void*);
// size_t malloc_usable_size(const void*);
} // extern "C"

View File

@ -0,0 +1,54 @@
// Copyright 2016 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.
#ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_LINKER_WRAPPED_SYMBOLS_H_
#error This header is meant to be included only once by allocator_shim.cc
#endif
#define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_LINKER_WRAPPED_SYMBOLS_H_
// This header overrides the __wrap_X symbols when using the link-time
// -Wl,-wrap,malloc shim-layer approach (see README.md).
// All references to malloc, free, etc. within the linker unit that gets the
// -wrap linker flags (e.g., libchrome.so) will be rewritten to the
// linker as references to __wrap_malloc, __wrap_free, which are defined here.
#include "base/allocator/allocator_shim_internals.h"
extern "C" {
SHIM_ALWAYS_EXPORT void* __wrap_calloc(size_t n, size_t size) {
return ShimCalloc(n, size, nullptr);
}
SHIM_ALWAYS_EXPORT void __wrap_free(void* ptr) {
ShimFree(ptr, nullptr);
}
SHIM_ALWAYS_EXPORT void* __wrap_malloc(size_t size) {
return ShimMalloc(size, nullptr);
}
SHIM_ALWAYS_EXPORT void* __wrap_memalign(size_t align, size_t size) {
return ShimMemalign(align, size, nullptr);
}
SHIM_ALWAYS_EXPORT int __wrap_posix_memalign(void** res,
size_t align,
size_t size) {
return ShimPosixMemalign(res, align, size);
}
SHIM_ALWAYS_EXPORT void* __wrap_pvalloc(size_t size) {
return ShimPvalloc(size);
}
SHIM_ALWAYS_EXPORT void* __wrap_realloc(void* address, size_t size) {
return ShimRealloc(address, size, nullptr);
}
SHIM_ALWAYS_EXPORT void* __wrap_valloc(size_t size) {
return ShimValloc(size, nullptr);
}
} // extern "C"

View File

@ -0,0 +1,60 @@
// 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.
#ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_MAC_SYMBOLS_H_
#error This header is meant to be included only once by allocator_shim.cc
#endif
#define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_MAC_SYMBOLS_H_
#include "base/allocator/malloc_zone_functions_mac.h"
#include "third_party/apple_apsl/malloc.h"
namespace base {
namespace allocator {
MallocZoneFunctions MallocZoneFunctionsToReplaceDefault() {
MallocZoneFunctions new_functions;
memset(&new_functions, 0, sizeof(MallocZoneFunctions));
new_functions.size = [](malloc_zone_t* zone, const void* ptr) -> size_t {
return ShimGetSizeEstimate(ptr, zone);
};
new_functions.malloc = [](malloc_zone_t* zone, size_t size) -> void* {
return ShimMalloc(size, zone);
};
new_functions.calloc = [](malloc_zone_t* zone, size_t n,
size_t size) -> void* {
return ShimCalloc(n, size, zone);
};
new_functions.valloc = [](malloc_zone_t* zone, size_t size) -> void* {
return ShimValloc(size, zone);
};
new_functions.free = [](malloc_zone_t* zone, void* ptr) {
ShimFree(ptr, zone);
};
new_functions.realloc = [](malloc_zone_t* zone, void* ptr,
size_t size) -> void* {
return ShimRealloc(ptr, size, zone);
};
new_functions.batch_malloc = [](struct _malloc_zone_t* zone, size_t size,
void** results,
unsigned num_requested) -> unsigned {
return ShimBatchMalloc(size, results, num_requested, zone);
};
new_functions.batch_free = [](struct _malloc_zone_t* zone, void** to_be_freed,
unsigned num_to_be_freed) -> void {
ShimBatchFree(to_be_freed, num_to_be_freed, zone);
};
new_functions.memalign = [](malloc_zone_t* zone, size_t alignment,
size_t size) -> void* {
return ShimMemalign(alignment, size, zone);
};
new_functions.free_definite_size = [](malloc_zone_t* zone, void* ptr,
size_t size) {
ShimFreeDefiniteSize(ptr, size, zone);
};
return new_functions;
}
} // namespace allocator
} // namespace base

Some files were not shown because too many files have changed in this diff Show More