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

Side by Side Diff: base/android/java/src/org/chromium/base/JavaHandlerThread.java

Issue 18584006: Making a way to create thread with a Java Looper for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comment for TYPE_JAVA Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « base/android/base_jni_registrar.cc ('k') | base/android/java_handler_thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 package org.chromium.base;
6
7 import android.os.Handler;
8 import android.os.HandlerThread;
9 import android.os.Looper;
10 import android.os.Message;
11
12 /**
13 * This class is an internal detail of the native counterpart.
14 * It is instantiated and owned by the native object.
15 */
16 @JNINamespace("base::android")
17 class JavaHandlerThread {
18 final HandlerThread mThread;
19
20 private JavaHandlerThread(String name) {
21 mThread = new HandlerThread(name);
22 }
23
24 @CalledByNative
25 private static JavaHandlerThread create(String name) {
26 return new JavaHandlerThread(name);
27 }
28
29 @CalledByNative
30 private void start(final int nativeThread, final int nativeEvent) {
31 mThread.start();
32 new Handler(mThread.getLooper()).post(new Runnable() {
33 @Override
34 public void run() {
35 nativeInitializeThread(nativeThread, nativeEvent);
36 }
37 });
38 }
39
40 private native void nativeInitializeThread(int nativeJavaHandlerThread, int nativeEvent);
41 }
OLDNEW
« no previous file with comments | « base/android/base_jni_registrar.cc ('k') | base/android/java_handler_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698