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

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

Issue 610673002: Expose startNetLog / stopNetLog from HttpUrlRequestFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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.util.Log; 8 import android.util.Log;
9 9
10 import java.lang.reflect.Constructor; 10 import java.lang.reflect.Constructor;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 int requestPriority, Map<String, String> headers, 52 int requestPriority, Map<String, String> headers,
53 HttpUrlRequestListener listener); 53 HttpUrlRequestListener listener);
54 54
55 /** 55 /**
56 * Creates a new request intended for streaming. 56 * Creates a new request intended for streaming.
57 */ 57 */
58 public abstract HttpUrlRequest createRequest(String url, 58 public abstract HttpUrlRequest createRequest(String url,
59 int requestPriority, Map<String, String> headers, 59 int requestPriority, Map<String, String> headers,
60 WritableByteChannel channel, HttpUrlRequestListener listener); 60 WritableByteChannel channel, HttpUrlRequestListener listener);
61 61
62 /**
63 * Starts NetLog logging to a file named |fileName| in the
64 * application temporary directory. |fileName| must not be empty. Log level
65 * is LOG_ALL_BUT_BYTES. If the file exists it is truncated before starting.
66 * If actively logging the call is ignored.
67 */
68 public void startNetLogToFile(String fileName) {
xunjieli 2014/09/26 18:22:45 Empty functions here look a little weird. Can we m
mef 2014/09/26 18:33:49 Done.
69 }
70
71 /**
72 * Stops NetLog logging and flushes file to disk. If a logging session is
73 * not in progress this call is ignored.
74 */
75 public void stopNetLog() {
76 }
77
62 private static HttpUrlRequestFactory createChromiumFactory( 78 private static HttpUrlRequestFactory createChromiumFactory(
63 Context context, HttpUrlRequestFactoryConfig config) { 79 Context context, HttpUrlRequestFactoryConfig config) {
64 HttpUrlRequestFactory factory = null; 80 HttpUrlRequestFactory factory = null;
65 try { 81 try {
66 Class<? extends HttpUrlRequestFactory> factoryClass = 82 Class<? extends HttpUrlRequestFactory> factoryClass =
67 HttpUrlRequestFactory.class.getClassLoader(). 83 HttpUrlRequestFactory.class.getClassLoader().
68 loadClass(CHROMIUM_URL_REQUEST_FACTORY). 84 loadClass(CHROMIUM_URL_REQUEST_FACTORY).
69 asSubclass(HttpUrlRequestFactory.class); 85 asSubclass(HttpUrlRequestFactory.class);
70 Constructor<? extends HttpUrlRequestFactory> constructor = 86 Constructor<? extends HttpUrlRequestFactory> constructor =
71 factoryClass.getConstructor( 87 factoryClass.getConstructor(
72 Context.class, HttpUrlRequestFactoryConfig.class); 88 Context.class, HttpUrlRequestFactoryConfig.class);
73 HttpUrlRequestFactory chromiumFactory = 89 HttpUrlRequestFactory chromiumFactory =
74 constructor.newInstance(context, config); 90 constructor.newInstance(context, config);
75 if (chromiumFactory.isEnabled()) { 91 if (chromiumFactory.isEnabled()) {
76 factory = chromiumFactory; 92 factory = chromiumFactory;
77 } 93 }
78 } catch (ClassNotFoundException e) { 94 } catch (ClassNotFoundException e) {
79 // Leave as null 95 // Leave as null
80 } catch (Exception e) { 96 } catch (Exception e) {
81 throw new IllegalStateException( 97 throw new IllegalStateException(
82 "Cannot instantiate: " + 98 "Cannot instantiate: " +
83 CHROMIUM_URL_REQUEST_FACTORY, 99 CHROMIUM_URL_REQUEST_FACTORY,
84 e); 100 e);
85 } 101 }
86 return factory; 102 return factory;
87 } 103 }
88 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698