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

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

Issue 922283002: Use @NativeClassQualifiedName in CronetUrlRequestContext.java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review Created 5 years, 10 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
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; 5 package org.chromium.net;
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;
11 import android.os.Looper; 11 import android.os.Looper;
12 import android.os.Process; 12 import android.os.Process;
13 import android.util.Log; 13 import android.util.Log;
14 14
15 import org.chromium.base.CalledByNative; 15 import org.chromium.base.CalledByNative;
16 import org.chromium.base.JNINamespace; 16 import org.chromium.base.JNINamespace;
17 import org.chromium.base.NativeClassQualifiedName;
17 18
18 import java.util.concurrent.Executor; 19 import java.util.concurrent.Executor;
19 import java.util.concurrent.atomic.AtomicInteger; 20 import java.util.concurrent.atomic.AtomicInteger;
20 21
21 /** 22 /**
22 * UrlRequest context using Chromium HTTP stack implementation. 23 * UrlRequest context using Chromium HTTP stack implementation.
23 */ 24 */
24 @JNINamespace("cronet") 25 @JNINamespace("cronet")
25 public class CronetUrlRequestContext extends UrlRequestContext { 26 public class CronetUrlRequestContext extends UrlRequestContext {
26 private static final int LOG_NONE = 3; // LOG(FATAL), no VLOG. 27 private static final int LOG_NONE = 3; // LOG(FATAL), no VLOG.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 106 }
106 // Wait for init to complete on main and network thread (without lock, 107 // Wait for init to complete on main and network thread (without lock,
107 // so other thread could access it). 108 // so other thread could access it).
108 mInitCompleted.block(); 109 mInitCompleted.block();
109 110
110 synchronized (mLock) { 111 synchronized (mLock) {
111 // It is possible that adapter is already destroyed on another threa d. 112 // It is possible that adapter is already destroyed on another threa d.
112 if (!haveRequestContextAdapter()) { 113 if (!haveRequestContextAdapter()) {
113 return; 114 return;
114 } 115 }
115 nativeDestroyRequestContextAdapter(mUrlRequestContextAdapter); 116 nativeDestroy(mUrlRequestContextAdapter);
116 mUrlRequestContextAdapter = 0; 117 mUrlRequestContextAdapter = 0;
117 } 118 }
118 } 119 }
119 120
120 @Override 121 @Override
121 public void startNetLogToFile(String fileName) { 122 public void startNetLogToFile(String fileName) {
122 synchronized (mLock) { 123 synchronized (mLock) {
123 checkHaveAdapter(); 124 checkHaveAdapter();
124 nativeStartNetLogToFile(mUrlRequestContextAdapter, fileName); 125 nativeStartNetLogToFile(mUrlRequestContextAdapter, fileName);
125 } 126 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 mInitCompleted.open(); 191 mInitCompleted.open();
191 } 192 }
192 Thread.currentThread().setName("ChromiumNet"); 193 Thread.currentThread().setName("ChromiumNet");
193 Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); 194 Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
194 } 195 }
195 196
196 // Native methods are implemented in cronet_url_request_context.cc. 197 // Native methods are implemented in cronet_url_request_context.cc.
197 private native long nativeCreateRequestContextAdapter(Context context, 198 private native long nativeCreateRequestContextAdapter(Context context,
198 String config); 199 String config);
199 200
200 private native void nativeDestroyRequestContextAdapter(
201 long urlRequestContextAdapter);
202
203 private native void nativeStartNetLogToFile(
204 long urlRequestContextAdapter, String fileName);
205
206 private native void nativeStopNetLog(long urlRequestContextAdapter);
207
208 private native int nativeSetMinLogLevel(int loggingLevel); 201 private native int nativeSetMinLogLevel(int loggingLevel);
209 202
210 private native void nativeInitRequestContextOnMainThread( 203 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
211 long urlRequestContextAdapter); 204 private native void nativeDestroy(long nativePtr);
205
206 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
207 private native void nativeStartNetLogToFile(long nativePtr,
208 String fileName);
209
210 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
211 private native void nativeStopNetLog(long nativePtr);
212
213 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
214 private native void nativeInitRequestContextOnMainThread(long nativePtr);
212 } 215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698