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

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

Issue 1827883004: Synchronize native adapter access in CronetUrlRequestContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | no next file » | 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; 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;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 new ObserverList<NetworkQualityThroughputListener>(); 72 new ObserverList<NetworkQualityThroughputListener>();
73 73
74 @GuardedBy("mNetworkQualityLock") 74 @GuardedBy("mNetworkQualityLock")
75 private final ObserverList<RequestFinishedListener> mFinishedListenerList = 75 private final ObserverList<RequestFinishedListener> mFinishedListenerList =
76 new ObserverList<RequestFinishedListener>(); 76 new ObserverList<RequestFinishedListener>();
77 77
78 @UsedByReflection("CronetEngine.java") 78 @UsedByReflection("CronetEngine.java")
79 public CronetUrlRequestContext(CronetEngine.Builder builder) { 79 public CronetUrlRequestContext(CronetEngine.Builder builder) {
80 CronetLibraryLoader.ensureInitialized(builder.getContext(), builder); 80 CronetLibraryLoader.ensureInitialized(builder.getContext(), builder);
81 nativeSetMinLogLevel(getLoggingLevel()); 81 nativeSetMinLogLevel(getLoggingLevel());
82 mUrlRequestContextAdapter = nativeCreateRequestContextAdapter( 82 synchronized (mLock) {
83 createNativeUrlRequestContextConfig(builder.getContext(), builde r)); 83 mUrlRequestContextAdapter = nativeCreateRequestContextAdapter(
84 if (mUrlRequestContextAdapter == 0) { 84 createNativeUrlRequestContextConfig(builder.getContext(), bu ilder));
85 throw new NullPointerException("Context Adapter creation failed."); 85 if (mUrlRequestContextAdapter == 0) {
86 throw new NullPointerException("Context Adapter creation failed. ");
87 }
86 } 88 }
87 89
88 // Init native Chromium URLRequestContext on main UI thread. 90 // Init native Chromium URLRequestContext on main UI thread.
89 Runnable task = new Runnable() { 91 Runnable task = new Runnable() {
90 @Override 92 @Override
91 public void run() { 93 public void run() {
92 synchronized (mLock) { 94 synchronized (mLock) {
93 // mUrlRequestContextAdapter is guaranteed to exist until 95 // mUrlRequestContextAdapter is guaranteed to exist until
94 // initialization on main and network threads completes and 96 // initialization on main and network threads completes and
95 // initNetworkThread is called back on network thread. 97 // initNetworkThread is called back on network thread.
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 @NativeClassQualifiedName("CronetURLRequestContextAdapter") 504 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
503 private native void nativeEnableNetworkQualityEstimator( 505 private native void nativeEnableNetworkQualityEstimator(
504 long nativePtr, boolean useLocalHostRequests, boolean useSmallerResp onses); 506 long nativePtr, boolean useLocalHostRequests, boolean useSmallerResp onses);
505 507
506 @NativeClassQualifiedName("CronetURLRequestContextAdapter") 508 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
507 private native void nativeProvideRTTObservations(long nativePtr, boolean sho uld); 509 private native void nativeProvideRTTObservations(long nativePtr, boolean sho uld);
508 510
509 @NativeClassQualifiedName("CronetURLRequestContextAdapter") 511 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
510 private native void nativeProvideThroughputObservations(long nativePtr, bool ean should); 512 private native void nativeProvideThroughputObservations(long nativePtr, bool ean should);
511 } 513 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698