OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * libjingle | 3 * libjingle |
4 * Copyright 2015 Google Inc. | 4 * Copyright 2015 Google Inc. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are met: | 7 * modification, are permitted provided that the following conditions are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright notice, | 9 * 1. Redistributions of source code must retain the above copyright notice, |
10 * this list of conditions and the following disclaimer. | 10 * this list of conditions and the following disclaimer. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 JNIEnv* jni = nullptr; | 96 JNIEnv* jni = nullptr; |
97 if (jvm->GetEnv(reinterpret_cast<void**>(&jni), JNI_VERSION_1_6) != JNI_OK) | 97 if (jvm->GetEnv(reinterpret_cast<void**>(&jni), JNI_VERSION_1_6) != JNI_OK) |
98 return -1; | 98 return -1; |
99 | 99 |
100 return JNI_VERSION_1_6; | 100 return JNI_VERSION_1_6; |
101 } | 101 } |
102 | 102 |
103 // Return thread ID as a string. | 103 // Return thread ID as a string. |
104 static std::string GetThreadId() { | 104 static std::string GetThreadId() { |
105 char buf[21]; // Big enough to hold a kuint64max plus terminating NULL. | 105 char buf[21]; // Big enough to hold a kuint64max plus terminating NULL. |
106 CHECK_LT(snprintf(buf, sizeof(buf), "%ld", syscall(__NR_gettid)), | 106 CHECK_LT(snprintf(buf, sizeof(buf), "%ld", |
| 107 static_cast<long>(syscall(__NR_gettid))), |
107 sizeof(buf)) | 108 sizeof(buf)) |
108 << "Thread id is bigger than uint64??"; | 109 << "Thread id is bigger than uint64??"; |
109 return std::string(buf); | 110 return std::string(buf); |
110 } | 111 } |
111 | 112 |
112 // Return the current thread's name. | 113 // Return the current thread's name. |
113 static std::string GetThreadName() { | 114 static std::string GetThreadName() { |
114 char name[17] = {0}; | 115 char name[17] = {0}; |
115 if (prctl(PR_GET_NAME, name) != 0) | 116 if (prctl(PR_GET_NAME, name) != 0) |
116 return std::string("<noname>"); | 117 return std::string("<noname>"); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // callbacks (i.e. entry points that don't originate in a Java callstack | 289 // callbacks (i.e. entry points that don't originate in a Java callstack |
289 // through a "native" method call). | 290 // through a "native" method call). |
290 ScopedLocalRefFrame::ScopedLocalRefFrame(JNIEnv* jni) : jni_(jni) { | 291 ScopedLocalRefFrame::ScopedLocalRefFrame(JNIEnv* jni) : jni_(jni) { |
291 CHECK(!jni_->PushLocalFrame(0)) << "Failed to PushLocalFrame"; | 292 CHECK(!jni_->PushLocalFrame(0)) << "Failed to PushLocalFrame"; |
292 } | 293 } |
293 ScopedLocalRefFrame::~ScopedLocalRefFrame() { | 294 ScopedLocalRefFrame::~ScopedLocalRefFrame() { |
294 jni_->PopLocalFrame(NULL); | 295 jni_->PopLocalFrame(NULL); |
295 } | 296 } |
296 | 297 |
297 } // namespace webrtc_jni | 298 } // namespace webrtc_jni |
OLD | NEW |