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

Side by Side Diff: sky/shell/ios/platform_service_provider_ios.cc

Issue 1171573002: Basic Sky shell for iOS targets (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "sky/engine/config.h"
6 #include "sky/engine/wtf/Assertions.h"
abarth-chromium 2015/06/05 22:56:09 You shouldn't need to include any of these headers
7 #include "sky/shell/service_provider.h"
8 #include "base/single_thread_task_runner.h"
9 #include "base/bind.h"
10 #include "base/bind_helpers.h"
11 #include "base/lazy_instance.h"
12 #include "base/location.h"
13 #include "mojo/public/cpp/application/service_provider_impl.h"
14 #include "sky/services/ns_net/network_service_impl.h"
15
16 namespace sky {
17 namespace shell {
18
19 // FIXME(csg): Put this in an application owned context
20 base::LazyInstance<scoped_ptr<mojo::ServiceProviderImpl>> g_service_provider =
21 LAZY_INSTANCE_INITIALIZER;
22 base::LazyInstance<scoped_ptr<mojo::NetworkServiceFactory>>
23 g_network_service_factory = LAZY_INSTANCE_INITIALIZER;
24
25 static void CreatePlatformServiceProvider(
26 mojo::InterfaceRequest<mojo::ServiceProvider> request) {
27 g_service_provider.Get().reset(new mojo::ServiceProviderImpl(request.Pass()));
28 g_network_service_factory.Get().reset(new mojo::NetworkServiceFactory());
29 g_service_provider.Get()->AddService(g_network_service_factory.Get().get());
30 }
31
32 mojo::ServiceProviderPtr CreateServiceProvider(
33 ServiceProviderContext* context) {
34 DCHECK(context);
35 mojo::MessagePipe pipe;
abarth-chromium 2015/06/05 22:56:09 I suspect there's a fancier way do this without me
36 auto request = mojo::MakeRequest<mojo::ServiceProvider>(pipe.handle1.Pass());
37 context->ios_task_runner->PostTask(
38 FROM_HERE,
39 base::Bind(CreatePlatformServiceProvider, base::Passed(request.Pass())));
40 return mojo::MakeProxy(
41 mojo::InterfacePtrInfo<mojo::ServiceProvider>(pipe.handle0.Pass(), 0u));
42 }
43
44 } // namespace shell
45 } // namespace sky
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698