Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Unified Diff: sky/shell/linux/platform_service_provider_linux.cc

Issue 1218633003: Make it possible to run a test in sky_shell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: address reviewer comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/shell/linux/main.cc ('k') | sky/shell/testing/test_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/linux/platform_service_provider_linux.cc
diff --git a/sky/shell/linux/platform_service_provider_linux.cc b/sky/shell/linux/platform_service_provider_linux.cc
index e0199163d6b3430a95c1f98e7eaf3ad50655b604..8bc64cc336758c703b2bdc0efc7d09d5c42c7028 100644
--- a/sky/shell/linux/platform_service_provider_linux.cc
+++ b/sky/shell/linux/platform_service_provider_linux.cc
@@ -3,17 +3,36 @@
// 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 "base/bind_helpers.h"
+#include "base/lazy_instance.h"
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
+#include "mojo/public/cpp/application/service_provider_impl.h"
#include "sky/shell/service_provider.h"
+#include "sky/shell/testing/test_runner.h"
namespace sky {
namespace shell {
+namespace {
+
+base::LazyInstance<scoped_ptr<mojo::ServiceProviderImpl>> g_service_provider =
+ LAZY_INSTANCE_INITIALIZER;
+
+static void CreateServiceProviderImpl(
+ mojo::InterfaceRequest<mojo::ServiceProvider> request) {
+ g_service_provider.Get().reset(new mojo::ServiceProviderImpl(request.Pass()));
+ g_service_provider.Get()->AddService(&TestRunner::Shared());
+}
+
+} // namespace
mojo::ServiceProviderPtr CreateServiceProvider(
ServiceProviderContext* context) {
+ DCHECK(context);
mojo::MessagePipe pipe;
- // TODO(abarth): Wire pipe.handle1 up to something.
+ auto request = mojo::MakeRequest<mojo::ServiceProvider>(pipe.handle1.Pass());
+ context->platform_task_runner->PostTask(
+ FROM_HERE, base::Bind(CreateServiceProviderImpl, base::Passed(&request)));
return mojo::MakeProxy(
mojo::InterfacePtrInfo<mojo::ServiceProvider>(pipe.handle0.Pass(), 0u));
}
« no previous file with comments | « sky/shell/linux/main.cc ('k') | sky/shell/testing/test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698