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

Side by Side Diff: webrtc/sdk/android/src/jni/jni_helpers.cc

Issue 3003213002: Android: Add common function for adding/releasing native reference (Closed)
Patch Set: Rebase Created 3 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 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include "webrtc/sdk/android/src/jni/jni_helpers.h" 10 #include "webrtc/sdk/android/src/jni/jni_helpers.h"
11 11
12 #include "webrtc/sdk/android/src/jni/classreferenceholder.h"
13
14 #include <asm/unistd.h> 12 #include <asm/unistd.h>
15 #include <sys/prctl.h> 13 #include <sys/prctl.h>
16 #include <sys/syscall.h> 14 #include <sys/syscall.h>
17 #include <unistd.h> 15 #include <unistd.h>
18 #include <vector> 16 #include <vector>
19 17
18 #include "webrtc/sdk/android/src/jni/classreferenceholder.h"
19
20 namespace webrtc_jni { 20 namespace webrtc_jni {
21 21
22 static JavaVM* g_jvm = nullptr; 22 static JavaVM* g_jvm = nullptr;
23 23
24 static pthread_once_t g_jni_ptr_once = PTHREAD_ONCE_INIT; 24 static pthread_once_t g_jni_ptr_once = PTHREAD_ONCE_INIT;
25 25
26 // Key for per-thread JNIEnv* data. Non-NULL in threads attached to |g_jvm| by 26 // Key for per-thread JNIEnv* data. Non-NULL in threads attached to |g_jvm| by
27 // AttachCurrentThreadIfNeeded(), NULL in unattached threads and threads that 27 // AttachCurrentThreadIfNeeded(), NULL in unattached threads and threads that
28 // were attached by the JVM because of a Java->native call. 28 // were attached by the JVM because of a Java->native call.
29 static pthread_key_t g_jni_ptr; 29 static pthread_key_t g_jni_ptr;
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 RTC_CHECK(!AtEnd()); 379 RTC_CHECK(!AtEnd());
380 return value_; 380 return value_;
381 } 381 }
382 382
383 bool Iterable::Iterator::AtEnd() const { 383 bool Iterable::Iterator::AtEnd() const {
384 RTC_CHECK(thread_checker_.CalledOnValidThread()); 384 RTC_CHECK(thread_checker_.CalledOnValidThread());
385 return jni_ == nullptr || IsNull(jni_, iterator_); 385 return jni_ == nullptr || IsNull(jni_, iterator_);
386 } 386 }
387 387
388 } // namespace webrtc_jni 388 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/sdk/android/src/jni/jni_common.cc ('k') | webrtc/sdk/android/src/jni/pc/dtmfsender_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698