Port sky_shell to Linux for testing
This CL makes it possible to build sky_shell on Linux. It doesn't do much, but it doesn't crash on startup. The goal is to evetually be able to test sky_shell on the bots and to be able to run the test_sky on Mac. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/1202323002.
This commit is contained in:
@@ -46,4 +46,8 @@ group("sky_apk") {
|
||||
"//sky/services/intents",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
deps += [ "//sky/shell" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class GaneshSurface;
|
||||
class Rasterizer : public GPUDelegate {
|
||||
public:
|
||||
explicit Rasterizer();
|
||||
~Rasterizer();
|
||||
~Rasterizer() override;
|
||||
|
||||
base::WeakPtr<Rasterizer> GetWeakPtr();
|
||||
|
||||
|
||||
49
engine/src/flutter/shell/linux/main.cc
Normal file
49
engine/src/flutter/shell/linux/main.cc
Normal file
@@ -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;
|
||||
}
|
||||
@@ -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<mojo::ServiceProvider>(pipe.handle0.Pass(), 0u));
|
||||
}
|
||||
|
||||
} // namespace shell
|
||||
} // namespace sky
|
||||
15
engine/src/flutter/shell/linux/platform_view_linux.cc
Normal file
15
engine/src/flutter/shell/linux/platform_view_linux.cc
Normal file
@@ -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
|
||||
@@ -11,6 +11,12 @@
|
||||
namespace sky {
|
||||
namespace shell {
|
||||
|
||||
PlatformView::Config::Config() {
|
||||
}
|
||||
|
||||
PlatformView::Config::~Config() {
|
||||
}
|
||||
|
||||
PlatformView::PlatformView(const PlatformView::Config& config)
|
||||
: config_(config), window_(0) {
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ namespace shell {
|
||||
class PlatformView {
|
||||
public:
|
||||
struct Config {
|
||||
Config();
|
||||
~Config();
|
||||
|
||||
base::WeakPtr<UIDelegate> ui_delegate;
|
||||
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner;
|
||||
};
|
||||
|
||||
20
engine/src/flutter/shell/service_provider.cc
Normal file
20
engine/src/flutter/shell/service_provider.cc
Normal file
@@ -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<base::SingleThreadTaskRunner> runner)
|
||||
: platform_task_runner(runner.Pass()) {}
|
||||
|
||||
ServiceProviderContext::~ServiceProviderContext() {
|
||||
}
|
||||
|
||||
} // namespace shell
|
||||
} // namespace sky
|
||||
@@ -18,8 +18,8 @@ namespace shell {
|
||||
|
||||
class ServiceProviderContext {
|
||||
public:
|
||||
ServiceProviderContext(scoped_refptr<base::SingleThreadTaskRunner> runner)
|
||||
: platform_task_runner(runner.Pass()) {}
|
||||
ServiceProviderContext(scoped_refptr<base::SingleThreadTaskRunner> runner);
|
||||
~ServiceProviderContext();
|
||||
|
||||
scoped_refptr<base::SingleThreadTaskRunner> platform_task_runner;
|
||||
};
|
||||
|
||||
@@ -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)),
|
||||
|
||||
@@ -39,6 +39,9 @@ class Engine : public UIDelegate,
|
||||
public blink::SkyViewClient {
|
||||
public:
|
||||
struct Config {
|
||||
Config();
|
||||
~Config();
|
||||
|
||||
ServiceProviderContext* service_provider_context;
|
||||
|
||||
base::WeakPtr<GPUDelegate> gpu_delegate;
|
||||
|
||||
@@ -23,7 +23,7 @@ class Internals
|
||||
: public base::SupportsUserData::Data,
|
||||
public mojo::InterfaceFactory<mojo::asset_bundle::AssetUnpacker> {
|
||||
public:
|
||||
virtual ~Internals();
|
||||
~Internals() override;
|
||||
|
||||
static void Create(Dart_Isolate isolate,
|
||||
mojo::ServiceProviderPtr platform_service_provider);
|
||||
|
||||
Reference in New Issue
Block a user