summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryoz <yoz@chromium.org>2014-08-26 20:32:58 -0700
committerCommit bot <commit-bot@chromium.org>2014-08-27 03:33:52 +0000
commit774dcda2d369584b2e964fa4971dda71cf819677 (patch)
treef9e3058e383cb5bf00f263a03c48e44620b3bafd
parent3f7aec31073c730a68ee221bbd10dca9a60e9a04 (diff)
downloadchromium_src-774dcda2d369584b2e964fa4971dda71cf819677.zip
chromium_src-774dcda2d369584b2e964fa4971dda71cf819677.tar.gz
chromium_src-774dcda2d369584b2e964fa4971dda71cf819677.tar.bz2
Reland 596ff54335b2a1b393af10657bc4945114f3beed - Split API bundle generation steps
* Fixed in this version: dependencies for *_api_registration on *_api. Split bundle generation steps so that API registration is generated in browser, not common. We now have schema generation, schema bundle generation, and schema bundle registration generation; the last of these is generated in a separate build target and output to browser rather than common. Fix a couple of dangling gyp issues also. BUG=405226 TBR=scottmg@chromium.org,sky@chromium.org Review URL: https://codereview.chromium.org/513633002 Cr-Commit-Position: refs/heads/master@{#292090}
-rw-r--r--build/json_schema_bundle_compile.gypi40
-rw-r--r--build/json_schema_bundle_registration_compile.gypi78
-rw-r--r--build/json_schema_compile.gypi5
-rw-r--r--chrome/browser/BUILD.gn3
-rw-r--r--chrome/browser/devtools/BUILD.gn1
-rw-r--r--chrome/browser/extensions/BUILD.gn2
-rw-r--r--chrome/browser/extensions/api/api_registration.gyp41
-rw-r--r--chrome/browser/extensions/chrome_extensions_browser_client.cc4
-rw-r--r--chrome/browser/performance_monitor/BUILD.gn1
-rw-r--r--chrome/browser/ui/BUILD.gn3
-rw-r--r--chrome/chrome_browser.gypi1
-rw-r--r--chrome/chrome_browser_chromeos.gypi2
-rw-r--r--chrome/chrome_browser_extensions.gypi3
-rw-r--r--chrome/chrome_browser_ui.gypi1
-rw-r--r--chrome/common/extensions/api/BUILD.gn44
-rw-r--r--chrome/common/extensions/api/api.gyp211
-rw-r--r--chrome/common/extensions/api/schemas.gni34
-rw-r--r--chrome/common/extensions/api/schemas.gypi194
-rw-r--r--content/app/content_main_runner.cc9
-rw-r--r--extensions/BUILD.gn3
-rw-r--r--extensions/browser/BUILD.gn1
-rw-r--r--extensions/browser/api/api_registration.gyp30
-rw-r--r--extensions/common/api/BUILD.gn30
-rw-r--r--extensions/common/api/api.gyp49
-rw-r--r--extensions/common/api/schemas.gni17
-rw-r--r--extensions/common/api/schemas.gypi51
-rw-r--r--extensions/extensions.gyp2
-rw-r--r--extensions/generated_extensions_api.gni132
-rw-r--r--extensions/shell/app_shell.gyp2
-rw-r--r--extensions/shell/browser/api/api_registration.gyp22
-rw-r--r--extensions/shell/browser/shell_extensions_browser_client.cc4
-rw-r--r--extensions/shell/common/api/api.gyp19
-rw-r--r--extensions/shell/common/api/schemas.gypi20
-rwxr-xr-xtools/json_schema_compiler/compiler.py39
-rw-r--r--tools/json_schema_compiler/cpp_bundle_generator.py5
-rw-r--r--ui/accessibility/BUILD.gn3
-rw-r--r--ui/accessibility/accessibility.gyp1
37 files changed, 681 insertions, 426 deletions
diff --git a/build/json_schema_bundle_compile.gypi b/build/json_schema_bundle_compile.gypi
index 7e712d7..7560bdc 100644
--- a/build/json_schema_bundle_compile.gypi
+++ b/build/json_schema_bundle_compile.gypi
@@ -19,30 +19,29 @@
# chrome/browser/extensions/api and can be overridden by setting "impl_dir".
'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler',
'api_gen': '<(api_gen_dir)/compiler.py',
- 'impl_dir%': 'chrome/browser/extensions/api',
+ 'generator_files': [
+ '<(api_gen_dir)/cc_generator.py',
+ '<(api_gen_dir)/code.py',
+ '<(api_gen_dir)/compiler.py',
+ '<(api_gen_dir)/cpp_bundle_generator.py',
+ '<(api_gen_dir)/cpp_type_generator.py',
+ '<(api_gen_dir)/cpp_util.py',
+ '<(api_gen_dir)/h_generator.py',
+ '<(api_gen_dir)/idl_schema.py',
+ '<(api_gen_dir)/json_schema.py',
+ '<(api_gen_dir)/model.py',
+ '<(api_gen_dir)/util_cc_helper.py',
+ ],
},
'actions': [
{
- # GN version: //extensions/generated_extensions_api.gni
- 'action_name': 'genapi_bundle',
+ 'action_name': 'genapi_bundle_schema',
'inputs': [
- '<(api_gen_dir)/cc_generator.py',
- '<(api_gen_dir)/code.py',
- '<(api_gen_dir)/compiler.py',
- '<(api_gen_dir)/cpp_bundle_generator.py',
- '<(api_gen_dir)/cpp_type_generator.py',
- '<(api_gen_dir)/cpp_util.py',
- '<(api_gen_dir)/h_generator.py',
- '<(api_gen_dir)/idl_schema.py',
- '<(api_gen_dir)/json_schema.py',
- '<(api_gen_dir)/model.py',
- '<(api_gen_dir)/util_cc_helper.py',
+ '<@(generator_files)',
'<@(schema_files)',
'<@(non_compiled_schema_files)',
],
'outputs': [
- '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/generated_api.h',
- '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/generated_api.cc',
'<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/generated_schemas.h',
'<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/generated_schemas.cc',
],
@@ -52,14 +51,15 @@
'--root=<(DEPTH)',
'--destdir=<(SHARED_INTERMEDIATE_DIR)',
'--namespace=<(root_namespace)',
- '--generator=cpp-bundle',
- '--impl-dir=<(impl_dir)',
+ '--generator=cpp-bundle-schema',
'<@(schema_files)',
'<@(non_compiled_schema_files)',
],
- 'message': 'Generating C++ API bundle code',
+ 'message': 'Generating C++ API bundle code for schemas',
'process_outputs_as_sources': 1,
- }
+ # Avoid running MIDL compiler on IDL input files.
+ 'explicit_idl_action': 1,
+ },
],
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)',
diff --git a/build/json_schema_bundle_registration_compile.gypi b/build/json_schema_bundle_registration_compile.gypi
new file mode 100644
index 0000000..5a013bc
--- /dev/null
+++ b/build/json_schema_bundle_registration_compile.gypi
@@ -0,0 +1,78 @@
+# 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.
+
+{
+ 'variables': {
+ # When including this gypi, the following variables must be set:
+ # schema_files:
+ # An array of json or idl files that comprise the api model.
+ # impl_dir_:
+ # The root path of API implementations; also used for the
+ # output location. (N.B. Named as such to prevent gyp from
+ # expanding it as a relative path.)
+ # root_namespace:
+ # A Python string substituion pattern used to generate the C++
+ # namespace for each API. Use %(namespace)s to replace with the API
+ # namespace, like "toplevel::%(namespace)s_api".
+ #
+ # Functions and namespaces can be excluded by setting "nocompile" to true.
+ 'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler',
+ 'api_gen': '<(api_gen_dir)/compiler.py',
+ 'generator_files': [
+ '<(api_gen_dir)/cc_generator.py',
+ '<(api_gen_dir)/code.py',
+ '<(api_gen_dir)/compiler.py',
+ '<(api_gen_dir)/cpp_bundle_generator.py',
+ '<(api_gen_dir)/cpp_type_generator.py',
+ '<(api_gen_dir)/cpp_util.py',
+ '<(api_gen_dir)/h_generator.py',
+ '<(api_gen_dir)/idl_schema.py',
+ '<(api_gen_dir)/json_schema.py',
+ '<(api_gen_dir)/model.py',
+ '<(api_gen_dir)/util_cc_helper.py',
+ ],
+ },
+ 'actions': [
+ {
+ # GN version: //extensions/generated_extensions_api.gni
+ 'action_name': 'genapi_bundle_registration',
+ 'inputs': [
+ '<@(generator_files)',
+ '<@(schema_files)',
+ '<@(non_compiled_schema_files)',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/<(impl_dir_)/generated_api_registration.h',
+ '<(SHARED_INTERMEDIATE_DIR)/<(impl_dir_)/generated_api_registration.cc',
+ ],
+ 'action': [
+ 'python',
+ '<(api_gen)',
+ '--root=<(DEPTH)',
+ '--destdir=<(SHARED_INTERMEDIATE_DIR)',
+ '--namespace=<(root_namespace)',
+ '--generator=cpp-bundle-registration',
+ '--impl-dir=<(impl_dir_)',
+ '<@(schema_files)',
+ '<@(non_compiled_schema_files)',
+ ],
+ 'message': 'Generating C++ API bundle code for function registration',
+ 'process_outputs_as_sources': 1,
+ # Avoid running MIDL compiler on IDL input files.
+ 'explicit_idl_action': 1,
+ },
+ ],
+ 'include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)',
+ '<(DEPTH)',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)',
+ ]
+ },
+ # This target exports a hard dependency because it generates header
+ # files.
+ 'hard_dependency': 1,
+}
diff --git a/build/json_schema_compile.gypi b/build/json_schema_compile.gypi
index d164748..9672f79 100644
--- a/build/json_schema_compile.gypi
+++ b/build/json_schema_compile.gypi
@@ -15,11 +15,8 @@
# namespace, like "toplevel::%(namespace)s_api".
#
# Functions and namespaces can be excluded by setting "nocompile" to true.
- # The default root path of API implementation sources is
- # chrome/browser/extensions/api and can be overridden by setting "impl_dir".
'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler',
'api_gen': '<(api_gen_dir)/compiler.py',
- 'impl_dir%': 'chrome/browser/extensions/api',
},
'rules': [
{
@@ -57,7 +54,6 @@
'--destdir=<(SHARED_INTERMEDIATE_DIR)',
'--namespace=<(root_namespace)',
'--generator=cpp',
- '--impl-dir=<(impl_dir)'
],
'message': 'Generating C++ code from <(RULE_INPUT_PATH) json files',
'process_outputs_as_sources': 1,
@@ -96,7 +92,6 @@
'--destdir=<(SHARED_INTERMEDIATE_DIR)',
'--namespace=<(root_namespace)',
'--generator=cpp',
- '--impl-dir=<(impl_dir)'
],
'message': 'Generating C++ code from <(RULE_INPUT_PATH) IDL files',
'process_outputs_as_sources': 1,
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index d2bbd09..15ae840 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -143,7 +143,8 @@ static_library("browser") {
"//cc",
"//chrome/browser/devtools",
"//chrome/browser/performance_monitor",
- "//chrome/common/extensions/api:api",
+ "//chrome/common/extensions/api",
+ "//chrome/common/extensions/api:api_registration",
"//chrome/installer/util",
"//components/autofill/content/browser",
"//components/dom_distiller/content",
diff --git a/chrome/browser/devtools/BUILD.gn b/chrome/browser/devtools/BUILD.gn
index 683e330..7565b9e 100644
--- a/chrome/browser/devtools/BUILD.gn
+++ b/chrome/browser/devtools/BUILD.gn
@@ -64,6 +64,7 @@ static_library("devtools") {
"//chrome:strings",
"//chrome/app/theme:theme_resources",
"//chrome/common/extensions/api",
+ "//chrome/common/extensions/api:api_registration",
"//net:http_server",
"//skia",
"//third_party/icu",
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn
index 453b1a0..d2b4565 100644
--- a/chrome/browser/extensions/BUILD.gn
+++ b/chrome/browser/extensions/BUILD.gn
@@ -39,6 +39,7 @@ static_library("extensions") {
"//chrome/browser/history:in_memory_url_index_cache_proto",
"//chrome/common",
"//chrome/common/extensions/api",
+ "//chrome/common/extensions/api:api_registration",
"//chrome/common/net",
"//chrome/common/safe_browsing:proto",
"//chrome/installer/util",
@@ -55,6 +56,7 @@ static_library("extensions") {
"//device/hid",
"//extensions/browser",
"//extensions/common/api",
+ "//extensions/common/api:api_registration",
"//extensions/strings",
"//net",
"//skia",
diff --git a/chrome/browser/extensions/api/api_registration.gyp b/chrome/browser/extensions/api/api_registration.gyp
new file mode 100644
index 0000000..6bbad07
--- /dev/null
+++ b/chrome/browser/extensions/api/api_registration.gyp
@@ -0,0 +1,41 @@
+# 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.
+
+{
+ 'targets': [
+ {
+ # GN version: //chrome/browser/extensions/api:api_registration
+ 'target_name': 'chrome_api_registration',
+ 'type': 'static_library',
+ # TODO(jschuh): http://crbug.com/167187 size_t -> int
+ 'msvs_disabled_warnings': [ 4267 ],
+ 'includes': [
+ '../../../../build/json_schema_bundle_registration_compile.gypi',
+ '../../../common/extensions/api/schemas.gypi',
+ ],
+ 'dependencies': [
+ '<(DEPTH)/chrome/common/extensions/api/api.gyp:chrome_api',
+ # Different APIs include some headers from chrome/common that in turn
+ # include generated headers from these targets.
+ # TODO(brettw) this should be made unnecessary if possible.
+ '<(DEPTH)/components/components.gyp:component_metrics_proto',
+ '<(DEPTH)/skia/skia.gyp:skia',
+ '<(DEPTH)/sync/sync.gyp:sync',
+ '<(DEPTH)/ui/accessibility/accessibility.gyp:ax_gen',
+ ],
+ 'conditions': [
+ ['OS != "ios" and OS != "android"', {
+ 'dependencies': [
+ '<(DEPTH)/components/components.gyp:copresence_proto',
+ ],
+ }],
+ ['chromeos==1', {
+ 'dependencies': [
+ '<(DEPTH)/chrome/chrome.gyp:drive_proto',
+ ],
+ }],
+ ],
+ },
+ ],
+}
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc
index a118f05..c2cd4cf 100644
--- a/chrome/browser/extensions/chrome_extensions_browser_client.cc
+++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/extensions/activity_log/activity_log.h"
#include "chrome/browser/extensions/api/chrome_extensions_api_client.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_service.h"
+#include "chrome/browser/extensions/api/generated_api_registration.h"
#include "chrome/browser/extensions/api/preference/chrome_direct_setting.h"
#include "chrome/browser/extensions/api/preference/preference_api.h"
#include "chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h"
@@ -29,13 +30,12 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
-#include "chrome/common/extensions/api/generated_api.h"
#include "chrome/common/extensions/features/feature_channel.h"
#include "chrome/common/pref_names.h"
+#include "extensions/browser/api/generated_api_registration.h"
#include "extensions/browser/extension_function_registry.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/pref_names.h"
-#include "extensions/common/api/generated_api.h"
#if defined(OS_CHROMEOS)
#include "chromeos/chromeos_switches.h"
diff --git a/chrome/browser/performance_monitor/BUILD.gn b/chrome/browser/performance_monitor/BUILD.gn
index d3250bc..a763a6c 100644
--- a/chrome/browser/performance_monitor/BUILD.gn
+++ b/chrome/browser/performance_monitor/BUILD.gn
@@ -7,4 +7,5 @@ import("//extensions/generated_extensions_api.gni")
generated_extensions_api("performance_monitor") {
sources = [ "events.json" ]
root_namespace = "performance_monitor::%(namespace)s"
+ schemas = true
}
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 6a7b936..f11a1cc 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -85,7 +85,8 @@ static_library("ui") {
"//chrome/browser/devtools",
"//chrome/browser/performance_monitor",
"//chrome/browser/ui/webui/omnibox:mojo_bindings",
- "//chrome/common/extensions/api:api",
+ "//chrome/common/extensions/api",
+ "//chrome/common/extensions/api:api_registration",
"//chrome/installer/util",
"//components/autofill/content/browser:risk_proto",
"//device/bluetooth",
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 6cfed41..f7ab1dd 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2908,6 +2908,7 @@
'dependencies': [
'apps',
'browser/performance_monitor/performance_monitor.gyp:performance_monitor',
+ 'browser/extensions/api/api_registration.gyp:chrome_api_registration',
'common/extensions/api/api.gyp:chrome_api',
'debugger',
'installer_util',
diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi
index 9a053ba..3162b18 100644
--- a/chrome/chrome_browser_chromeos.gypi
+++ b/chrome/chrome_browser_chromeos.gypi
@@ -23,6 +23,7 @@
'dependencies': [
# TODO(tbarzic): Cleanup this list.
'attestation_proto',
+ 'browser/extensions/api/api_registration.gyp:chrome_api_registration',
'browser/performance_monitor/performance_monitor.gyp:performance_monitor',
'browser_extensions',
'cert_logger_proto',
@@ -116,6 +117,7 @@
],
},
'export_dependent_settings': [
+ 'browser/extensions/api/api_registration.gyp:chrome_api_registration',
'common/extensions/api/api.gyp:chrome_api',
'../sync/sync.gyp:sync',
],
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi
index 15a05db..e42a52a 100644
--- a/chrome/chrome_browser_extensions.gypi
+++ b/chrome/chrome_browser_extensions.gypi
@@ -965,6 +965,7 @@
# have the same dependencies. Once browser_extensions is untangled from
# browser, then we can clean up these dependencies.
'dependencies': [
+ 'browser/extensions/api/api_registration.gyp:chrome_api_registration',
'chrome_resources.gyp:chrome_extra_resources',
'chrome_resources.gyp:chrome_resources',
'chrome_resources.gyp:chrome_strings',
@@ -988,6 +989,7 @@
'../crypto/crypto.gyp:crypto',
'../device/bluetooth/bluetooth.gyp:device_bluetooth',
'../device/hid/hid.gyp:device_hid',
+ '../extensions/browser/api/api_registration.gyp:extensions_api_registration',
'../extensions/common/api/api.gyp:extensions_api',
'../extensions/extensions.gyp:extensions_browser',
'../extensions/extensions_strings.gyp:extensions_strings',
@@ -1015,6 +1017,7 @@
'<(INTERMEDIATE_DIR)',
],
'export_dependent_settings': [
+ 'browser/extensions/api/api_registration.gyp:chrome_api_registration',
'common/extensions/api/api.gyp:chrome_api',
'../content/content.gyp:content_browser',
],
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 7e4cba4..7db0322 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -2614,6 +2614,7 @@
'<(SHARED_INTERMEDIATE_DIR)/chrome/browser/ui/webui/omnibox/omnibox.mojom.cc',
],
'dependencies': [
+ 'browser/extensions/api/api_registration.gyp:chrome_api_registration',
'browser/performance_monitor/performance_monitor.gyp:performance_monitor',
'chrome_web_ui_mojo_bindings.gyp:web_ui_mojo_bindings',
'common/extensions/api/api.gyp:chrome_api',
diff --git a/chrome/common/extensions/api/BUILD.gn b/chrome/common/extensions/api/BUILD.gn
index d4362fb..758cc0f 100644
--- a/chrome/common/extensions/api/BUILD.gn
+++ b/chrome/common/extensions/api/BUILD.gn
@@ -2,53 +2,33 @@
# 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("//extensions/generated_extensions_api.gni")
+import("schemas.gni")
-gypi_values = exec_script(
- "//build/gypi_to_gn.py",
- [ rebase_path("api.gyp") ],
- "scope",
- [ "api.gyp" ])
-
-# Common sources that are both bundled and compiled.
# GYP version: chrome/common/extensions/api/api.gyp:chrome_api
generated_extensions_api("api") {
- if (is_android) {
- # Should be eliminated. See crbug.com/305852.
- sources = gypi_values.android_schema_files
- } else {
- sources = gypi_values.main_schema_files
- if (is_chromeos) {
- sources += gypi_values.chromeos_schema_files
- if (is_chrome_branded) {
- sources += gypi_values.chromeos_branded_schema_files
- }
- }
- if (enable_webrtc) {
- sources += gypi_values.webrtc_schema_files
- }
- }
-
- if (!is_android) {
- uncompiled_sources = gypi_values.main_non_compiled_schema_files
- }
+ schemas = true
+ bundle = true
+}
+# GYP version: chrome/browser/extensions/api/api.gyp:chrome_api_registration
+generated_extensions_api("api_registration") {
impl_dir = "//chrome/browser/extensions/api"
- root_namespace = "extensions::api::%(namespace)s"
- bundle = true
+ bundle_registration = true
deps = [
# Different APIs include some headers from chrome/common that in turn
# include generated headers from these targets.
# TODO(brettw) this should be made unnecessary if possible.
"//components/metrics/proto",
-
- "//content/public/browser",
"//skia",
"//sync",
+ "//ui/accessibility:ax_gen",
]
+ if (!is_ios && !is_android) {
+ deps += ["//components/copresence/proto"]
+ }
if (is_chromeos) {
- # deps += [ "<(DEPTH)/chrome/chrome.gyp:drive_proto" ] TODO)GYP)
+ # deps += [ "<(DEPTH)/chrome/chrome.gyp:drive_proto" ] TODO(GYP)
}
}
diff --git a/chrome/common/extensions/api/api.gyp b/chrome/common/extensions/api/api.gyp
index ef1a2c5..19b28fa 100644
--- a/chrome/common/extensions/api/api.gyp
+++ b/chrome/common/extensions/api/api.gyp
@@ -3,160 +3,6 @@
# found in the LICENSE file.
{
- # All files are stored in these lists which are referenced in the target
- # below so that the GN build of this target can read in this dictionary and
- # duplicate the same logic without the lists getting out-of-sync. The GN
- # .gypi reader can not process conditions and does not know about targets,
- # etc., it just reads Python dictionaries.
- #
- # If you add a new category, also add it to the BUILD.gn file in this
- # directory.
- 'variables': {
- # These duplicate other lists and are the only ones used on Android. They
- # should be eliminated. See crbug.com/305852.
- 'android_schema_files': [
- 'manifest_types.json',
- ],
-
- # These are used everywhere except Android.
- 'main_schema_files': [
- 'accessibility_private.json',
- 'activity_log_private.json',
- 'alarms.idl',
- 'app_current_window_internal.idl',
- 'app_window.idl',
- 'audio.idl',
- 'automation.idl',
- 'automation_internal.idl',
- 'autotest_private.idl',
- 'bluetooth.idl',
- 'bluetooth_low_energy.idl',
- 'bluetooth_private.json',
- 'bluetooth_socket.idl',
- 'bookmark_manager_private.json',
- 'bookmarks.json',
- 'braille_display_private.idl',
- 'browser.idl',
- 'cloud_print_private.json',
- 'command_line_private.json',
- 'content_settings.json',
- 'context_menus_internal.json',
- 'context_menus.json',
- 'cookies.json',
- 'copresence.idl',
- 'copresence_private.idl',
- 'debugger.json',
- 'desktop_capture.json',
- 'developer_private.idl',
- 'dial.idl',
- 'downloads.idl',
- 'downloads_internal.idl',
- 'easy_unlock_private.idl',
- 'echo_private.json',
- 'enterprise_platform_keys_private.json',
- 'events.json',
- 'experience_sampling_private.json',
- 'extension_options_internal.idl',
- 'feedback_private.idl',
- 'file_browser_private.idl',
- 'file_browser_private_internal.idl',
- 'file_system.idl',
- 'file_system_provider.idl',
- 'file_system_provider_internal.idl',
- 'font_settings.json',
- 'gcd_private.idl',
- 'gcm.json',
- 'guest_view_internal.json',
- 'hangouts_private.idl',
- 'history.json',
- 'hotword_private.idl',
- 'i18n.json',
- 'identity.idl',
- 'identity_private.idl',
- 'idle.json',
- 'image_writer_private.idl',
- 'input_ime.json',
- 'location.idl',
- 'management.json',
- 'manifest_types.json',
- 'mdns.idl',
- 'media_galleries.idl',
- 'media_galleries_private.idl',
- 'metrics_private.json',
- 'networking_private.json',
- 'notification_provider.idl',
- 'notifications.idl',
- 'omnibox.json',
- 'page_capture.json',
- 'permissions.json',
- 'preferences_private.json',
- 'push_messaging.idl',
- 'reading_list_private.json',
- 'screenlock_private.idl',
- 'sessions.json',
- 'signed_in_devices.idl',
- 'streams_private.idl',
- 'synced_notifications_private.idl',
- 'sync_file_system.idl',
- 'system_cpu.idl',
- 'system_display.idl',
- 'system_indicator.idl',
- 'system_memory.idl',
- 'system_network.idl',
- 'system_private.json',
- 'system_storage.idl',
- 'tab_capture.idl',
- 'tabs.json',
- 'terminal_private.json',
- 'types.json',
- 'virtual_keyboard_private.json',
- 'web_navigation.json',
- 'web_request.json',
- # Despite the name, this API does not rely on any
- # WebRTC-specific bits and as such does not belong in
- # the enable_webrtc==0 section below.
- 'webrtc_audio_private.idl',
- 'webrtc_logging_private.idl',
- 'webstore_private.json',
- 'web_view_internal.json',
- 'windows.json',
- ],
- 'main_non_compiled_schema_files': [
- 'browsing_data.json',
- 'chromeos_info_private.json',
- 'extension.json',
- 'idltest.idl',
- 'infobars.json',
- 'media_player_private.json',
- 'music_manager_private.idl',
- 'principals_private.idl',
- 'top_sites.json',
- 'web_request_internal.json',
- ],
-
- # ChromeOS-specific schemas.
- 'chromeos_schema_files': [
- 'accessibility_features.json',
- 'diagnostics.idl',
- 'enterprise_platform_keys.idl',
- 'enterprise_platform_keys_internal.idl',
- 'file_browser_handler_internal.json',
- 'first_run_private.json',
- 'log_private.idl',
- 'wallpaper.json',
- 'wallpaper_private.json',
- 'webcam_private.idl',
- ],
- 'chromeos_branded_schema_files': [
- 'ledger/ledger.idl',
- ],
-
- 'webrtc_schema_files': [
- 'cast_streaming_rtp_stream.idl',
- 'cast_streaming_session.idl',
- 'cast_streaming_udp_transport.idl',
- ],
- },
'targets': [
{
# GN version: //chrome/common/extensions/api:api
@@ -170,62 +16,7 @@
'includes': [
'../../../../build/json_schema_bundle_compile.gypi',
'../../../../build/json_schema_compile.gypi',
- ],
- 'variables': {
- 'chromium_code': 1,
- # Disable schema compiler to generate model extension API code.
- # Only register the extension functions in extension system.
- 'conditions': [
- ['enable_extensions==1', {
- 'non_compiled_schema_files': [
- '<@(main_non_compiled_schema_files)',
- ],
- 'schema_files': [
- '<@(main_schema_files)',
- ],
- }, { # enable_extensions==0
- 'non_compiled_schema_files': [
- ],
- 'schema_files': [
- # These should be eliminated. See crbug.com/305852.
- '<@(android_schema_files)',
- ],
- }],
- ['chromeos==1', {
- 'schema_files': [
- '<@(chromeos_schema_files)',
- ],
- }],
- ['enable_extensions==1 and enable_webrtc==1', {
- 'schema_files': [
- '<@(webrtc_schema_files)',
- ],
- }],
- ['branding=="Chrome" and chromeos==1', {
- 'schema_files': [
- '<@(chromeos_branded_schema_files)',
- ],
- }],
- ],
- 'cc_dir': 'chrome/common/extensions/api',
- 'root_namespace': 'extensions::api::%(namespace)s',
- },
- 'dependencies': [
- # Different APIs include some headers from chrome/common that in turn
- # include generated headers from these targets.
- # TODO(brettw) this should be made unnecessary if possible.
- '<(DEPTH)/components/components.gyp:component_metrics_proto',
-
- '<(DEPTH)/content/content.gyp:content_browser',
- '<(DEPTH)/skia/skia.gyp:skia',
- '<(DEPTH)/sync/sync.gyp:sync',
- ],
- 'conditions': [
- ['chromeos==1', {
- 'dependencies': [
- '<(DEPTH)/chrome/chrome.gyp:drive_proto',
- ],
- }],
+ 'schemas.gypi',
],
},
],
diff --git a/chrome/common/extensions/api/schemas.gni b/chrome/common/extensions/api/schemas.gni
new file mode 100644
index 0000000..452c1df
--- /dev/null
+++ b/chrome/common/extensions/api/schemas.gni
@@ -0,0 +1,34 @@
+# 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")
+
+gypi_values = exec_script(
+ "//build/gypi_to_gn.py",
+ [ rebase_path("schemas.gypi") ],
+ "scope",
+ [ "schemas.gypi" ])
+
+# Common sources that are both bundled and compiled.
+if (is_android) {
+ # Should be eliminated. See crbug.com/305852.
+ sources = gypi_values.android_schema_files
+} else {
+ sources = gypi_values.main_schema_files
+ if (is_chromeos) {
+ sources += gypi_values.chromeos_schema_files
+ if (is_chrome_branded) {
+ sources += gypi_values.chromeos_branded_schema_files
+ }
+ }
+ if (enable_webrtc) {
+ sources += gypi_values.webrtc_schema_files
+ }
+}
+
+if (!is_android) {
+ uncompiled_sources = gypi_values.main_non_compiled_schema_files
+}
+
+root_namespace = "extensions::api::%(namespace)s"
diff --git a/chrome/common/extensions/api/schemas.gypi b/chrome/common/extensions/api/schemas.gypi
new file mode 100644
index 0000000..41134e9
--- /dev/null
+++ b/chrome/common/extensions/api/schemas.gypi
@@ -0,0 +1,194 @@
+# 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.
+
+{
+ 'sources': [
+ '<@(schema_files)',
+ ],
+ 'variables': {
+ # These duplicate other lists and are the only ones used on Android. They
+ # should be eliminated. See crbug.com/305852.
+ 'android_schema_files': [
+ 'manifest_types.json',
+ ],
+
+ # These are used everywhere except Android.
+ 'main_schema_files': [
+ 'accessibility_private.json',
+ 'activity_log_private.json',
+ 'alarms.idl',
+ 'app_current_window_internal.idl',
+ 'app_window.idl',
+ 'audio.idl',
+ 'automation.idl',
+ 'automation_internal.idl',
+ 'autotest_private.idl',
+ 'bluetooth.idl',
+ 'bluetooth_low_energy.idl',
+ 'bluetooth_private.json',
+ 'bluetooth_socket.idl',
+ 'bookmark_manager_private.json',
+ 'bookmarks.json',
+ 'braille_display_private.idl',
+ 'browser.idl',
+ 'cloud_print_private.json',
+ 'command_line_private.json',
+ 'content_settings.json',
+ 'context_menus_internal.json',
+ 'context_menus.json',
+ 'cookies.json',
+ 'copresence.idl',
+ 'copresence_private.idl',
+ 'debugger.json',
+ 'desktop_capture.json',
+ 'developer_private.idl',
+ 'dial.idl',
+ 'downloads.idl',
+ 'downloads_internal.idl',
+ 'easy_unlock_private.idl',
+ 'echo_private.json',
+ 'enterprise_platform_keys_private.json',
+ 'events.json',
+ 'experience_sampling_private.json',
+ 'extension_options_internal.idl',
+ 'feedback_private.idl',
+ 'file_browser_private.idl',
+ 'file_browser_private_internal.idl',
+ 'file_system.idl',
+ 'file_system_provider.idl',
+ 'file_system_provider_internal.idl',
+ 'font_settings.json',
+ 'gcd_private.idl',
+ 'gcm.json',
+ 'guest_view_internal.json',
+ 'hangouts_private.idl',
+ 'history.json',
+ 'hotword_private.idl',
+ 'i18n.json',
+ 'identity.idl',
+ 'identity_private.idl',
+ 'idle.json',
+ 'image_writer_private.idl',
+ 'input_ime.json',
+ 'location.idl',
+ 'management.json',
+ 'manifest_types.json',
+ 'mdns.idl',
+ 'media_galleries.idl',
+ 'media_galleries_private.idl',
+ 'metrics_private.json',
+ 'networking_private.json',
+ 'notification_provider.idl',
+ 'notifications.idl',
+ 'omnibox.json',
+ 'page_capture.json',
+ 'permissions.json',
+ 'preferences_private.json',
+ 'push_messaging.idl',
+ 'reading_list_private.json',
+ 'screenlock_private.idl',
+ 'sessions.json',
+ 'signed_in_devices.idl',
+ 'streams_private.idl',
+ 'synced_notifications_private.idl',
+ 'sync_file_system.idl',
+ 'system_cpu.idl',
+ 'system_display.idl',
+ 'system_indicator.idl',
+ 'system_memory.idl',
+ 'system_network.idl',
+ 'system_private.json',
+ 'system_storage.idl',
+ 'tab_capture.idl',
+ 'tabs.json',
+ 'terminal_private.json',
+ 'types.json',
+ 'virtual_keyboard_private.json',
+ 'web_navigation.json',
+ 'web_request.json',
+ # Despite the name, this API does not rely on any
+ # WebRTC-specific bits and as such does not belong in
+ # the enable_webrtc==0 section below.
+ 'webrtc_audio_private.idl',
+ 'webrtc_logging_private.idl',
+ 'webstore_private.json',
+ 'web_view_internal.json',
+ 'windows.json',
+ ],
+ 'main_non_compiled_schema_files': [
+ 'browsing_data.json',
+ 'chromeos_info_private.json',
+ 'extension.json',
+ 'idltest.idl',
+ 'infobars.json',
+ 'media_player_private.json',
+ 'music_manager_private.idl',
+ 'principals_private.idl',
+ 'top_sites.json',
+ 'web_request_internal.json',
+ ],
+
+ # ChromeOS-specific schemas.
+ 'chromeos_schema_files': [
+ 'accessibility_features.json',
+ 'diagnostics.idl',
+ 'enterprise_platform_keys.idl',
+ 'enterprise_platform_keys_internal.idl',
+ 'file_browser_handler_internal.json',
+ 'first_run_private.json',
+ 'log_private.idl',
+ 'wallpaper.json',
+ 'wallpaper_private.json',
+ 'webcam_private.idl',
+ ],
+ 'chromeos_branded_schema_files': [
+ 'ledger/ledger.idl',
+ ],
+
+ 'webrtc_schema_files': [
+ 'cast_streaming_rtp_stream.idl',
+ 'cast_streaming_session.idl',
+ 'cast_streaming_udp_transport.idl',
+ ],
+
+ 'chromium_code': 1,
+ # Disable schema compiler to generate model extension API code.
+ # Only register the extension functions in extension system.
+ 'conditions': [
+ ['enable_extensions==1', {
+ 'non_compiled_schema_files': [
+ '<@(main_non_compiled_schema_files)',
+ ],
+ 'schema_files': [
+ '<@(main_schema_files)',
+ ],
+ }, { # enable_extensions==0
+ 'non_compiled_schema_files': [
+ ],
+ 'schema_files': [
+ # These should be eliminated. See crbug.com/305852.
+ '<@(android_schema_files)',
+ ],
+ }],
+ ['chromeos==1', {
+ 'schema_files': [
+ '<@(chromeos_schema_files)',
+ ],
+ }],
+ ['enable_extensions==1 and enable_webrtc==1', {
+ 'schema_files': [
+ '<@(webrtc_schema_files)',
+ ],
+ }],
+ ['branding=="Chrome" and chromeos==1', {
+ 'schema_files': [
+ '<@(chromeos_branded_schema_files)',
+ ],
+ }],
+ ],
+ 'cc_dir': 'chrome/common/extensions/api',
+ 'root_namespace': 'extensions::api::%(namespace)s',
+ 'impl_dir_': 'chrome/browser/extensions/api',
+ },
+}
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index 5827ae2..32dd24e 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -125,8 +125,11 @@ extern int UtilityMain(const MainFunctionParams&);
namespace content {
+#if !defined(CHROME_MULTIPLE_DLL_CHILD)
base::LazyInstance<ContentBrowserClient>
g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER;
+#endif // !CHROME_MULTIPLE_DLL_CHILD
+
#if !defined(OS_IOS) && !defined(CHROME_MULTIPLE_DLL_BROWSER)
base::LazyInstance<ContentPluginClient>
g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER;
@@ -242,12 +245,14 @@ class ContentClientInitializer {
static void Set(const std::string& process_type,
ContentMainDelegate* delegate) {
ContentClient* content_client = GetContentClient();
+#if !defined(CHROME_MULTIPLE_DLL_CHILD)
if (process_type.empty()) {
if (delegate)
content_client->browser_ = delegate->CreateContentBrowserClient();
if (!content_client->browser_)
content_client->browser_ = &g_empty_content_browser_client.Get();
}
+#endif // !CHROME_MULTIPLE_DLL_CHILD
#if !defined(OS_IOS) && !defined(CHROME_MULTIPLE_DLL_BROWSER)
if (process_type == switches::kPluginProcess ||
@@ -349,7 +354,7 @@ int RunZygote(const MainFunctionParams& main_function_params,
#if !defined(OS_IOS)
static void RegisterMainThreadFactories() {
-#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
+#if !defined(CHROME_MULTIPLE_DLL_BROWSER) && !defined(CHROME_MULTIPLE_DLL_CHILD)
UtilityProcessHostImpl::RegisterUtilityMainThreadFactory(
CreateInProcessUtilityThread);
RenderProcessHostImpl::RegisterRendererMainThreadFactory(
@@ -366,7 +371,7 @@ static void RegisterMainThreadFactories() {
LOG(FATAL) <<
"--in-process-gpu is not supported in chrome multiple dll browser.";
}
-#endif
+#endif // !CHROME_MULTIPLE_DLL_BROWSER && !CHROME_MULTIPLE_DLL_CHILD
}
// Run the FooMain() for a given process type.
diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn
index 3eba645..d2b733f 100644
--- a/extensions/BUILD.gn
+++ b/extensions/BUILD.gn
@@ -14,7 +14,7 @@ group("extensions_resources") {
}
# GYP version: extensions/extensions_resources.gyp:extensions_resources
-# (exntensions_resources action)
+# (extensions_resources action)
grit("extensions_resources_grd") {
source = "extensions_resources.grd"
outputs = [
@@ -75,6 +75,7 @@ source_set("test_support") {
"//extensions/browser",
"//extensions/common",
"//extensions/common/api",
+ "//extensions/common/api:api_registration",
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn
index 73f3690..f948e3d 100644
--- a/extensions/browser/BUILD.gn
+++ b/extensions/browser/BUILD.gn
@@ -18,6 +18,7 @@ source_set("browser") {
"//content/public/browser",
"//extensions/common",
"//extensions/common/api",
+ "//extensions/common/api:api_registration",
"//extensions/strings",
"//skia",
"//third_party/leveldatabase",
diff --git a/extensions/browser/api/api_registration.gyp b/extensions/browser/api/api_registration.gyp
new file mode 100644
index 0000000..0a164c7
--- /dev/null
+++ b/extensions/browser/api/api_registration.gyp
@@ -0,0 +1,30 @@
+# 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.
+
+{
+ 'targets': [
+ {
+ # GN version: //extensions/browser/api
+ 'target_name': 'extensions_api_registration',
+ 'type': 'static_library',
+ # TODO(jschuh): http://crbug.com/167187 size_t -> int
+ 'msvs_disabled_warnings': [ 4267 ],
+ 'includes': [
+ '../../../build/json_schema_bundle_registration_compile.gypi',
+ '../../common/api/schemas.gypi',
+ ],
+ 'dependencies': [
+ '<(DEPTH)/extensions/common/api/api.gyp:extensions_api',
+ ],
+ 'conditions': [
+ ['enable_extensions==1', {
+ 'dependencies': [
+ '<(DEPTH)/device/serial/serial.gyp:device_serial_mojo',
+ '<(DEPTH)/skia/skia.gyp:skia',
+ ],
+ }],
+ ],
+ },
+ ],
+}
diff --git a/extensions/common/api/BUILD.gn b/extensions/common/api/BUILD.gn
index 1c924bd..10a69fa 100644
--- a/extensions/common/api/BUILD.gn
+++ b/extensions/common/api/BUILD.gn
@@ -3,31 +3,19 @@
# found in the LICENSE file.
import("//extensions/generated_extensions_api.gni")
+import("schemas.gni")
# GYP version: extensions/common/api/api.gyp:extensions_api
generated_extensions_api("api") {
- sources = [
- "app_runtime.idl",
- "app_view_internal.json",
- "cast_channel.idl",
- "dns.idl",
- "extensions_manifest_types.json",
- "hid.idl",
- "power.idl",
- "runtime.json",
- "serial.idl",
- "socket.idl",
- "sockets_tcp.idl",
- "sockets_tcp_server.idl",
- "sockets_udp.idl",
- "storage.json",
- "test.json",
- "usb.idl",
- "usb_private.idl",
- ]
- root_namespace = "extensions::core_api::%(namespace)s"
- impl_dir = "//extensions/browser/api"
+ schemas = true
bundle = true
+}
+
+# GYP version: extensions/browser/api/api_registration.gyp:extensions_api_registration
+generated_extensions_api("api_registration") {
+ impl_dir = "//extensions/browser/api"
+ bundle_registration = true
+
deps = [
"//device/serial",
"//skia",
diff --git a/extensions/common/api/api.gyp b/extensions/common/api/api.gyp
index c95217c..f66baef 100644
--- a/extensions/common/api/api.gyp
+++ b/extensions/common/api/api.gyp
@@ -8,59 +8,12 @@
# GN version: //extensions/common/api
'target_name': 'extensions_api',
'type': 'static_library',
- 'sources': [
- '<@(schema_files)',
- ],
# TODO(jschuh): http://crbug.com/167187 size_t -> int
'msvs_disabled_warnings': [ 4267 ],
'includes': [
'../../../build/json_schema_bundle_compile.gypi',
'../../../build/json_schema_compile.gypi',
- ],
- 'variables': {
- 'chromium_code': 1,
- 'non_compiled_schema_files': [
- ],
- 'conditions': [
- ['enable_extensions==1', {
- # Note: file list duplicated in GN build.
- 'schema_files': [
- 'app_runtime.idl',
- 'app_view_internal.json',
- 'cast_channel.idl',
- 'dns.idl',
- 'extensions_manifest_types.json',
- 'hid.idl',
- 'power.idl',
- 'runtime.json',
- 'serial.idl',
- 'socket.idl',
- 'sockets_tcp.idl',
- 'sockets_tcp_server.idl',
- 'sockets_udp.idl',
- 'storage.json',
- 'test.json',
- 'usb.idl',
- 'usb_private.idl',
- ],
- }, {
- # TODO: Eliminate these on Android. See crbug.com/305852.
- 'schema_files': [
- 'runtime.json',
- ],
- }],
- ],
- 'cc_dir': 'extensions/common/api',
- 'root_namespace': 'extensions::core_api::%(namespace)s',
- 'impl_dir': 'extensions/browser/api',
- },
- 'conditions': [
- ['enable_extensions==1', {
- 'dependencies': [
- '<(DEPTH)/device/serial/serial.gyp:device_serial',
- '<(DEPTH)/skia/skia.gyp:skia',
- ],
- }],
+ 'schemas.gypi',
],
},
],
diff --git a/extensions/common/api/schemas.gni b/extensions/common/api/schemas.gni
new file mode 100644
index 0000000..2227b71
--- /dev/null
+++ b/extensions/common/api/schemas.gni
@@ -0,0 +1,17 @@
+# 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.
+
+gypi_values = exec_script(
+ "//build/gypi_to_gn.py",
+ [ rebase_path("schemas.gypi") ],
+ "scope",
+ [ "schemas.gypi" ])
+
+if (is_android) {
+ sources = gypi_values.android_schema_files
+} else {
+ sources = gypi_values.main_schema_files
+}
+
+root_namespace = "extensions::core_api::%(namespace)s"
diff --git a/extensions/common/api/schemas.gypi b/extensions/common/api/schemas.gypi
new file mode 100644
index 0000000..e595e5d
--- /dev/null
+++ b/extensions/common/api/schemas.gypi
@@ -0,0 +1,51 @@
+# 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.
+
+{
+ 'sources': [
+ '<@(schema_files)',
+ ],
+ 'variables': {
+ 'chromium_code': 1,
+ # TODO: Eliminate these on Android. See crbug.com/305852.
+ 'android_schema_files': [
+ 'runtime.json',
+ ],
+ 'main_schema_files': [
+ 'app_runtime.idl',
+ 'app_view_internal.json',
+ 'cast_channel.idl',
+ 'dns.idl',
+ 'extensions_manifest_types.json',
+ 'hid.idl',
+ 'power.idl',
+ 'runtime.json',
+ 'serial.idl',
+ 'socket.idl',
+ 'sockets_tcp.idl',
+ 'sockets_tcp_server.idl',
+ 'sockets_udp.idl',
+ 'storage.json',
+ 'test.json',
+ 'usb.idl',
+ 'usb_private.idl',
+ ],
+ 'non_compiled_schema_files': [
+ ],
+ 'conditions': [
+ ['enable_extensions==1', {
+ 'schema_files': [
+ '<@(main_schema_files)',
+ ],
+ }, {
+ 'schema_files': [
+ '<@(android_schema_files)',
+ ],
+ }],
+ ],
+ 'cc_dir': 'extensions/common/api',
+ 'root_namespace': 'extensions::core_api::%(namespace)s',
+ 'impl_dir_': 'extensions/browser/api',
+ },
+}
diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp
index f43aa10..8edeb11 100644
--- a/extensions/extensions.gyp
+++ b/extensions/extensions.gyp
@@ -262,6 +262,7 @@
'../device/serial/serial.gyp:device_serial',
'../skia/skia.gyp:skia',
'../third_party/leveldatabase/leveldatabase.gyp:leveldatabase',
+ 'browser/api/api_registration.gyp:extensions_api_registration',
'cast_channel_proto',
'common/api/api.gyp:extensions_api',
'extensions_common',
@@ -770,6 +771,7 @@
'../base/base.gyp:base',
'../net/net.gyp:net_test_support',
'../testing/gtest.gyp:gtest',
+ 'browser/api/api_registration.gyp:extensions_api_registration',
'common/api/api.gyp:extensions_api',
'extensions_browser',
'extensions_common',
diff --git a/extensions/generated_extensions_api.gni b/extensions/generated_extensions_api.gni
index 5360711e..98ddc77 100644
--- a/extensions/generated_extensions_api.gni
+++ b/extensions/generated_extensions_api.gni
@@ -16,16 +16,23 @@
# namespace for each API. Use %(namespace)s to replace with the API
# namespace, like "toplevel::%(namespace)s_api".
#
+# schemas [optional, default = false]
+# Boolean indicating if the schema files should be generated.
+#
# bundle [optional, default = false]
-# Boolean indicating if the schema files should be bundled or not.
+# Boolean indicating if the schema bundle files should be generated.
+#
+# bundle_registration [optional, default = false]
+# Boolean indicating if the API registration bundle files should be generated.
#
-# impl_dir [required if bundle = true, otherwise unused]
+# impl_dir [required if bundle_registration = true, otherwise unused]
# The path containing C++ implementations of API functions. This path is
# used as the root path when looking for {schema}/{schema}_api.h headers
-# during the API bundle generation phase. Such headers, if found, are
+# when generating API registration bundles. Such headers, if found, are
# automatically included by the generated code.
#
-# uncompiled_sources [optional, only used when bundle = true]
+# uncompiled_sources [optional, only used when bundle = true or
+# bundle_registration = true]
# A list of schema files which should not be compiled, but which should still
# be processed for API bundle generation.
#
@@ -33,7 +40,7 @@
# If any deps are specified they will be inherited by the static library
# target.
#
-# The static libarary target also inherits the visibility and output_name
+# The static library target also inherits the visibility and output_name
# of its invoker.
template("generated_extensions_api") {
@@ -42,7 +49,10 @@ template("generated_extensions_api") {
assert(defined(invoker.root_namespace),
"\"root_namespace\" must be defined for the $target_name template.")
+ schemas = defined(invoker.schemas) && invoker.schemas
bundle = defined(invoker.bundle) && invoker.bundle
+ bundle_registration = defined(invoker.bundle_registration) &&
+ invoker.bundle_registration
# Keep a copy of the target_name here since it will be trampled
# in nested targets.
@@ -54,7 +64,7 @@ template("generated_extensions_api") {
visibility = target_visibility
}
- schemas = invoker.sources
+ sources = invoker.sources
root_namespace = invoker.root_namespace
compiler_root = "//tools/json_schema_compiler"
@@ -72,41 +82,36 @@ template("generated_extensions_api") {
"$compiler_root/util_cc_helper.py",
]
- schema_generator_name = target_name + "_schema_generator"
- action_foreach(schema_generator_name) {
- script = compiler_script
- inputs = compiler_sources
- sources = schemas
- outputs = [
- "$target_gen_dir/{{source_name_part}}.cc",
- "$target_gen_dir/{{source_name_part}}.h",
- ]
- args = [
- "{{source}}",
- "--root=" + rebase_path("//", root_build_dir),
- "--destdir=" + rebase_path(root_gen_dir, root_build_dir),
- "--namespace=$root_namespace",
- "--generator=cpp" ]
- visibility = target_visibility
+ if (schemas) {
+ schema_generator_name = target_name + "_schema_generator"
+ action_foreach(schema_generator_name) {
+ script = compiler_script
+ inputs = compiler_sources
+ outputs = [
+ "$target_gen_dir/{{source_name_part}}.cc",
+ "$target_gen_dir/{{source_name_part}}.h",
+ ]
+ args = [
+ "{{source}}",
+ "--root=" + rebase_path("//", root_build_dir),
+ "--destdir=" + rebase_path(root_gen_dir, root_build_dir),
+ "--namespace=$root_namespace",
+ "--generator=cpp" ]
+ visibility = target_visibility
+ }
}
if (bundle) {
- assert(defined(invoker.impl_dir),
- "\"impl_dir\" must be defined for the $target_name template.")
- impl_dir = invoker.impl_dir
-
- uncompiled_schemas = []
+ uncompiled_sources = []
if (defined(invoker.uncompiled_sources)) {
- uncompiled_schemas = invoker.uncompiled_sources
+ uncompiled_sources = invoker.uncompiled_sources
}
- bundle_generator_name = target_name + "_bundle_generator"
- action(bundle_generator_name) {
+ bundle_generator_schema_name = target_name + "_bundle_generator_schema"
+ action(bundle_generator_schema_name) {
script = compiler_script
- inputs = compiler_sources + schemas + uncompiled_schemas
+ inputs = compiler_sources + sources + uncompiled_sources
outputs = [
- "$target_gen_dir/generated_api.cc",
- "$target_gen_dir/generated_api.h",
"$target_gen_dir/generated_schemas.cc",
"$target_gen_dir/generated_schemas.h",
]
@@ -114,25 +119,64 @@ template("generated_extensions_api") {
"--root=" + rebase_path("//", root_build_dir),
"--destdir=" + rebase_path(root_gen_dir, root_build_dir),
"--namespace=$root_namespace",
- "--generator=cpp-bundle",
+ "--generator=cpp-bundle-schema",
+ ] +
+ rebase_path(sources, root_build_dir) +
+ rebase_path(uncompiled_sources, root_build_dir)
+ }
+ }
+
+ if (bundle_registration) {
+ uncompiled_sources = []
+ if (defined(invoker.uncompiled_sources)) {
+ uncompiled_sources = invoker.uncompiled_sources
+ }
+
+ assert(defined(invoker.impl_dir),
+ "\"impl_dir\" must be defined for the $target_name template.")
+ impl_dir = invoker.impl_dir
+
+ bundle_generator_registration_name = target_name +
+ "_bundle_generator_registration"
+ action(bundle_generator_registration_name) {
+ script = compiler_script
+ inputs = compiler_sources + sources + uncompiled_sources
+ outputs = [
+ "$root_gen_dir/$impl_dir/generated_api_registration.cc",
+ "$root_gen_dir/$impl_dir/generated_api_registration.h",
+ ]
+ args = [
+ "--root=" + rebase_path("//", root_build_dir),
+ "--destdir=" + rebase_path(root_gen_dir, root_build_dir),
+ "--namespace=$root_namespace",
+ "--generator=cpp-bundle-registration",
"--impl-dir=" + rebase_path(impl_dir, "//"),
] +
- rebase_path(schemas, root_build_dir) +
- rebase_path(uncompiled_schemas, root_build_dir)
+ rebase_path(sources, root_build_dir) +
+ rebase_path(uncompiled_sources, root_build_dir)
}
}
source_set(target_name) {
- sources = get_target_outputs(":$schema_generator_name")
-
- deps = [
- ":$schema_generator_name",
- "//tools/json_schema_compiler:generated_api_util",
- ]
+ sources = []
+ deps = []
+
+ if (schemas) {
+ sources += get_target_outputs(":$schema_generator_name")
+ deps += [
+ ":$schema_generator_name",
+ "//tools/json_schema_compiler:generated_api_util",
+ ]
+ }
if (bundle) {
- sources += get_target_outputs(":$bundle_generator_name")
- deps += [ ":$bundle_generator_name" ]
+ sources += get_target_outputs(":$bundle_generator_schema_name")
+ deps += [ ":$bundle_generator_schema_name" ]
+ }
+
+ if (bundle_registration) {
+ sources += get_target_outputs(":$bundle_generator_registration_name")
+ deps += [ ":$bundle_generator_registration_name" ]
}
if (defined(invoker.deps)) {
diff --git a/extensions/shell/app_shell.gyp b/extensions/shell/app_shell.gyp
index c560409..ca52ece 100644
--- a/extensions/shell/app_shell.gyp
+++ b/extensions/shell/app_shell.gyp
@@ -23,12 +23,14 @@
'<(DEPTH)/content/content.gyp:content_ppapi_plugin',
'<(DEPTH)/content/content_shell_and_tests.gyp:content_shell_lib',
'<(DEPTH)/device/hid/hid.gyp:device_hid',
+ '<(DEPTH)/extensions/browser/api/api_registration.gyp:extensions_api_registration',
'<(DEPTH)/extensions/common/api/api.gyp:extensions_api',
'<(DEPTH)/extensions/extensions.gyp:extensions_browser',
'<(DEPTH)/extensions/extensions.gyp:extensions_common',
'<(DEPTH)/extensions/extensions.gyp:extensions_renderer',
'<(DEPTH)/extensions/extensions.gyp:extensions_shell_and_test_pak',
'<(DEPTH)/extensions/extensions_resources.gyp:extensions_resources',
+ '<(DEPTH)/extensions/shell/browser/api/api_registration.gyp:shell_api_registration',
'<(DEPTH)/extensions/shell/common/api/api.gyp:shell_api',
'<(DEPTH)/mojo/mojo_base.gyp:mojo_environment_chromium',
'<(DEPTH)/mojo/mojo_base.gyp:mojo_system_impl',
diff --git a/extensions/shell/browser/api/api_registration.gyp b/extensions/shell/browser/api/api_registration.gyp
new file mode 100644
index 0000000..b88e903
--- /dev/null
+++ b/extensions/shell/browser/api/api_registration.gyp
@@ -0,0 +1,22 @@
+# 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'shell_api_registration',
+ 'type': 'static_library',
+ # TODO(jschuh): http://crbug.com/167187 size_t -> int
+ 'msvs_disabled_warnings': [ 4267 ],
+ 'includes': [
+ '../../../../build/json_schema_bundle_registration_compile.gypi',
+ '../../common/api/schemas.gypi',
+ ],
+ 'dependencies': [
+ '<(DEPTH)/extensions/shell/common/api/api.gyp:shell_api',
+ '<(DEPTH)/skia/skia.gyp:skia',
+ ],
+ },
+ ],
+}
diff --git a/extensions/shell/browser/shell_extensions_browser_client.cc b/extensions/shell/browser/shell_extensions_browser_client.cc
index eee57b6..84e757c 100644
--- a/extensions/shell/browser/shell_extensions_browser_client.cc
+++ b/extensions/shell/browser/shell_extensions_browser_client.cc
@@ -9,16 +9,16 @@
#include "base/prefs/testing_pref_store.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/user_prefs/user_prefs.h"
+#include "extensions/browser/api/generated_api_registration.h"
#include "extensions/browser/app_sorting.h"
#include "extensions/browser/extension_function_registry.h"
#include "extensions/browser/extension_prefs.h"
-#include "extensions/common/api/generated_api.h"
+#include "extensions/shell/browser/api/generated_api_registration.h"
#include "extensions/shell/browser/api/shell_extensions_api_client.h"
#include "extensions/shell/browser/shell_app_sorting.h"
#include "extensions/shell/browser/shell_extension_host_delegate.h"
#include "extensions/shell/browser/shell_extension_system_factory.h"
#include "extensions/shell/browser/shell_runtime_api_delegate.h"
-#include "extensions/shell/common/api/generated_api.h"
using content::BrowserContext;
diff --git a/extensions/shell/common/api/api.gyp b/extensions/shell/common/api/api.gyp
index 0353410..3421f05 100644
--- a/extensions/shell/common/api/api.gyp
+++ b/extensions/shell/common/api/api.gyp
@@ -7,29 +7,12 @@
{
'target_name': 'shell_api',
'type': 'static_library',
- 'sources': [
- '<@(schema_files)',
- ],
# TODO(jschuh): http://crbug.com/167187 size_t -> int
'msvs_disabled_warnings': [ 4267 ],
'includes': [
'../../../../build/json_schema_bundle_compile.gypi',
'../../../../build/json_schema_compile.gypi',
- ],
- 'variables': {
- 'chromium_code': 1,
- 'non_compiled_schema_files': [
- ],
- # TODO(thestig): Eliminate these on Android. See crbug.com/305852.
- 'schema_files': [
- 'shell.idl',
- ],
- 'cc_dir': 'extensions/shell/common/api',
- 'root_namespace': 'extensions::shell_api::%(namespace)s',
- 'impl_dir': 'extensions/shell/browser/api',
- },
- 'dependencies': [
- '<(DEPTH)/skia/skia.gyp:skia',
+ 'schemas.gypi',
],
},
],
diff --git a/extensions/shell/common/api/schemas.gypi b/extensions/shell/common/api/schemas.gypi
new file mode 100644
index 0000000..0524e13
--- /dev/null
+++ b/extensions/shell/common/api/schemas.gypi
@@ -0,0 +1,20 @@
+# 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.
+
+{
+ 'sources': [
+ '<@(schema_files)',
+ ],
+ 'variables': {
+ 'chromium_code': 1,
+ 'non_compiled_schema_files': [
+ ],
+ 'schema_files': [
+ 'shell.idl',
+ ],
+ 'cc_dir': 'extensions/shell/common/api',
+ 'root_namespace': 'extensions::shell_api::%(namespace)s',
+ 'impl_dir_': 'extensions/shell/browser/api',
+ },
+}
diff --git a/tools/json_schema_compiler/compiler.py b/tools/json_schema_compiler/compiler.py
index ff91ccf..38899286 100755
--- a/tools/json_schema_compiler/compiler.py
+++ b/tools/json_schema_compiler/compiler.py
@@ -30,9 +30,9 @@ from schema_loader import SchemaLoader
# Names of supported code generators, as specified on the command-line.
# First is default.
-GENERATORS = ['cpp', 'cpp-bundle', 'dart']
+GENERATORS = ['cpp', 'cpp-bundle-registration', 'cpp-bundle-schema', 'dart']
-def GenerateSchema(generator,
+def GenerateSchema(generator_name,
file_paths,
root,
destdir,
@@ -49,7 +49,7 @@ def GenerateSchema(generator,
api_def = schema_loader.LoadSchema(os.path.split(schema)[1])
# If compiling the C++ model code, delete 'nocompile' nodes.
- if generator == 'cpp':
+ if generator_name == 'cpp':
api_def = json_schema.DeleteNodes(api_def, 'nocompile')
api_defs.extend(api_def)
@@ -85,7 +85,7 @@ def GenerateSchema(generator,
type_generator = CppTypeGenerator(api_model,
schema_loader,
default_namespace)
- if generator == 'cpp-bundle':
+ if generator_name in ('cpp-bundle-registration', 'cpp-bundle-schema'):
cpp_bundle_generator = CppBundleGenerator(root,
api_model,
api_defs,
@@ -93,19 +93,24 @@ def GenerateSchema(generator,
cpp_namespace_pattern,
src_path,
impl_dir)
- generators = [
- ('generated_api.cc', cpp_bundle_generator.api_cc_generator),
- ('generated_api.h', cpp_bundle_generator.api_h_generator),
- ('generated_schemas.cc', cpp_bundle_generator.schemas_cc_generator),
- ('generated_schemas.h', cpp_bundle_generator.schemas_h_generator)
- ]
- elif generator == 'cpp':
+ if generator_name == 'cpp-bundle-registration':
+ generators = [
+ ('generated_api_registration.cc',
+ cpp_bundle_generator.api_cc_generator),
+ ('generated_api_registration.h', cpp_bundle_generator.api_h_generator),
+ ]
+ elif generator_name == 'cpp-bundle-schema':
+ generators = [
+ ('generated_schemas.cc', cpp_bundle_generator.schemas_cc_generator),
+ ('generated_schemas.h', cpp_bundle_generator.schemas_h_generator)
+ ]
+ elif generator_name == 'cpp':
cpp_generator = CppGenerator(type_generator, cpp_namespace_pattern)
generators = [
('%s.h' % filename_base, cpp_generator.h_generator),
('%s.cc' % filename_base, cpp_generator.cc_generator)
]
- elif generator == 'dart':
+ elif generator_name == 'dart':
generators = [
('%s.dart' % namespace.unix_name, DartGenerator(
dart_overrides_dir))
@@ -117,7 +122,12 @@ def GenerateSchema(generator,
for filename, generator in generators:
code = generator.Generate(namespace).Render()
if destdir:
- output_dir = os.path.join(destdir, src_path)
+ if generator_name == 'cpp-bundle-registration':
+ # Function registrations must be output to impl_dir, since they link in
+ # API implementations.
+ output_dir = os.path.join(destdir, impl_dir)
+ else:
+ output_dir = os.path.join(destdir, src_path)
if not os.path.exists(output_dir):
os.makedirs(output_dir)
with open(os.path.join(output_dir, filename), 'w') as f:
@@ -153,7 +163,8 @@ if __name__ == '__main__':
sys.exit(0) # This is OK as a no-op
# Unless in bundle mode, only one file should be specified.
- if opts.generator != 'cpp-bundle' and len(file_paths) > 1:
+ if (opts.generator not in ('cpp-bundle-registration', 'cpp-bundle-schema') and
+ len(file_paths) > 1):
# TODO(sashab): Could also just use file_paths[0] here and not complain.
raise Exception(
"Unless in bundle mode, only one file can be specified at a time.")
diff --git a/tools/json_schema_compiler/cpp_bundle_generator.py b/tools/json_schema_compiler/cpp_bundle_generator.py
index 62c754b..0a4f9a6 100644
--- a/tools/json_schema_compiler/cpp_bundle_generator.py
+++ b/tools/json_schema_compiler/cpp_bundle_generator.py
@@ -183,8 +183,9 @@ class _APICCGenerator(object):
c = code.Code()
c.Append(cpp_util.CHROMIUM_LICENSE)
c.Append()
- c.Append('#include "%s"' % (os.path.join(self._bundle._source_file_dir,
- 'generated_api.h')))
+ c.Append('#include "%s"' % (
+ os.path.join(self._bundle._impl_dir,
+ 'generated_api_registration.h')))
c.Append()
for namespace in self._bundle._model.namespaces.values():
namespace_name = namespace.unix_name.replace("experimental_", "")
diff --git a/ui/accessibility/BUILD.gn b/ui/accessibility/BUILD.gn
index 32a4f71..2628bce 100644
--- a/ui/accessibility/BUILD.gn
+++ b/ui/accessibility/BUILD.gn
@@ -77,6 +77,5 @@ generated_extensions_api("ax_gen") {
sources = [ "ax_enums.idl" ]
deps = [ "//base/third_party/dynamic_annotations" ]
root_namespace = "ui"
- impl_dir = "."
- bundle = true
+ schemas = true
}
diff --git a/ui/accessibility/accessibility.gyp b/ui/accessibility/accessibility.gyp
index 33032d7a..086f194 100644
--- a/ui/accessibility/accessibility.gyp
+++ b/ui/accessibility/accessibility.gyp
@@ -97,7 +97,6 @@
],
'msvs_disabled_warnings': [ 4267 ],
'includes': [
- '../../build/json_schema_bundle_compile.gypi',
'../../build/json_schema_compile.gypi',
],
'variables': {