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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: sky/shell/ios/platform_service_provider_ios.cc
diff --git a/sky/shell/ios/platform_service_provider_ios.cc b/sky/shell/ios/platform_service_provider_ios.cc
new file mode 100644
index 0000000000000000000000000000000000000000..558006123d0292227b2dc20b01f1012b5172113a
--- /dev/null
+++ b/sky/shell/ios/platform_service_provider_ios.cc
@@ -0,0 +1,45 @@
+// 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/engine/config.h"
+#include "sky/engine/wtf/Assertions.h"
abarth-chromium 2015/06/05 22:56:09 You shouldn't need to include any of these headers
+#include "sky/shell/service_provider.h"
+#include "base/single_thread_task_runner.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/lazy_instance.h"
+#include "base/location.h"
+#include "mojo/public/cpp/application/service_provider_impl.h"
+#include "sky/services/ns_net/network_service_impl.h"
+
+namespace sky {
+namespace shell {
+
+// FIXME(csg): Put this in an application owned context
+base::LazyInstance<scoped_ptr<mojo::ServiceProviderImpl>> g_service_provider =
+ LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<scoped_ptr<mojo::NetworkServiceFactory>>
+ g_network_service_factory = LAZY_INSTANCE_INITIALIZER;
+
+static void CreatePlatformServiceProvider(
+ mojo::InterfaceRequest<mojo::ServiceProvider> request) {
+ g_service_provider.Get().reset(new mojo::ServiceProviderImpl(request.Pass()));
+ g_network_service_factory.Get().reset(new mojo::NetworkServiceFactory());
+ g_service_provider.Get()->AddService(g_network_service_factory.Get().get());
+}
+
+mojo::ServiceProviderPtr CreateServiceProvider(
+ ServiceProviderContext* context) {
+ DCHECK(context);
+ mojo::MessagePipe pipe;
abarth-chromium 2015/06/05 22:56:09 I suspect there's a fancier way do this without me
+ auto request = mojo::MakeRequest<mojo::ServiceProvider>(pipe.handle1.Pass());
+ context->ios_task_runner->PostTask(
+ FROM_HERE,
+ base::Bind(CreatePlatformServiceProvider, base::Passed(request.Pass())));
+ return mojo::MakeProxy(
+ mojo::InterfacePtrInfo<mojo::ServiceProvider>(pipe.handle0.Pass(), 0u));
+}
+
+} // namespace shell
+} // namespace sky

Powered by Google App Engine
This is Rietveld 408576698