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; | 5 package org.chromium.net; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.os.ConditionVariable; | 8 import android.os.ConditionVariable; |
9 import android.os.Process; | 9 import android.os.Process; |
10 import android.util.Log; | 10 import android.util.Log; |
(...skipping 19 matching lines...) Expand all Loading... |
30 private final ConditionVariable mStarted = new ConditionVariable(); | 30 private final ConditionVariable mStarted = new ConditionVariable(); |
31 | 31 |
32 /** | 32 /** |
33 * Constructor. | 33 * Constructor. |
34 * | 34 * |
35 */ | 35 */ |
36 protected ChromiumUrlRequestContext(Context context, String userAgent, | 36 protected ChromiumUrlRequestContext(Context context, String userAgent, |
37 String config) { | 37 String config) { |
38 mChromiumUrlRequestContextAdapter = nativeCreateRequestContextAdapter( | 38 mChromiumUrlRequestContextAdapter = nativeCreateRequestContextAdapter( |
39 context, userAgent, getLoggingLevel(), config); | 39 context, userAgent, getLoggingLevel(), config); |
40 if (mChromiumUrlRequestContextAdapter == 0) | 40 if (mChromiumUrlRequestContextAdapter == 0) { |
41 throw new NullPointerException("Context Adapter creation failed"); | 41 throw new NullPointerException("Context Adapter creation failed"); |
42 | 42 } |
43 // TODO(mef): Revisit the need of block here. | |
44 mStarted.block(2000); | |
45 } | 43 } |
46 | 44 |
47 /** | 45 /** |
48 * Returns the version of this network stack formatted as N.N.N.N/X where | 46 * Returns the version of this network stack formatted as N.N.N.N/X where |
49 * N.N.N.N is the version of Chromium and X is the revision number. | 47 * N.N.N.N is the version of Chromium and X is the revision number. |
50 */ | 48 */ |
51 public static String getVersion() { | 49 public static String getVersion() { |
52 return Version.getVersion(); | 50 return Version.getVersion(); |
53 } | 51 } |
54 | 52 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 127 |
130 private native void nativeInitializeStatistics(); | 128 private native void nativeInitializeStatistics(); |
131 | 129 |
132 private native String nativeGetStatisticsJSON(String filter); | 130 private native String nativeGetStatisticsJSON(String filter); |
133 | 131 |
134 private native void nativeStartNetLogToFile( | 132 private native void nativeStartNetLogToFile( |
135 long chromiumUrlRequestContextAdapter, String fileName); | 133 long chromiumUrlRequestContextAdapter, String fileName); |
136 | 134 |
137 private native void nativeStopNetLog(long chromiumUrlRequestContextAdapter); | 135 private native void nativeStopNetLog(long chromiumUrlRequestContextAdapter); |
138 } | 136 } |
OLD | NEW |