OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.support.annotation.IntDef; | 8 import android.support.annotation.IntDef; |
9 import android.util.Log; | 9 import android.util.Log; |
10 | 10 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 } catch (JSONException e) { | 375 } catch (JSONException e) { |
376 // Intentionally do nothing. | 376 // Intentionally do nothing. |
377 } | 377 } |
378 return this; | 378 return this; |
379 } | 379 } |
380 | 380 |
381 /** | 381 /** |
382 * Build a {@link CronetEngine} using this builder's configuration. | 382 * Build a {@link CronetEngine} using this builder's configuration. |
383 */ | 383 */ |
384 public CronetEngine build() { | 384 public CronetEngine build() { |
385 return createContext(this); | 385 CronetEngine engine = createContext(this); |
| 386 // Clear MOCK_CERT_VERIFIER reference if there is any, since |
| 387 // the ownership has been transferred to the engine. |
| 388 mConfig.remove(CronetEngineBuilderList.MOCK_CERT_VERIFIER); |
| 389 return engine; |
386 } | 390 } |
387 } | 391 } |
388 | 392 |
389 private static final String TAG = "UrlRequestFactory"; | 393 private static final String TAG = "UrlRequestFactory"; |
390 private static final String CRONET_URL_REQUEST_CONTEXT = | 394 private static final String CRONET_URL_REQUEST_CONTEXT = |
391 "org.chromium.net.CronetUrlRequestContext"; | 395 "org.chromium.net.CronetUrlRequestContext"; |
392 | 396 |
393 /** | 397 /** |
394 * Creates a {@link UrlRequest} object. All callbacks will | 398 * Creates a {@link UrlRequest} object. All callbacks will |
395 * be called on {@code executor}'s thread. {@code executor} must not run | 399 * be called on {@code executor}'s thread. {@code executor} must not run |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 cronetEngine = possibleEngine; | 690 cronetEngine = possibleEngine; |
687 } | 691 } |
688 } catch (ClassNotFoundException e) { | 692 } catch (ClassNotFoundException e) { |
689 // Leave as null. | 693 // Leave as null. |
690 } catch (Exception e) { | 694 } catch (Exception e) { |
691 throw new IllegalStateException("Cannot instantiate: " + CRONET_URL_
REQUEST_CONTEXT, e); | 695 throw new IllegalStateException("Cannot instantiate: " + CRONET_URL_
REQUEST_CONTEXT, e); |
692 } | 696 } |
693 return cronetEngine; | 697 return cronetEngine; |
694 } | 698 } |
695 } | 699 } |
OLD | NEW |