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

Side by Side Diff: webrtc/base/java/src/org/webrtc/ThreadUtils.java

Issue 2186253002: Session based capturing for Camera2Capturer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 years, 4 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
« no previous file with comments | « webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 timeRemainingMs = timeoutMs - elapsedTimeMs; 129 timeRemainingMs = timeoutMs - elapsedTimeMs;
130 } 130 }
131 } while (timeRemainingMs > 0); 131 } while (timeRemainingMs > 0);
132 // Pass interruption information along. 132 // Pass interruption information along.
133 if (wasInterrupted) { 133 if (wasInterrupted) {
134 Thread.currentThread().interrupt(); 134 Thread.currentThread().interrupt();
135 } 135 }
136 return result; 136 return result;
137 } 137 }
138 138
139 public static void waitUninterruptibly(final Object object) {
140 executeUninterruptibly(new BlockingOperation() {
141 @Override
142 public void run() throws InterruptedException {
143 object.wait();
144 }
145 });
146 }
147
139 /** 148 /**
140 * Post |callable| to |handler| and wait for the result. 149 * Post |callable| to |handler| and wait for the result.
141 */ 150 */
142 public static <V> V invokeAtFrontUninterruptibly( 151 public static <V> V invokeAtFrontUninterruptibly(
143 final Handler handler, final Callable<V> callable) { 152 final Handler handler, final Callable<V> callable) {
144 if (handler.getLooper().getThread() == Thread.currentThread()) { 153 if (handler.getLooper().getThread() == Thread.currentThread()) {
145 V value; 154 V value;
146 try { 155 try {
147 value = callable.call(); 156 value = callable.call();
148 } catch (Exception e) { 157 } catch (Exception e) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 handler.postAtFrontOfQueue(new Runnable() { 197 handler.postAtFrontOfQueue(new Runnable() {
189 @Override 198 @Override
190 public void run() { 199 public void run() {
191 runner.run(); 200 runner.run();
192 barrier.countDown(); 201 barrier.countDown();
193 } 202 }
194 }); 203 });
195 awaitUninterruptibly(barrier); 204 awaitUninterruptibly(barrier);
196 } 205 }
197 } 206 }
OLDNEW
« no previous file with comments | « webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698