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

Side by Side Diff: components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequest.java

Issue 2359583002: Change CronetUrlRequestContext slightly to allow reporting of BidirectionalStream's RequestFinished… (Closed)
Patch Set: Created 4 years, 2 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/java/src/org/chromium/net/impl/CronetUrlRequestContext.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 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.impl; 5 package org.chromium.net.impl;
6 6
7 import android.os.SystemClock; 7 import android.os.SystemClock;
8 import android.support.annotation.Nullable; 8 import android.support.annotation.Nullable;
9 import android.util.Log; 9 import android.util.Log;
10 10
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 422
423 private void destroyRequestAdapter(boolean sendOnCanceled) { 423 private void destroyRequestAdapter(boolean sendOnCanceled) {
424 synchronized (mUrlRequestAdapterLock) { 424 synchronized (mUrlRequestAdapterLock) {
425 if (mUrlRequestAdapter == 0) { 425 if (mUrlRequestAdapter == 0) {
426 return; 426 return;
427 } 427 }
428 if (mRequestMetricsAccumulator != null) { 428 if (mRequestMetricsAccumulator != null) {
429 mRequestMetricsAccumulator.onRequestFinished(); 429 mRequestMetricsAccumulator.onRequestFinished();
430 } 430 }
431 nativeDestroy(mUrlRequestAdapter, sendOnCanceled); 431 nativeDestroy(mUrlRequestAdapter, sendOnCanceled);
432 mRequestContext.reportFinished(this); 432 mRequestContext.reportFinished(getRequestFinishedInfo());
433 mRequestContext.onRequestDestroyed(); 433 mRequestContext.onRequestDestroyed();
434 mUrlRequestAdapter = 0; 434 mUrlRequestAdapter = 0;
435 if (mOnDestroyedCallbackForTesting != null) { 435 if (mOnDestroyedCallbackForTesting != null) {
436 mOnDestroyedCallbackForTesting.run(); 436 mOnDestroyedCallbackForTesting.run();
437 } 437 }
438 } 438 }
439 } 439 }
440 440
441 /** 441 /**
442 * If callback method throws an exception, request gets canceled 442 * If callback method throws an exception, request gets canceled
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 private void onStatus(final UrlRequest.StatusListener listener, final int lo adState) { 692 private void onStatus(final UrlRequest.StatusListener listener, final int lo adState) {
693 Runnable task = new Runnable() { 693 Runnable task = new Runnable() {
694 @Override 694 @Override
695 public void run() { 695 public void run() {
696 listener.onStatus(UrlRequest.Status.convertLoadState(loadState)) ; 696 listener.onStatus(UrlRequest.Status.convertLoadState(loadState)) ;
697 } 697 }
698 }; 698 };
699 postTaskToExecutor(task); 699 postTaskToExecutor(task);
700 } 700 }
701 701
702 RequestFinishedInfo getRequestFinishedInfo() { 702 private RequestFinishedInfo getRequestFinishedInfo() {
703 // TODO(mgersh): fill in real values for finishedReason and exception 703 // TODO(mgersh): fill in real values for finishedReason and exception
704 return new RequestFinishedInfo(mInitialUrl, mRequestAnnotations, 704 return new RequestFinishedInfo(mInitialUrl, mRequestAnnotations,
705 (mRequestMetricsAccumulator != null ? mRequestMetricsAccumulator .getRequestMetrics() 705 (mRequestMetricsAccumulator != null ? mRequestMetricsAccumulator .getRequestMetrics()
706 : EMPTY_METRICS), 706 : EMPTY_METRICS),
707 RequestFinishedInfo.SUCCEEDED, mResponseInfo, null); 707 RequestFinishedInfo.SUCCEEDED, mResponseInfo, null);
708 } 708 }
709 709
710 private final class UrlRequestMetricsAccumulator { 710 private final class UrlRequestMetricsAccumulator {
711 @Nullable 711 @Nullable
712 private Long mRequestStartTime; 712 private Long mRequestStartTime;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 @NativeClassQualifiedName("CronetURLRequestAdapter") 768 @NativeClassQualifiedName("CronetURLRequestAdapter")
769 private native boolean nativeReadData( 769 private native boolean nativeReadData(
770 long nativePtr, ByteBuffer byteBuffer, int position, int capacity); 770 long nativePtr, ByteBuffer byteBuffer, int position, int capacity);
771 771
772 @NativeClassQualifiedName("CronetURLRequestAdapter") 772 @NativeClassQualifiedName("CronetURLRequestAdapter")
773 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); 773 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled);
774 774
775 @NativeClassQualifiedName("CronetURLRequestAdapter") 775 @NativeClassQualifiedName("CronetURLRequestAdapter")
776 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene r listener); 776 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene r listener);
777 } 777 }
OLDNEW
« no previous file with comments | « no previous file | components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698