| Index: talk/app/webrtc/java/android/org/webrtc/ThreadUtils.java
|
| diff --git a/talk/app/webrtc/java/android/org/webrtc/ThreadUtils.java b/talk/app/webrtc/java/android/org/webrtc/ThreadUtils.java
|
| index e7dc331103eab0b75cdefd57e3363a887119243e..5e6cc52895c8ce44fb63201f632c3cb269044777 100644
|
| --- a/talk/app/webrtc/java/android/org/webrtc/ThreadUtils.java
|
| +++ b/talk/app/webrtc/java/android/org/webrtc/ThreadUtils.java
|
| @@ -31,6 +31,26 @@ import java.util.concurrent.CountDownLatch;
|
|
|
| final class ThreadUtils {
|
| /**
|
| + * Utility class to be used for checking that a method is called on the correct thread.
|
| + */
|
| + public static class ThreadChecker {
|
| + private Thread thread = Thread.currentThread();
|
| +
|
| + public void checkIsOnValidThread() {
|
| + if (thread == null) {
|
| + thread = Thread.currentThread();
|
| + }
|
| + if (Thread.currentThread() != thread) {
|
| + throw new IllegalStateException("Wrong thread");
|
| + }
|
| + }
|
| +
|
| + public void detachThread() {
|
| + thread = null;
|
| + }
|
| + }
|
| +
|
| + /**
|
| * Utility interface to be used with executeUninterruptibly() to wait for blocking operations
|
| * to complete without getting interrupted..
|
| */
|
|
|