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

Side by Side Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/util/LooperExecutor.java

Issue 1989813002: Convert LooperExecutorTest in AppRTC Demo into JUnit test (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changes according to magjed's comments Created 4 years, 7 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 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 public synchronized void requestStop() { 66 public synchronized void requestStop() {
67 if (!running) { 67 if (!running) {
68 return; 68 return;
69 } 69 }
70 running = false; 70 running = false;
71 handler.post(new Runnable() { 71 handler.post(new Runnable() {
72 @Override 72 @Override
73 public void run() { 73 public void run() {
74 Looper.myLooper().quit(); 74 handler.getLooper().quit();
75 Log.d(TAG, "Looper thread finished."); 75 Log.d(TAG, "Looper thread finished.");
76 } 76 }
77 }); 77 });
78 } 78 }
79 79
80 // Checks if current thread is a looper thread. 80 // Checks if current thread is a looper thread.
81 public boolean checkOnLooperThread() { 81 public boolean checkOnLooperThread() {
82 return (Thread.currentThread().getId() == threadId); 82 return (Thread.currentThread().getId() == threadId);
83 } 83 }
84 84
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 Log.w(TAG, "Running looper executor without calling requestStart()"); 123 Log.w(TAG, "Running looper executor without calling requestStart()");
124 return; 124 return;
125 } 125 }
126 if (Thread.currentThread().getId() == threadId) { 126 if (Thread.currentThread().getId() == threadId) {
127 runnable.run(); 127 runnable.run();
128 } else { 128 } else {
129 handler.post(runnable); 129 handler.post(runnable);
130 } 130 }
131 } 131 }
132 132
133 /**
134 * Access to the handler for testing purposes.
135 */
136 Handler getHandler() {
137 return handler;
138 }
133 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698