提交 31cf589b 编写于 作者: A Adam Barth

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.
上级 2f7934a7
......@@ -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();
......
// 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;
}
// 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
// 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;
};
......
// 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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册