| OLD | NEW |
| 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.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Build; | 8 import android.os.Build; |
| 9 import android.os.ConditionVariable; | 9 import android.os.ConditionVariable; |
| 10 import android.os.Handler; | 10 import android.os.Handler; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 253 } |
| 254 nativeDestroy(mUrlRequestContextAdapter); | 254 nativeDestroy(mUrlRequestContextAdapter); |
| 255 mUrlRequestContextAdapter = 0; | 255 mUrlRequestContextAdapter = 0; |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 @Override | 259 @Override |
| 260 public void startNetLogToFile(String fileName, boolean logAll) { | 260 public void startNetLogToFile(String fileName, boolean logAll) { |
| 261 synchronized (mLock) { | 261 synchronized (mLock) { |
| 262 checkHaveAdapter(); | 262 checkHaveAdapter(); |
| 263 nativeStartNetLogToFile(mUrlRequestContextAdapter, fileName, logAll)
; | 263 if (!nativeStartNetLogToFile(mUrlRequestContextAdapter, fileName, lo
gAll)) { |
| 264 throw new RuntimeException("Unable to start NetLog"); |
| 265 } |
| 264 mIsLogging = true; | 266 mIsLogging = true; |
| 265 } | 267 } |
| 266 } | 268 } |
| 267 | 269 |
| 268 @Override | 270 @Override |
| 269 public void startNetLogToDisk(String dirPath, boolean logAll, int maxSize) { | 271 public void startNetLogToDisk(String dirPath, boolean logAll, int maxSize) { |
| 270 synchronized (mLock) { | 272 synchronized (mLock) { |
| 271 checkHaveAdapter(); | 273 checkHaveAdapter(); |
| 272 nativeStartNetLogToDisk(mUrlRequestContextAdapter, dirPath, logAll,
maxSize); | 274 nativeStartNetLogToDisk(mUrlRequestContextAdapter, dirPath, logAll,
maxSize); |
| 273 mIsLogging = true; | 275 mIsLogging = true; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 private static native long nativeCreateRequestContextAdapter(long urlRequest
ContextConfig); | 607 private static native long nativeCreateRequestContextAdapter(long urlRequest
ContextConfig); |
| 606 | 608 |
| 607 private static native int nativeSetMinLogLevel(int loggingLevel); | 609 private static native int nativeSetMinLogLevel(int loggingLevel); |
| 608 | 610 |
| 609 private static native byte[] nativeGetHistogramDeltas(); | 611 private static native byte[] nativeGetHistogramDeltas(); |
| 610 | 612 |
| 611 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 613 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 612 private native void nativeDestroy(long nativePtr); | 614 private native void nativeDestroy(long nativePtr); |
| 613 | 615 |
| 614 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 616 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 615 private native void nativeStartNetLogToFile(long nativePtr, String fileName,
boolean logAll); | 617 private native boolean nativeStartNetLogToFile(long nativePtr, String fileNa
me, boolean logAll); |
| 616 | 618 |
| 617 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 619 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 618 private native void nativeStartNetLogToDisk( | 620 private native void nativeStartNetLogToDisk( |
| 619 long nativePtr, String dirPath, boolean logAll, int maxSize); | 621 long nativePtr, String dirPath, boolean logAll, int maxSize); |
| 620 | 622 |
| 621 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 623 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 622 private native void nativeStopNetLog(long nativePtr); | 624 private native void nativeStopNetLog(long nativePtr); |
| 623 | 625 |
| 624 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 626 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 625 private native void nativeGetCertVerifierData(long nativePtr); | 627 private native void nativeGetCertVerifierData(long nativePtr); |
| 626 | 628 |
| 627 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 629 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 628 private native void nativeInitRequestContextOnMainThread(long nativePtr); | 630 private native void nativeInitRequestContextOnMainThread(long nativePtr); |
| 629 | 631 |
| 630 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 632 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 631 private native void nativeConfigureNetworkQualityEstimatorForTesting( | 633 private native void nativeConfigureNetworkQualityEstimatorForTesting( |
| 632 long nativePtr, boolean useLocalHostRequests, boolean useSmallerResp
onses); | 634 long nativePtr, boolean useLocalHostRequests, boolean useSmallerResp
onses); |
| 633 | 635 |
| 634 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 636 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 635 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); | 637 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); |
| 636 | 638 |
| 637 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 639 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 638 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); | 640 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); |
| 639 | 641 |
| 640 public boolean isNetworkThread(Thread thread) { | 642 public boolean isNetworkThread(Thread thread) { |
| 641 return thread == mNetworkThread; | 643 return thread == mNetworkThread; |
| 642 } | 644 } |
| 643 } | 645 } |
| OLD | NEW |