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

Side by Side Diff: mojo/android/system/core_impl.cc

Issue 544603002: mojo: Move initialization of the embedder in java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/android/system/core_impl.h" 5 #include "mojo/android/system/core_impl.h"
6 6
7 #include "base/android/base_jni_registrar.h" 7 #include "base/android/base_jni_registrar.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_registrar.h" 9 #include "base/android/jni_registrar.h"
10 #include "base/android/library_loader/library_loader_hooks.h" 10 #include "base/android/library_loader/library_loader_hooks.h"
11 #include "base/android/scoped_java_ref.h" 11 #include "base/android/scoped_java_ref.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "jni/CoreImpl_jni.h" 15 #include "jni/CoreImpl_jni.h"
16 #include "mojo/embedder/embedder.h"
17 #include "mojo/embedder/simple_platform_support.h"
18 #include "mojo/public/c/environment/async_waiter.h" 16 #include "mojo/public/c/environment/async_waiter.h"
19 #include "mojo/public/c/system/core.h" 17 #include "mojo/public/c/system/core.h"
20 #include "mojo/public/cpp/environment/environment.h" 18 #include "mojo/public/cpp/environment/environment.h"
21 19
22 namespace { 20 namespace {
23 21
24 // |AsyncWait| is guaranteed never to return 0. 22 // |AsyncWait| is guaranteed never to return 0.
25 const MojoAsyncWaitID kInvalidHandleCancelID = 0; 23 const MojoAsyncWaitID kInvalidHandleCancelID = 0;
26 24
27 struct AsyncWaitCallbackData { 25 struct AsyncWaitCallbackData {
(...skipping 16 matching lines...) Expand all
44 result, 42 result,
45 callback_data->callback.obj(), 43 callback_data->callback.obj(),
46 callback_data->cancellable.obj()); 44 callback_data->cancellable.obj());
47 } 45 }
48 46
49 } // namespace 47 } // namespace
50 48
51 namespace mojo { 49 namespace mojo {
52 namespace android { 50 namespace android {
53 51
54 static void Constructor(JNIEnv* env, jobject jcaller) {
55 embedder::Init(scoped_ptr<embedder::PlatformSupport>(
56 new embedder::SimplePlatformSupport()));
57 }
58
59 static jlong GetTimeTicksNow(JNIEnv* env, jobject jcaller) { 52 static jlong GetTimeTicksNow(JNIEnv* env, jobject jcaller) {
60 return MojoGetTimeTicksNow(); 53 return MojoGetTimeTicksNow();
61 } 54 }
62 55
63 static jint WaitMany(JNIEnv* env, 56 static jint WaitMany(JNIEnv* env,
64 jobject jcaller, 57 jobject jcaller,
65 jobject buffer, 58 jobject buffer,
66 jlong deadline) { 59 jlong deadline) {
67 // Buffer contains first the list of handles, then the list of signals. 60 // Buffer contains first the list of handles, then the list of signals.
68 const void* buffer_start = env->GetDirectBufferAddress(buffer); 61 const void* buffer_start = env->GetDirectBufferAddress(buffer);
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 reinterpret_cast<AsyncWaitCallbackData*>(data_ptr)); 369 reinterpret_cast<AsyncWaitCallbackData*>(data_ptr));
377 Environment::GetDefaultAsyncWaiter()->CancelWait(id); 370 Environment::GetDefaultAsyncWaiter()->CancelWait(id);
378 } 371 }
379 372
380 bool RegisterCoreImpl(JNIEnv* env) { 373 bool RegisterCoreImpl(JNIEnv* env) {
381 return RegisterNativesImpl(env); 374 return RegisterNativesImpl(env);
382 } 375 }
383 376
384 } // namespace android 377 } // namespace android
385 } // namespace mojo 378 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/android/javatests/init_library.cc ('k') | mojo/android/system/src/org/chromium/mojo/system/impl/CoreImpl.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698