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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 RTC_CHECK_LT(snprintf(buf, sizeof(buf), "%ld", | 106 RTC_CHECK_LT(snprintf(buf, sizeof(buf), "%ld", |
107 static_cast<long>(syscall(__NR_gettid))), | 107 static_cast<long>(syscall(__NR_gettid))), |
108 sizeof(buf)) | 108 sizeof(buf)) |
109 << "Thread id is bigger than uint64??"; | 109 << "Thread id is bigger than uint64_t??"; |
110 return std::string(buf); | 110 return std::string(buf); |
111 } | 111 } |
112 | 112 |
113 // Return the current thread's name. | 113 // Return the current thread's name. |
114 static std::string GetThreadName() { | 114 static std::string GetThreadName() { |
115 char name[17] = {0}; | 115 char name[17] = {0}; |
116 if (prctl(PR_GET_NAME, name) != 0) | 116 if (prctl(PR_GET_NAME, name) != 0) |
117 return std::string("<noname>"); | 117 return std::string("<noname>"); |
118 return std::string(name); | 118 return std::string(name); |
119 } | 119 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 // callbacks (i.e. entry points that don't originate in a Java callstack | 279 // callbacks (i.e. entry points that don't originate in a Java callstack |
280 // through a "native" method call). | 280 // through a "native" method call). |
281 ScopedLocalRefFrame::ScopedLocalRefFrame(JNIEnv* jni) : jni_(jni) { | 281 ScopedLocalRefFrame::ScopedLocalRefFrame(JNIEnv* jni) : jni_(jni) { |
282 RTC_CHECK(!jni_->PushLocalFrame(0)) << "Failed to PushLocalFrame"; | 282 RTC_CHECK(!jni_->PushLocalFrame(0)) << "Failed to PushLocalFrame"; |
283 } | 283 } |
284 ScopedLocalRefFrame::~ScopedLocalRefFrame() { | 284 ScopedLocalRefFrame::~ScopedLocalRefFrame() { |
285 jni_->PopLocalFrame(NULL); | 285 jni_->PopLocalFrame(NULL); |
286 } | 286 } |
287 | 287 |
288 } // namespace webrtc_jni | 288 } // namespace webrtc_jni |
OLD | NEW |