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

Side by Side Diff: base/android/java_handler_thread.cc

Issue 1294333002: Fix wrong usages of ScopedJavaLocalRef::Release(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment to Release() explaining it should not be used to call java methods Created 5 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
« no previous file with comments | « no previous file | base/android/scoped_java_ref.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/android/java_handler_thread.h" 5 #include "base/android/java_handler_thread.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
14 #include "jni/JavaHandlerThread_jni.h" 14 #include "jni/JavaHandlerThread_jni.h"
15 15
16 namespace base { 16 namespace base {
17 17
18 namespace android { 18 namespace android {
19 19
20 JavaHandlerThread::JavaHandlerThread(const char* name) { 20 JavaHandlerThread::JavaHandlerThread(const char* name) {
21 JNIEnv* env = base::android::AttachCurrentThread(); 21 JNIEnv* env = base::android::AttachCurrentThread();
22 22
23 java_thread_.Reset(Java_JavaHandlerThread_create( 23 java_thread_.Reset(Java_JavaHandlerThread_create(
24 env, ConvertUTF8ToJavaString(env, name).Release())); 24 env, ConvertUTF8ToJavaString(env, name).obj()));
25 } 25 }
26 26
27 JavaHandlerThread::~JavaHandlerThread() { 27 JavaHandlerThread::~JavaHandlerThread() {
28 } 28 }
29 29
30 void JavaHandlerThread::Start() { 30 void JavaHandlerThread::Start() {
31 // Check the thread has not already been started. 31 // Check the thread has not already been started.
32 DCHECK(!message_loop_); 32 DCHECK(!message_loop_);
33 33
34 JNIEnv* env = base::android::AttachCurrentThread(); 34 JNIEnv* env = base::android::AttachCurrentThread();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 reinterpret_cast<base::WaitableEvent*>(event)->Signal(); 68 reinterpret_cast<base::WaitableEvent*>(event)->Signal();
69 } 69 }
70 70
71 // static 71 // static
72 bool JavaHandlerThread::RegisterBindings(JNIEnv* env) { 72 bool JavaHandlerThread::RegisterBindings(JNIEnv* env) {
73 return RegisterNativesImpl(env); 73 return RegisterNativesImpl(env);
74 } 74 }
75 75
76 } // namespace android 76 } // namespace android
77 } // namespace base 77 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/android/scoped_java_ref.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698