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

Side by Side Diff: components/cronet/android/java/src/org/chromium/net/urlconnection/MessageLoop.java

Issue 884003004: Rename org.chromium.cronet_test_apk to org.chromium.net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 10 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 | « components/cronet.gypi ('k') | components/cronet/android/test/AndroidManifest.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.net.urlconnection; 5 package org.chromium.net.urlconnection;
6 6
7 import java.io.IOException; 7 import java.io.IOException;
8 import java.util.concurrent.BlockingQueue; 8 import java.util.concurrent.BlockingQueue;
9 import java.util.concurrent.Executor; 9 import java.util.concurrent.Executor;
10 import java.util.concurrent.LinkedBlockingQueue; 10 import java.util.concurrent.LinkedBlockingQueue;
11 import java.util.concurrent.RejectedExecutionException; 11 import java.util.concurrent.RejectedExecutionException;
12 12
13 /** 13 /**
14 * A MessageLoop class for use in {@link CronetHttpURLConnection}. 14 * A MessageLoop class for use in {@link CronetHttpURLConnection}.
15 */ 15 */
16 public final class MessageLoop implements Executor { 16 class MessageLoop implements Executor {
17 private final BlockingQueue<Runnable> mQueue; 17 private final BlockingQueue<Runnable> mQueue;
18 18
19 // A reusable runnable to quit the message loop. 19 // A reusable runnable to quit the message loop.
20 private final Runnable mQuitTask; 20 private final Runnable mQuitTask;
21 21
22 // Indicates whether this message loop is currently running. 22 // Indicates whether this message loop is currently running.
23 private boolean mLoopRunning = false; 23 private boolean mLoopRunning = false;
24 24
25 // Indicates whether an InterruptedException or a RuntimeException has 25 // Indicates whether an InterruptedException or a RuntimeException has
26 // occurred in loop(). If true, the loop cannot be safely started because 26 // occurred in loop(). If true, the loop cannot be safely started because
27 // this might cause the loop to terminate immediately if there is a quit 27 // this might cause the loop to terminate immediately if there is a quit
28 // task enqueued. 28 // task enqueued.
29 private boolean mLoopFailed = false; 29 private boolean mLoopFailed = false;
30 30
31 public MessageLoop() { 31 MessageLoop() {
32 mQueue = new LinkedBlockingQueue<Runnable>(); 32 mQueue = new LinkedBlockingQueue<Runnable>();
33 mQuitTask = new Runnable() { 33 mQuitTask = new Runnable() {
34 @Override 34 @Override
35 public void run() { 35 public void run() {
36 mLoopRunning = false; 36 mLoopRunning = false;
37 } 37 }
38 }; 38 };
39 } 39 }
40 40
41 /** 41 /**
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return mLoopRunning; 103 return mLoopRunning;
104 } 104 }
105 105
106 /** 106 /**
107 * Returns whether an exception occurred in {#loop()}. Used in testing. 107 * Returns whether an exception occurred in {#loop()}. Used in testing.
108 */ 108 */
109 public boolean hasLoopFailed() { 109 public boolean hasLoopFailed() {
110 return mLoopFailed; 110 return mLoopFailed;
111 } 111 }
112 } 112 }
OLDNEW
« no previous file with comments | « components/cronet.gypi ('k') | components/cronet/android/test/AndroidManifest.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698