diff options
author | erg <erg@chromium.org> | 2015-10-16 13:45:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-16 20:46:59 +0000 |
commit | ebfb6860457a2e76d6f1290a3f4831577aa4bdd7 (patch) | |
tree | df24893f36d36aeb084a164623f0f58b7ed30e2e | |
parent | 1b4ef1a69b08dd2d779521118ddb1f3a285d4c83 (diff) | |
download | chromium_src-ebfb6860457a2e76d6f1290a3f4831577aa4bdd7.zip chromium_src-ebfb6860457a2e76d6f1290a3f4831577aa4bdd7.tar.gz chromium_src-ebfb6860457a2e76d6f1290a3f4831577aa4bdd7.tar.bz2 |
mandoline: Actually use mojo:tracing from core_services.
We previously made an application connection to tracing.mojo so we never
connected to the tracing app bundled into mojo:core_services. This
changes the timing so that we call a user supplied function to make
customizations to the package manager so that we can set a redirect for
mojo:tracing before invoking it, but still performing this after we
initialize the EDK.
BUG=534895
Review URL: https://codereview.chromium.org/1404353002
Cr-Commit-Position: refs/heads/master@{#354586}
-rw-r--r-- | components/web_view/test_runner/BUILD.gn | 2 | ||||
-rw-r--r-- | components/web_view/test_runner/register_local_aliases.cc | 14 | ||||
-rw-r--r-- | mandoline/app/android/BUILD.gn | 3 | ||||
-rw-r--r-- | mandoline/app/android/mandoline_context_init.cc | 2 | ||||
-rw-r--r-- | mandoline/app/core_services_initialization.h | 21 | ||||
-rw-r--r-- | mandoline/app/desktop/BUILD.gn | 3 | ||||
-rw-r--r-- | mandoline/app/desktop/launcher_process.cc | 2 | ||||
-rw-r--r-- | mandoline/app/register_local_aliases.cc (renamed from mandoline/app/core_services_initialization.cc) | 13 | ||||
-rw-r--r-- | mojo/runner/BUILD.gn | 17 | ||||
-rw-r--r-- | mojo/runner/context.cc | 3 | ||||
-rw-r--r-- | mojo/runner/register_local_aliases.cc | 13 | ||||
-rw-r--r-- | mojo/runner/register_local_aliases.h | 20 |
12 files changed, 79 insertions, 34 deletions
diff --git a/components/web_view/test_runner/BUILD.gn b/components/web_view/test_runner/BUILD.gn index 6ae3da7..96434bf 100644 --- a/components/web_view/test_runner/BUILD.gn +++ b/components/web_view/test_runner/BUILD.gn @@ -13,6 +13,7 @@ executable("test_runner") { "launcher.cc", "launcher.h", "main.cc", + "register_local_aliases.cc", ] deps = [ @@ -21,6 +22,7 @@ executable("test_runner") { "//mojo/common", "//mojo/environment:chromium", "//mojo/runner:lib", + "//mojo/runner:register_local_aliases_fwd", "//url", ] diff --git a/components/web_view/test_runner/register_local_aliases.cc b/components/web_view/test_runner/register_local_aliases.cc new file mode 100644 index 0000000..add0a51 --- /dev/null +++ b/components/web_view/test_runner/register_local_aliases.cc @@ -0,0 +1,14 @@ +// 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. + +#include "mojo/runner/register_local_aliases.h" + +namespace mojo { +namespace runner { + +void RegisterLocalAliases(mojo::package_manager::PackageManagerImpl* manager) { +} + +} // namespace runner +} // namespace mojo diff --git a/mandoline/app/android/BUILD.gn b/mandoline/app/android/BUILD.gn index 3823c04..d986ec3 100644 --- a/mandoline/app/android/BUILD.gn +++ b/mandoline/app/android/BUILD.gn @@ -27,11 +27,12 @@ executable("mandoline_runner") { "//mojo/package_manager", "//mojo/runner:lib", "//mojo/runner:mojo_runner_lib", + "//mojo/runner:register_local_aliases_fwd", "//mojo/shell", ] sources = [ - "../core_services_initialization.cc", + "../register_local_aliases.cc", "mandoline_activity.cc", "mandoline_context_init.cc", ] diff --git a/mandoline/app/android/mandoline_context_init.cc b/mandoline/app/android/mandoline_context_init.cc index bdbdb83..fa60c9ce 100644 --- a/mandoline/app/android/mandoline_context_init.cc +++ b/mandoline/app/android/mandoline_context_init.cc @@ -5,14 +5,12 @@ #include "base/bind.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" -#include "mandoline/app/core_services_initialization.h" #include "mojo/runner/context.h" namespace mojo { namespace runner { void InitContext(Context* context) { - mandoline::InitCoreServicesForContext(context); base::MessageLoopForUI::current()->PostTask( FROM_HERE, base::Bind(&Context::Run, diff --git a/mandoline/app/core_services_initialization.h b/mandoline/app/core_services_initialization.h deleted file mode 100644 index e8601de..0000000 --- a/mandoline/app/core_services_initialization.h +++ /dev/null @@ -1,21 +0,0 @@ -// 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. - -#ifndef MANDOLINE_APP_CORE_SERVICES_INITIALIZATION_H_ -#define MANDOLINE_APP_CORE_SERVICES_INITIALIZATION_H_ - -namespace mojo { -namespace runner { -class Context; -} -} - -namespace mandoline { - -// Sets up the aliases that forward applications to core_services. -void InitCoreServicesForContext(mojo::runner::Context* context); - -} // namespace mandoline - -#endif // MANDOLINE_APP_CORE_SERVICES_INITIALIZATION_H_ diff --git a/mandoline/app/desktop/BUILD.gn b/mandoline/app/desktop/BUILD.gn index 6860a0d..d72fb60 100644 --- a/mandoline/app/desktop/BUILD.gn +++ b/mandoline/app/desktop/BUILD.gn @@ -10,7 +10,7 @@ group("desktop") { executable("mandoline") { sources = [ - "../core_services_initialization.cc", + "../register_local_aliases.cc", "launcher_process.cc", "launcher_process.h", "main.cc", @@ -24,6 +24,7 @@ executable("mandoline") { "//mojo/environment:chromium", "//mojo/package_manager", "//mojo/runner:lib", + "//mojo/runner:register_local_aliases_fwd", ] data_deps = [ diff --git a/mandoline/app/desktop/launcher_process.cc b/mandoline/app/desktop/launcher_process.cc index 34e4435..2424045 100644 --- a/mandoline/app/desktop/launcher_process.cc +++ b/mandoline/app/desktop/launcher_process.cc @@ -18,7 +18,6 @@ #include "base/trace_event/trace_event.h" #include "components/tracing/trace_config_file.h" #include "components/tracing/tracing_switches.h" -#include "mandoline/app/core_services_initialization.h" #include "mandoline/app/desktop/launcher_process.h" #include "mojo/runner/context.h" #include "mojo/runner/switches.h" @@ -108,7 +107,6 @@ int LauncherProcessMain(int argc, char** argv) { if (!shell_context.Init()) { return 0; } - InitCoreServicesForContext(&shell_context); if (g_tracing) { message_loop.PostDelayedTask(FROM_HERE, base::Bind(StopTracingAndFlushToDisk), diff --git a/mandoline/app/core_services_initialization.cc b/mandoline/app/register_local_aliases.cc index b56343d..f71abfa 100644 --- a/mandoline/app/core_services_initialization.cc +++ b/mandoline/app/register_local_aliases.cc @@ -2,18 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "mandoline/app/core_services_initialization.h" +#include "mojo/runner/register_local_aliases.h" #include "mojo/package_manager/package_manager_impl.h" -#include "mojo/runner/context.h" -namespace mandoline { +namespace mojo { +namespace runner { -void InitCoreServicesForContext(mojo::runner::Context* context) { +void RegisterLocalAliases(mojo::package_manager::PackageManagerImpl* manager) { // TODO(erg): We should probably handle this differently; these could be // autogenerated from package manifests. - mojo::package_manager::PackageManagerImpl* manager = - context->package_manager(); manager->RegisterApplicationPackageAlias( GURL("mojo:clipboard"), GURL("mojo:core_services"), "Core"); manager->RegisterApplicationPackageAlias(GURL("mojo:filesystem"), @@ -46,4 +44,5 @@ void InitCoreServicesForContext(mojo::runner::Context* context) { GURL("mojo:tracing"), GURL("mojo:core_services"), "Core"); } -} // namespace mandoline +} // namespace runner +} // namespace mojo diff --git a/mojo/runner/BUILD.gn b/mojo/runner/BUILD.gn index dc61e16..0bb4986 100644 --- a/mojo/runner/BUILD.gn +++ b/mojo/runner/BUILD.gn @@ -24,6 +24,12 @@ if (is_android) { import("//build/config/android/rules.gni") } +source_set("register_local_aliases_fwd") { + sources = [ + "register_local_aliases.h", + ] +} + source_set("mojo_runner_lib") { sources = [] @@ -41,6 +47,8 @@ source_set("mojo_runner_lib") { "desktop/launcher_process.cc", "desktop/launcher_process.h", "desktop/main.cc", + "register_local_aliases.cc", + "register_local_aliases.h", ] deps += [ "//components/tracing:startup_tracing" ] } else { @@ -71,6 +79,13 @@ executable("mojo_runner") { if (is_android) { sources = [ "android/context_init.cc", + "register_local_aliases.cc", + ] + + deps += [ + ":lib", + ":register_local_aliases_fwd", + "//third_party/mojo/src/mojo/edk/system", ] # On android, the executable is also the native library used by the apk. @@ -425,6 +440,8 @@ test("mojo_runner_unittests") { "data_pipe_peek_unittest.cc", "in_process_native_runner_unittest.cc", "native_runner_unittest.cc", + "register_local_aliases.cc", + "register_local_aliases.h", "shell_test_base.cc", "shell_test_base.h", "shell_test_base_android.cc", diff --git a/mojo/runner/context.cc b/mojo/runner/context.cc index 462ed84..9858789 100644 --- a/mojo/runner/context.cc +++ b/mojo/runner/context.cc @@ -30,6 +30,7 @@ #include "mojo/package_manager/package_manager_impl.h" #include "mojo/runner/in_process_native_runner.h" #include "mojo/runner/out_of_process_native_runner.h" +#include "mojo/runner/register_local_aliases.h" #include "mojo/runner/switches.h" #include "mojo/services/tracing/public/cpp/switches.h" #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" @@ -199,6 +200,8 @@ bool Context::Init() { shell_file_root_, task_runners_->blocking_pool()); InitContentHandlers(package_manager_, command_line); + RegisterLocalAliases(package_manager_); + scoped_ptr<shell::NativeRunnerFactory> runner_factory; if (command_line.HasSwitch(switches::kEnableMultiprocess)) runner_factory.reset(new OutOfProcessNativeRunnerFactory(this)); diff --git a/mojo/runner/register_local_aliases.cc b/mojo/runner/register_local_aliases.cc new file mode 100644 index 0000000..7411453 --- /dev/null +++ b/mojo/runner/register_local_aliases.cc @@ -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. + +#include "mojo/runner/register_local_aliases.h" + +namespace mojo { +namespace runner { + +void RegisterLocalAliases(mojo::package_manager::PackageManagerImpl* manager) {} + +} // namespace runner +} // namespace mojo diff --git a/mojo/runner/register_local_aliases.h b/mojo/runner/register_local_aliases.h new file mode 100644 index 0000000..1969f60 --- /dev/null +++ b/mojo/runner/register_local_aliases.h @@ -0,0 +1,20 @@ +// 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. + +#ifndef MOJO_RUNNER_REGISTER_LOCAL_ALIASES_H_ +#define MOJO_RUNNER_REGISTER_LOCAL_ALIASES_H_ + +namespace mojo { +namespace package_manager { +class PackageManagerImpl; +} + +namespace runner { + +void RegisterLocalAliases(mojo::package_manager::PackageManagerImpl* manager); + +} // namespace runner +} // namespace mojo + +#endif // MOJO_RUNNER_REGISTER_LOCAL_ALIASES_H_ |