diff options
author | sky <sky@chromium.org> | 2014-10-15 18:20:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-16 01:21:09 +0000 |
commit | b6afb358781de8a6cbdd1b9f45ee00ca4f70581c (patch) | |
tree | 2b728cd7bc82d6e9a9d31e735a59700956d3d9bf | |
parent | bbfc79526e5600effeac327bdff9c6de323897a7 (diff) | |
download | chromium_src-b6afb358781de8a6cbdd1b9f45ee00ca4f70581c.zip chromium_src-b6afb358781de8a6cbdd1b9f45ee00ca4f70581c.tar.gz chromium_src-b6afb358781de8a6cbdd1b9f45ee00ca4f70581c.tar.bz2 |
Make wm_flow_init work with gn
Two sets of changes:
. fix gn dependencies
. make views_init work in the static library
The latter means wm_flow_init and demo_launcher only work with gn (not gyp).
BUG=none
TEST=none
R=ben@chromium.org
Review URL: https://codereview.chromium.org/658753004
Cr-Commit-Position: refs/heads/master@{#299807}
-rw-r--r-- | mojo/examples/browser/BUILD.gn | 2 | ||||
-rw-r--r-- | mojo/examples/demo_launcher/demo_launcher.cc | 7 | ||||
-rw-r--r-- | mojo/examples/keyboard/BUILD.gn | 2 | ||||
-rw-r--r-- | mojo/examples/media_viewer/BUILD.gn | 2 | ||||
-rw-r--r-- | mojo/examples/window_manager/BUILD.gn | 2 | ||||
-rw-r--r-- | mojo/examples/wm_flow/BUILD.gn | 13 | ||||
-rw-r--r-- | mojo/examples/wm_flow/init/init.cc | 3 | ||||
-rw-r--r-- | mojo/examples/wm_flow/wm/wm.cc | 7 | ||||
-rw-r--r-- | mojo/mojo.gyp | 28 | ||||
-rw-r--r-- | mojo/services/window_manager/BUILD.gn | 15 | ||||
-rw-r--r-- | mojo/views/BUILD.gn | 28 | ||||
-rw-r--r-- | mojo/views/mojo_views_export.h | 29 | ||||
-rw-r--r-- | mojo/views/views_init.cc | 38 | ||||
-rw-r--r-- | mojo/views/views_init_internal.cc | 49 | ||||
-rw-r--r-- | mojo/views/views_init_internal.h | 19 |
15 files changed, 70 insertions, 174 deletions
diff --git a/mojo/examples/browser/BUILD.gn b/mojo/examples/browser/BUILD.gn index 3228870..b0b1780 100644 --- a/mojo/examples/browser/BUILD.gn +++ b/mojo/examples/browser/BUILD.gn @@ -29,7 +29,7 @@ shared_library("browser") { "//mojo/services/public/interfaces/input_events", "//mojo/services/public/interfaces/navigation", "//mojo/services/public/interfaces/view_manager", - "//mojo/views", + "//mojo/views:views", "//third_party/icu", "//ui/aura", "//ui/base", diff --git a/mojo/examples/demo_launcher/demo_launcher.cc b/mojo/examples/demo_launcher/demo_launcher.cc index ec46265..2165e2e 100644 --- a/mojo/examples/demo_launcher/demo_launcher.cc +++ b/mojo/examples/demo_launcher/demo_launcher.cc @@ -2,16 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" -#include "base/bind.h" -#include "base/run_loop.h" #include "mojo/application/application_runner_chromium.h" #include "mojo/public/c/system/main.h" -#include "mojo/public/cpp/application/application_connection.h" #include "mojo/public/cpp/application/application_delegate.h" -#include "mojo/public/cpp/application/application_impl.h" -#include "mojo/public/cpp/application/service_provider_impl.h" -#include "mojo/public/interfaces/application/service_provider.mojom.h" #include "mojo/services/public/cpp/view_manager/view_manager.h" #include "mojo/services/public/cpp/view_manager/view_manager_context.h" diff --git a/mojo/examples/keyboard/BUILD.gn b/mojo/examples/keyboard/BUILD.gn index 19c5ab0..2feabcc 100644 --- a/mojo/examples/keyboard/BUILD.gn +++ b/mojo/examples/keyboard/BUILD.gn @@ -34,7 +34,7 @@ shared_library("keyboard") { "//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/navigation", "//mojo/services/public/interfaces/view_manager", - "//mojo/views", + "//mojo/views:views", "//third_party/icu", "//ui/aura", "//ui/base", diff --git a/mojo/examples/media_viewer/BUILD.gn b/mojo/examples/media_viewer/BUILD.gn index cbac84d..b251b2d 100644 --- a/mojo/examples/media_viewer/BUILD.gn +++ b/mojo/examples/media_viewer/BUILD.gn @@ -24,7 +24,7 @@ shared_library("media_viewer") { "//mojo/services/public/cpp/view_manager", "//mojo/services/public/interfaces/navigation", "//mojo/services/public/interfaces/view_manager", - "//mojo/views", + "//mojo/views:views", "//skia", "//ui/gfx", "//ui/gfx/geometry", diff --git a/mojo/examples/window_manager/BUILD.gn b/mojo/examples/window_manager/BUILD.gn index a6283c9..72bdd9d 100644 --- a/mojo/examples/window_manager/BUILD.gn +++ b/mojo/examples/window_manager/BUILD.gn @@ -34,7 +34,7 @@ shared_library("window_manager") { "//mojo/services/public/interfaces/input_events", "//mojo/services/public/interfaces/navigation", "//mojo/services/window_manager:lib", - "//mojo/views", + "//mojo/views:views", "//ui/aura", "//ui/base", "//ui/gfx", diff --git a/mojo/examples/wm_flow/BUILD.gn b/mojo/examples/wm_flow/BUILD.gn index 50ce507..9a4c498 100644 --- a/mojo/examples/wm_flow/BUILD.gn +++ b/mojo/examples/wm_flow/BUILD.gn @@ -7,7 +7,7 @@ import("//mojo/public/tools/bindings/mojom.gni") assert(use_aura) -group("wm_flow" ) { +group("wm_flow") { deps = [ ":app", ":embedded", @@ -28,11 +28,16 @@ shared_library("wm") { deps = [ "//base", + "//skia", + "//ui/aura", + "//ui/views", + "//ui/wm:wm", "//mojo/application", "//mojo/public/c/system:for_shared_library", "//mojo/services/public/cpp/view_manager", + "//mojo/services/public/interfaces/input_events", "//mojo/services/window_manager:lib", - "//mojo/views", + "//mojo/views:views", ] } @@ -46,8 +51,11 @@ shared_library("init") { deps = [ "//base", + "//ui/gfx", + "//ui/gfx/geometry", "//mojo/application", "//mojo/public/c/system:for_shared_library", + "//mojo/public/interfaces/application:application", "//mojo/services/public/cpp/view_manager", "//mojo/services/public/interfaces/view_manager", ] @@ -68,6 +76,7 @@ shared_library("app") { "//mojo/application", "//mojo/examples/bitmap_uploader", "//mojo/public/c/system:for_shared_library", + "//mojo/public/interfaces/application:application", "//mojo/services/public/cpp/view_manager", "//mojo/services/window_manager:lib", ] diff --git a/mojo/examples/wm_flow/init/init.cc b/mojo/examples/wm_flow/init/init.cc index ba17b44..daef4ea 100644 --- a/mojo/examples/wm_flow/init/init.cc +++ b/mojo/examples/wm_flow/init/init.cc @@ -2,13 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/bind.h" #include "mojo/application/application_runner_chromium.h" #include "mojo/public/c/system/main.h" #include "mojo/public/cpp/application/application_delegate.h" #include "mojo/public/cpp/application/application_impl.h" -#include "mojo/public/cpp/application/service_provider_impl.h" -#include "mojo/public/interfaces/application/service_provider.mojom.h" #include "mojo/services/public/cpp/view_manager/view_manager.h" #include "mojo/services/public/cpp/view_manager/view_manager_context.h" diff --git a/mojo/examples/wm_flow/wm/wm.cc b/mojo/examples/wm_flow/wm/wm.cc index b781f60..228f04f 100644 --- a/mojo/examples/wm_flow/wm/wm.cc +++ b/mojo/examples/wm_flow/wm/wm.cc @@ -102,6 +102,10 @@ class SimpleWM : public mojo::ApplicationDelegate, private: // Overridden from mojo::ApplicationDelegate: virtual void Initialize(mojo::ApplicationImpl* impl) override { + // Create views_init here as we need ApplicationRunnerChromium to install + // an AtExitManager and CommandLine. + if (!views_init_.get()) + views_init_.reset(new mojo::ViewsInit); shell_ = impl->shell(); window_manager_app_->Initialize(impl); } @@ -183,6 +187,8 @@ class SimpleWM : public mojo::ApplicationDelegate, mojo::Shell* shell_; + scoped_ptr<mojo::ViewsInit> views_init_; + scoped_ptr<mojo::WindowManagerApp> window_manager_app_; mojo::ViewManager* view_manager_; @@ -197,7 +203,6 @@ class SimpleWM : public mojo::ApplicationDelegate, } // namespace examples MojoResult MojoMain(MojoHandle shell_handle) { - mojo::ViewsInit views_init; mojo::ApplicationRunnerChromium runner(new examples::SimpleWM); return runner.Run(shell_handle); } diff --git a/mojo/mojo.gyp b/mojo/mojo.gyp index 13d46ce..e3c769f 100644 --- a/mojo/mojo.gyp +++ b/mojo/mojo.gyp @@ -532,21 +532,22 @@ ], }, { - # GN version: //mojo/views + # GN version: //mojo/views:views 'target_name': 'mojo_views_support', 'type': 'static_library', 'dependencies': [ '../base/base.gyp:base', '../base/base.gyp:base_i18n', + '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../skia/skia.gyp:skia', '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', '../ui/aura/aura.gyp:aura', '../ui/base/ui_base.gyp:ui_base', + '../ui/gfx/gfx.gyp:gfx', '../ui/views/views.gyp:views', '../ui/wm/wm.gyp:wm', 'mojo_aura_support', - 'mojo_views_support_internal', 'mojo_view_manager_lib', 'services/public/mojo_services_public.gyp:mojo_view_manager_bindings', ], @@ -560,29 +561,6 @@ ], }, { - # GN version: //mojo/views:views_internal - 'target_name': 'mojo_views_support_internal', - 'type': '<(component)', - 'dependencies': [ - '../base/base.gyp:base', - '../base/base.gyp:base_i18n', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - '../skia/skia.gyp:skia', - '../third_party/icu/icu.gyp:icui18n', - '../third_party/icu/icu.gyp:icuuc', - '../ui/base/ui_base.gyp:ui_base', - '../ui/gfx/gfx.gyp:gfx', - ], - 'sources': [ - 'views/mojo_views_export.h', - 'views/views_init_internal.cc', - 'views/views_init_internal.h', - ], - 'defines': [ - 'MOJO_VIEWS_IMPLEMENTATION', - ], - }, - { # GN version: //mojo/services/public/cpp/view_manager/lib:run_unittests 'target_name': 'mojo_view_manager_run_unittests', 'type': 'static_library', diff --git a/mojo/services/window_manager/BUILD.gn b/mojo/services/window_manager/BUILD.gn index 02f3a8e..98a8b36 100644 --- a/mojo/services/window_manager/BUILD.gn +++ b/mojo/services/window_manager/BUILD.gn @@ -40,21 +40,18 @@ source_set("lib") { ] deps = [ "//base", + "//ui/base", + "//ui/gfx", + "//ui/gfx/geometry", + "//ui/wm", + "//mojo/aura", "//mojo/application", "//mojo/common", "//mojo/converters/input_events", - "//mojo/environment:chromium", - "//mojo/public/cpp/bindings", - "//mojo/public/interfaces/application:application", "//mojo/services/public/cpp/view_manager", + "//mojo/public/interfaces/application:application", "//mojo/services/public/interfaces/window_manager", "//mojo/services/public/interfaces/window_manager2", - "//ui/aura", - "//ui/base", - "//ui/events", - "//ui/gfx", - "//ui/gfx/geometry", - "//ui/wm", ] } diff --git a/mojo/views/BUILD.gn b/mojo/views/BUILD.gn index 506a7ed..af47764 100644 --- a/mojo/views/BUILD.gn +++ b/mojo/views/BUILD.gn @@ -7,7 +7,7 @@ import("//build/config/ui.gni") assert(use_aura) # GYP version: mojo/mojo.gyp:mojo_views_support -source_set("views") { +static_library("views") { sources = [ "input_method_mojo_linux.cc", "input_method_mojo_linux.h", @@ -26,36 +26,14 @@ source_set("views") { ] deps = [ - ":views_internal", - "//base", - "//base:i18n", - "//third_party/icu", - "//ui/aura", - "//ui/wm", - ] -} - -# GYP version: mojo/mojo.gyp:mojo_views_support_internal -component("views_internal") { - output_name = "mojo_views_support_internal" - - visibility = [ ":views" ] - - sources = [ - "mojo_views_export.h", - "views_init_internal.cc", - "views_init_internal.h", - ] - - defines = [ "MOJO_VIEWS_IMPLEMENTATION" ] - - deps = [ "//base", "//base:i18n", "//base/third_party/dynamic_annotations", "//skia", "//third_party/icu", + "//ui/aura", "//ui/base", "//ui/gfx", + "//ui/wm", ] } diff --git a/mojo/views/mojo_views_export.h b/mojo/views/mojo_views_export.h deleted file mode 100644 index 0ca8985..0000000 --- a/mojo/views/mojo_views_export.h +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -#ifndef MOJO_VIEWS_MOJO_VIEWS_EXPORT_H_ -#define MOJO_VIEWS_MOJO_VIEWS_EXPORT_H_ - -#if defined(COMPONENT_BUILD) -#if defined(WIN32) - -#if defined(MOJO_VIEWS_IMPLEMENTATION) -#define MOJO_VIEWS_EXPORT __declspec(dllexport) -#else -#define MOJO_VIEWS_EXPORT __declspec(dllimport) -#endif // defined(MOJO_VIEWS_IMPLEMENTATION) - -#else // defined(WIN32) -#if defined(MOJO_VIEWS_IMPLEMENTATION) -#define MOJO_VIEWS_EXPORT __attribute__((visibility("default"))) -#else -#define MOJO_VIEWS_EXPORT -#endif -#endif - -#else // defined(COMPONENT_BUILD) -#define MOJO_VIEWS_EXPORT -#endif - -#endif // MOJO_VIEWS_MOJO_VIEWS_EXPORT_H_ diff --git a/mojo/views/views_init.cc b/mojo/views/views_init.cc index edd8af3..fa2ef54 100644 --- a/mojo/views/views_init.cc +++ b/mojo/views/views_init.cc @@ -4,10 +4,46 @@ #include "mojo/views/views_init.h" -#include "mojo/views/views_init_internal.h" +#include "base/i18n/icu_util.h" +#include "base/lazy_instance.h" +#include "base/path_service.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_paths.h" namespace mojo { +namespace { +// Used to ensure we only init once. +class Setup { + public: + Setup() { + base::i18n::InitializeICU(); + + ui::RegisterPathProvider(); + + base::FilePath ui_test_pak_path; + CHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); + ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); + + // There is a bunch of static state in gfx::Font, by running this now, + // before any other apps load, we ensure all the state is set up. + gfx::Font(); + } + + ~Setup() { + } + + private: + DISALLOW_COPY_AND_ASSIGN(Setup); +}; + +static base::LazyInstance<Setup>::Leaky setup = LAZY_INSTANCE_INITIALIZER; + +} // namespace + +void InitViews() { + setup.Get(); +} ViewsInit::ViewsInit() { InitViews(); } diff --git a/mojo/views/views_init_internal.cc b/mojo/views/views_init_internal.cc deleted file mode 100644 index 6d92c7c..0000000 --- a/mojo/views/views_init_internal.cc +++ /dev/null @@ -1,49 +0,0 @@ -// 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. - -#include "mojo/views/views_init_internal.h" - -#include "base/i18n/icu_util.h" -#include "base/lazy_instance.h" -#include "base/path_service.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/base/ui_base_paths.h" - -namespace mojo { - -namespace { - -// Used to ensure we only init once. -class Setup { - public: - Setup() { - base::i18n::InitializeICU(); - - ui::RegisterPathProvider(); - - base::FilePath ui_test_pak_path; - CHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); - ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); - - // There is a bunch of static state in gfx::Font, by running this now, - // before any other apps load, we ensure all the state is set up. - gfx::Font(); - } - - ~Setup() { - } - - private: - DISALLOW_COPY_AND_ASSIGN(Setup); -}; - -static base::LazyInstance<Setup>::Leaky setup = LAZY_INSTANCE_INITIALIZER; - -} // namespace - -void InitViews() { - setup.Get(); -} - -} // namespace mojo diff --git a/mojo/views/views_init_internal.h b/mojo/views/views_init_internal.h deleted file mode 100644 index 5ec66e7..0000000 --- a/mojo/views/views_init_internal.h +++ /dev/null @@ -1,19 +0,0 @@ -// 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. - -#ifndef MOJO_VIEWS_VIEWS_INIT_INTERNAL_H_ -#define MOJO_VIEWS_VIEWS_INIT_INTERNAL_H_ - -#include "mojo/views/mojo_views_export.h" - -namespace mojo { - -// This is in a separate target so that we only initialize some common state -// once. -// Do not use this, it is called internally by ViewsInit. -MOJO_VIEWS_EXPORT void InitViews(); - -} // namespace mojo - -#endif // MOJO_VIEWS_VIEWS_INIT_INTERNAL_H_ |