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

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: Address review comments. 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.
mmenke 2014/09/29 18:53:19 If we're going to document the log level, we shoul
mef 2014/09/29 21:21:24 I'm fine with not documenting the log level, altho
mmenke 2014/09/29 21:24:30 Great, let's do that for now, then. I wonder if i
mef 2014/09/29 22:25:09 Done.
66 * If actively logging the call is ignored.
67 */
68 public abstract void startNetLogToFile(String fileName);
69
70 /**
71 * Stops NetLog logging and flushes file to disk. If a logging session is
72 * not in progress this call is ignored.
73 */
74 public abstract void stopNetLog();
75
62 private static HttpUrlRequestFactory createChromiumFactory( 76 private static HttpUrlRequestFactory createChromiumFactory(
63 Context context, HttpUrlRequestFactoryConfig config) { 77 Context context, HttpUrlRequestFactoryConfig config) {
64 HttpUrlRequestFactory factory = null; 78 HttpUrlRequestFactory factory = null;
65 try { 79 try {
66 Class<? extends HttpUrlRequestFactory> factoryClass = 80 Class<? extends HttpUrlRequestFactory> factoryClass =
67 HttpUrlRequestFactory.class.getClassLoader(). 81 HttpUrlRequestFactory.class.getClassLoader().
68 loadClass(CHROMIUM_URL_REQUEST_FACTORY). 82 loadClass(CHROMIUM_URL_REQUEST_FACTORY).
69 asSubclass(HttpUrlRequestFactory.class); 83 asSubclass(HttpUrlRequestFactory.class);
70 Constructor<? extends HttpUrlRequestFactory> constructor = 84 Constructor<? extends HttpUrlRequestFactory> constructor =
71 factoryClass.getConstructor( 85 factoryClass.getConstructor(
72 Context.class, HttpUrlRequestFactoryConfig.class); 86 Context.class, HttpUrlRequestFactoryConfig.class);
73 HttpUrlRequestFactory chromiumFactory = 87 HttpUrlRequestFactory chromiumFactory =
74 constructor.newInstance(context, config); 88 constructor.newInstance(context, config);
75 if (chromiumFactory.isEnabled()) { 89 if (chromiumFactory.isEnabled()) {
76 factory = chromiumFactory; 90 factory = chromiumFactory;
77 } 91 }
78 } catch (ClassNotFoundException e) { 92 } catch (ClassNotFoundException e) {
79 // Leave as null 93 // Leave as null
80 } catch (Exception e) { 94 } catch (Exception e) {
81 throw new IllegalStateException( 95 throw new IllegalStateException(
82 "Cannot instantiate: " + 96 "Cannot instantiate: " +
83 CHROMIUM_URL_REQUEST_FACTORY, 97 CHROMIUM_URL_REQUEST_FACTORY,
84 e); 98 e);
85 } 99 }
86 return factory; 100 return factory;
87 } 101 }
88 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698