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 28 matching lines...) Expand all Loading... |
39 userAgent, getLoggingLevel(), config); | 39 userAgent, getLoggingLevel(), config); |
40 if (mUrlRequestContextPeer == 0) | 40 if (mUrlRequestContextPeer == 0) |
41 throw new NullPointerException("Context Peer creation failed"); | 41 throw new NullPointerException("Context Peer creation failed"); |
42 | 42 |
43 // TODO(mef): Revisit the need of block here. | 43 // TODO(mef): Revisit the need of block here. |
44 mStarted.block(2000); | 44 mStarted.block(2000); |
45 } | 45 } |
46 | 46 |
47 /** | 47 /** |
48 * Returns the version of this network stack formatted as N.N.N.N/X where | 48 * 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 version of the JNI layer. | 49 * N.N.N.N is the version of Chromium and X is the revision number. |
50 */ | 50 */ |
51 public static String getVersion() { | 51 public static String getVersion() { |
52 return nativeGetVersion(); | 52 return Version.getVersion(); |
53 } | 53 } |
54 | 54 |
55 /** | 55 /** |
56 * Initializes statistics recorder. | 56 * Initializes statistics recorder. |
57 */ | 57 */ |
58 public void initializeStatistics() { | 58 public void initializeStatistics() { |
59 nativeInitializeStatistics(); | 59 nativeInitializeStatistics(); |
60 } | 60 } |
61 | 61 |
62 /** | 62 /** |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 if (Log.isLoggable(LOG_TAG, Log.VERBOSE)) { | 112 if (Log.isLoggable(LOG_TAG, Log.VERBOSE)) { |
113 loggingLevel = LOG_VERBOSE; | 113 loggingLevel = LOG_VERBOSE; |
114 } else if (Log.isLoggable(LOG_TAG, Log.DEBUG)) { | 114 } else if (Log.isLoggable(LOG_TAG, Log.DEBUG)) { |
115 loggingLevel = LOG_DEBUG; | 115 loggingLevel = LOG_DEBUG; |
116 } else { | 116 } else { |
117 loggingLevel = LOG_NONE; | 117 loggingLevel = LOG_NONE; |
118 } | 118 } |
119 return loggingLevel; | 119 return loggingLevel; |
120 } | 120 } |
121 | 121 |
122 private static native String nativeGetVersion(); | |
123 | |
124 // Returns an instance URLRequestContextPeer to be stored in | 122 // Returns an instance URLRequestContextPeer to be stored in |
125 // mUrlRequestContextPeer. | 123 // mUrlRequestContextPeer. |
126 private native long nativeCreateRequestContextPeer(Context context, | 124 private native long nativeCreateRequestContextPeer(Context context, |
127 String userAgent, int loggingLevel, String config); | 125 String userAgent, int loggingLevel, String config); |
128 | 126 |
129 private native void nativeReleaseRequestContextPeer( | 127 private native void nativeReleaseRequestContextPeer( |
130 long urlRequestContextPeer); | 128 long urlRequestContextPeer); |
131 | 129 |
132 private native void nativeInitializeStatistics(); | 130 private native void nativeInitializeStatistics(); |
133 | 131 |
134 private native String nativeGetStatisticsJSON(String filter); | 132 private native String nativeGetStatisticsJSON(String filter); |
135 | 133 |
136 private native void nativeStartNetLogToFile(long urlRequestContextPeer, | 134 private native void nativeStartNetLogToFile(long urlRequestContextPeer, |
137 String fileName); | 135 String fileName); |
138 | 136 |
139 private native void nativeStopNetLog(long urlRequestContextPeer); | 137 private native void nativeStopNetLog(long urlRequestContextPeer); |
140 } | 138 } |
OLD | NEW |