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

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: Service provider platform task runner refactor to be platform agnostic 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/ios/main_ios.mm ('k') | sky/shell/ios/platform_view_ios.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6ae956f07d768d1237478bfa11505b6934acc61c
--- /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"
+#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;
+ auto request = mojo::MakeRequest<mojo::ServiceProvider>(pipe.handle1.Pass());
+ context->platform_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
« no previous file with comments | « sky/shell/ios/main_ios.mm ('k') | sky/shell/ios/platform_view_ios.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698