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

Side by Side Diff: components/cronet/android/api/src/org/chromium/net/JavaUrlRequest.java

Issue 1619923004: Fix doing network operations on wrong executor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix doing network operations on wrong executor Created 4 years, 11 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 | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/TestUrlRequestCallback.java » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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; 5 package org.chromium.net;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.net.TrafficStats; 8 import android.net.TrafficStats;
9 import android.os.Build; 9 import android.os.Build;
10 import android.util.Log; 10 import android.util.Log;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 public void onReadError(Exception exception) { 319 public void onReadError(Exception exception) {
320 enterUploadErrorState(exception); 320 enterUploadErrorState(exception);
321 } 321 }
322 322
323 @Override 323 @Override
324 public void onRewindError(Exception exception) { 324 public void onRewindError(Exception exception) {
325 enterUploadErrorState(exception); 325 enterUploadErrorState(exception);
326 } 326 }
327 327
328 void startRead() { 328 void startRead() {
329 mUserExecutor.execute(uploadErrorSetting(new CheckedRunnable() { 329 mExecutor.execute(errorSetting(State.STARTED, new CheckedRunnable() {
330 @Override 330 @Override
331 public void run() throws Exception { 331 public void run() throws Exception {
332 if (mOutputChannel == null) { 332 if (mOutputChannel == null) {
333 mAdditionalStatusDetails = Status.CONNECTING; 333 mAdditionalStatusDetails = Status.CONNECTING;
334 mUrlConnection.connect(); 334 mUrlConnection.connect();
335 mAdditionalStatusDetails = Status.SENDING_REQUEST; 335 mAdditionalStatusDetails = Status.SENDING_REQUEST;
336 mOutputChannel = Channels.newChannel(mUrlConnection.getO utputStream()); 336 mOutputChannel = Channels.newChannel(mUrlConnection.getO utputStream());
337 } 337 }
338 mSinkState.set(SinkState.AWAITING_READ_RESULT); 338 mSinkState.set(SinkState.AWAITING_READ_RESULT);
339 mUploadProvider.read(OutputStreamDataSink.this, mBuffer); 339 mUserExecutor.execute(uploadErrorSetting(new CheckedRunnable () {
340 @Override
341 public void run() throws Exception {
342 mUploadProvider.read(OutputStreamDataSink.this, mBuf fer);
343 }
344 }));
340 } 345 }
341 })); 346 }));
342 } 347 }
343 348
344 void finish() throws IOException { 349 void finish() throws IOException {
345 if (mOutputChannel != null) { 350 if (mOutputChannel != null) {
346 mOutputChannel.close(); 351 mOutputChannel.close();
347 } 352 }
348 fireGetHeaders(); 353 fireGetHeaders();
349 } 354 }
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 if (closeable == null) { 841 if (closeable == null) {
837 return; 842 return;
838 } 843 }
839 try { 844 try {
840 closeable.close(); 845 closeable.close();
841 } catch (IOException e) { 846 } catch (IOException e) {
842 e.printStackTrace(); 847 e.printStackTrace();
843 } 848 }
844 } 849 }
845 } 850 }
OLDNEW
« no previous file with comments | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/TestUrlRequestCallback.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698