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

Side by Side Diff: sky/shell/android/platform_service_provider.cc

Issue 1169983005: sky/shell updates for Android and iOS (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/shell/android/platform_service_provider.h"
6
7 #include "base/android/jni_android.h"
8 #include "base/bind.h"
9 #include "base/trace_event/trace_event.h"
10 #include "jni/PlatformServiceProvider_jni.h"
11 #include "mojo/public/cpp/bindings/interface_request.h"
12 #include "sky/shell/service_provider.h"
13
14 namespace sky {
15 namespace shell {
16 namespace {
17
18 void CreatePlatformServiceProvider(
19 mojo::InterfaceRequest<mojo::ServiceProvider> request) {
20 Java_PlatformServiceProvider_create(
21 base::android::AttachCurrentThread(),
22 base::android::GetApplicationContext(),
23 request.PassMessagePipe().release().value());
24 }
25
26 } // namespace
27
28 bool RegisterPlatformServiceProvider(JNIEnv* env) {
29 return RegisterNativesImpl(env);
30 }
31
32 mojo::ServiceProviderPtr CreateServiceProvider(
33 ServiceProviderContext* context) {
34 mojo::MessagePipe pipe;
35 context->java_task_runner->PostTask(
36 FROM_HERE,
37 base::Bind(CreatePlatformServiceProvider,
38 base::Passed(mojo::MakeRequest<mojo::ServiceProvider>(
39 pipe.handle1.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