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

Side by Side 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, 5 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/trace_event/trace_event.h" 6 #include "base/bind_helpers.h"
7 #include "mojo/public/cpp/bindings/interface_request.h" 7 #include "base/lazy_instance.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "mojo/public/cpp/application/service_provider_impl.h"
8 #include "sky/shell/service_provider.h" 11 #include "sky/shell/service_provider.h"
12 #include "sky/shell/testing/test_runner.h"
9 13
10 namespace sky { 14 namespace sky {
11 namespace shell { 15 namespace shell {
16 namespace {
17
18 base::LazyInstance<scoped_ptr<mojo::ServiceProviderImpl>> g_service_provider =
19 LAZY_INSTANCE_INITIALIZER;
20
21 static void CreateServiceProviderImpl(
22 mojo::InterfaceRequest<mojo::ServiceProvider> request) {
23 g_service_provider.Get().reset(new mojo::ServiceProviderImpl(request.Pass()));
24 g_service_provider.Get()->AddService(&TestRunner::Shared());
25 }
26
27 } // namespace
12 28
13 mojo::ServiceProviderPtr CreateServiceProvider( 29 mojo::ServiceProviderPtr CreateServiceProvider(
14 ServiceProviderContext* context) { 30 ServiceProviderContext* context) {
31 DCHECK(context);
15 mojo::MessagePipe pipe; 32 mojo::MessagePipe pipe;
16 // TODO(abarth): Wire pipe.handle1 up to something. 33 auto request = mojo::MakeRequest<mojo::ServiceProvider>(pipe.handle1.Pass());
34 context->platform_task_runner->PostTask(
35 FROM_HERE, base::Bind(CreateServiceProviderImpl, base::Passed(&request)));
17 return mojo::MakeProxy( 36 return mojo::MakeProxy(
18 mojo::InterfacePtrInfo<mojo::ServiceProvider>(pipe.handle0.Pass(), 0u)); 37 mojo::InterfacePtrInfo<mojo::ServiceProvider>(pipe.handle0.Pass(), 0u));
19 } 38 }
20 39
21 } // namespace shell 40 } // namespace shell
22 } // namespace sky 41 } // namespace sky
OLDNEW
« 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