diff --git a/BUILD.gn b/BUILD.gn index f1fcc7a77a8f04d738a028e234446948d186996d..05c39d444e58a67fbc0be59cacd9e451e133d091 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -46,4 +46,8 @@ group("sky_apk") { "//sky/services/intents", ] } + + if (is_linux) { + deps += [ "//sky/shell" ] + } } diff --git a/shell/BUILD.gn b/shell/BUILD.gn index 0299d77428137c4cc2613c04b2f4f789eb1c619f..b28c8f8bdfe0efdb13868802a601a6cde36c6174 100644 --- a/shell/BUILD.gn +++ b/shell/BUILD.gn @@ -37,6 +37,7 @@ source_set("common") { "gpu_delegate.h", "platform_view.cc", "platform_view.h", + "service_provider.cc", "service_provider.h", "shell.cc", "shell.h", @@ -169,6 +170,18 @@ if (is_android) { ":sky_resources", ] } +} else if (is_linux) { + executable("shell") { + output_name = "sky_shell" + + sources = [ + "linux/main.cc", + "linux/platform_service_provider_linux.cc", + "linux/platform_view_linux.cc", + ] + + deps = common_deps + [ ":common" ] + } } else { assert(false, "Unsupported platform") } diff --git a/shell/gpu/rasterizer.h b/shell/gpu/rasterizer.h index 84789143797d47ee31ba2f33a651a5f82a7994dc..a0aec6e6e43e40ab1982dc8c901ef67a5917160b 100644 --- a/shell/gpu/rasterizer.h +++ b/shell/gpu/rasterizer.h @@ -28,7 +28,7 @@ class GaneshSurface; class Rasterizer : public GPUDelegate { public: explicit Rasterizer(); - ~Rasterizer(); + ~Rasterizer() override; base::WeakPtr GetWeakPtr(); diff --git a/shell/linux/main.cc b/shell/linux/main.cc new file mode 100644 index 0000000000000000000000000000000000000000..a6b021bd7b18df11ea87886e56588a3f5d77e0c1 --- /dev/null +++ b/shell/linux/main.cc @@ -0,0 +1,49 @@ +// 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 "base/at_exit.h" +#include "base/basictypes.h" +#include "base/bind.h" +#include "base/command_line.h" +#include "base/i18n/icu_util.h" +#include "base/logging.h" +#include "base/message_loop/message_loop.h" +#include "sky/shell/platform_view.h" +#include "sky/shell/service_provider.h" +#include "sky/shell/shell.h" +#include "sky/shell/shell_view.h" + +namespace sky { +namespace shell { + +void Init() { + Shell::Init(make_scoped_ptr(new ServiceProviderContext( + base::MessageLoop::current()->task_runner()))); + + // TODO(abarth): Currently we leak the ShellView. + ShellView* shell_view = new ShellView(Shell::Shared()); + + ViewportObserverPtr viewport_observer; + shell_view->view()->ConnectToViewportObserver(GetProxy(&viewport_observer)); + + // TODO(abarth): At this point we should load some content into the view. + // viewport_observer->LoadURL("https://domokit.github.io/home.dart"); +} + +} // namespace shell +} // namespace sky + +int main(int argc, const char* argv[]) { + base::AtExitManager exit_manager; + base::CommandLine::Init(argc, argv); + + base::MessageLoop message_loop; + + base::i18n::InitializeICU(); + + message_loop.PostTask(FROM_HERE, base::Bind(&sky::shell::Init)); + message_loop.Run(); + + return 0; +} diff --git a/shell/linux/platform_service_provider_linux.cc b/shell/linux/platform_service_provider_linux.cc new file mode 100644 index 0000000000000000000000000000000000000000..e0199163d6b3430a95c1f98e7eaf3ad50655b604 --- /dev/null +++ b/shell/linux/platform_service_provider_linux.cc @@ -0,0 +1,22 @@ +// 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 "base/bind.h" +#include "base/trace_event/trace_event.h" +#include "mojo/public/cpp/bindings/interface_request.h" +#include "sky/shell/service_provider.h" + +namespace sky { +namespace shell { + +mojo::ServiceProviderPtr CreateServiceProvider( + ServiceProviderContext* context) { + mojo::MessagePipe pipe; + // TODO(abarth): Wire pipe.handle1 up to something. + return mojo::MakeProxy( + mojo::InterfacePtrInfo(pipe.handle0.Pass(), 0u)); +} + +} // namespace shell +} // namespace sky diff --git a/shell/linux/platform_view_linux.cc b/shell/linux/platform_view_linux.cc new file mode 100644 index 0000000000000000000000000000000000000000..73fee52ab70567a4eae019d0d59b7f3f25c54dab --- /dev/null +++ b/shell/linux/platform_view_linux.cc @@ -0,0 +1,15 @@ +// 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 "sky/shell/platform_view.h" + +namespace sky { +namespace shell { + +PlatformView* PlatformView::Create(const Config& config) { + return new PlatformView(config); +} + +} // namespace shell +} // namespace sky diff --git a/shell/platform_view.cc b/shell/platform_view.cc index 4050aed3101af1fb4cc18a6e8250a75fb672d5e8..0a6431dc5ee89205219b962c1b658baa67a4e2d4 100644 --- a/shell/platform_view.cc +++ b/shell/platform_view.cc @@ -11,6 +11,12 @@ namespace sky { namespace shell { +PlatformView::Config::Config() { +} + +PlatformView::Config::~Config() { +} + PlatformView::PlatformView(const PlatformView::Config& config) : config_(config), window_(0) { } diff --git a/shell/platform_view.h b/shell/platform_view.h index 4fb3618cc59e078cf5cc05ebede5d4a991a4ec57..b09980edf9ad2939ab2b8344e7c60eead555df4c 100644 --- a/shell/platform_view.h +++ b/shell/platform_view.h @@ -15,6 +15,9 @@ namespace shell { class PlatformView { public: struct Config { + Config(); + ~Config(); + base::WeakPtr ui_delegate; scoped_refptr ui_task_runner; }; diff --git a/shell/service_provider.cc b/shell/service_provider.cc new file mode 100644 index 0000000000000000000000000000000000000000..3b2b9ad1870c187dfce7e29d571a1229e25249da --- /dev/null +++ b/shell/service_provider.cc @@ -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. + +#include "sky/shell/service_provider.h" + +#include "base/single_thread_task_runner.h" + +namespace sky { +namespace shell { + +ServiceProviderContext::ServiceProviderContext( + scoped_refptr runner) + : platform_task_runner(runner.Pass()) {} + +ServiceProviderContext::~ServiceProviderContext() { +} + +} // namespace shell +} // namespace sky diff --git a/shell/service_provider.h b/shell/service_provider.h index f7c381808692686761205a39b8787a6bb48013e1..cff6b6cb85b17d879df7329db0c17bed61f76838 100644 --- a/shell/service_provider.h +++ b/shell/service_provider.h @@ -18,8 +18,8 @@ namespace shell { class ServiceProviderContext { public: - ServiceProviderContext(scoped_refptr runner) - : platform_task_runner(runner.Pass()) {} + ServiceProviderContext(scoped_refptr runner); + ~ServiceProviderContext(); scoped_refptr platform_task_runner; }; diff --git a/shell/ui/engine.cc b/shell/ui/engine.cc index edb0ad5227c50866e7e03c1d5c2a5e7d703d2923..726f1d3c6ef2c8dbc0ad1430ffa640f2a76013a0 100644 --- a/shell/ui/engine.cc +++ b/shell/ui/engine.cc @@ -37,6 +37,12 @@ PlatformImpl* g_platform_impl = nullptr; } +Engine::Config::Config() { +} + +Engine::Config::~Config() { +} + Engine::Engine(const Config& config) : config_(config), animator_(new Animator(config, this)), diff --git a/shell/ui/engine.h b/shell/ui/engine.h index d23b8eb80988da4e6ab9529b8b8ab7121afccc78..f11960590ed76625621412d08ad023c82f3d2a8c 100644 --- a/shell/ui/engine.h +++ b/shell/ui/engine.h @@ -39,6 +39,9 @@ class Engine : public UIDelegate, public blink::SkyViewClient { public: struct Config { + Config(); + ~Config(); + ServiceProviderContext* service_provider_context; base::WeakPtr gpu_delegate; diff --git a/shell/ui/internals.h b/shell/ui/internals.h index 7077e3e28b770be2e63fb6557a26db88ec013b19..0244f6235358b54bb0e592d6d702a39ccec51153 100644 --- a/shell/ui/internals.h +++ b/shell/ui/internals.h @@ -23,7 +23,7 @@ class Internals : public base::SupportsUserData::Data, public mojo::InterfaceFactory { public: - virtual ~Internals(); + ~Internals() override; static void Create(Dart_Isolate isolate, mojo::ServiceProviderPtr platform_service_provider);