| 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 java.util.ArrayList; | 7 import java.util.ArrayList; |
| 8 import java.util.Collections; | 8 import java.util.Collections; |
| 9 import java.util.List; | 9 import java.util.List; |
| 10 import java.util.Locale; | 10 import java.util.Locale; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 private final AtomicLong mReceivedBytesCount; | 28 private final AtomicLong mReceivedBytesCount; |
| 29 private final HeaderBlock mHeaders; | 29 private final HeaderBlock mHeaders; |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * Unmodifiable container of response headers or trailers. | 32 * Unmodifiable container of response headers or trailers. |
| 33 */ | 33 */ |
| 34 public static final class HeaderBlock { | 34 public static final class HeaderBlock { |
| 35 private final List<Map.Entry<String, String>> mAllHeadersList; | 35 private final List<Map.Entry<String, String>> mAllHeadersList; |
| 36 private Map<String, List<String>> mHeadersMap; | 36 private Map<String, List<String>> mHeadersMap; |
| 37 | 37 |
| 38 HeaderBlock(List<Map.Entry<String, String>> allHeadersList) { | 38 /** |
| 39 * @hide only used by internal implementation. |
| 40 */ |
| 41 public HeaderBlock(List<Map.Entry<String, String>> allHeadersList) { |
| 39 mAllHeadersList = allHeadersList; | 42 mAllHeadersList = allHeadersList; |
| 40 } | 43 } |
| 41 | 44 |
| 42 /** | 45 /** |
| 43 * Returns an unmodifiable list of the response header field and value p
airs. | 46 * Returns an unmodifiable list of the response header field and value p
airs. |
| 44 * The headers are in the same order they are received over the wire. | 47 * The headers are in the same order they are received over the wire. |
| 45 * | 48 * |
| 46 * @return an unmodifiable list of response header field and value pairs | 49 * @return an unmodifiable list of response header field and value pairs |
| 47 */ | 50 */ |
| 48 public List<Map.Entry<String, String>> getAsList() { | 51 public List<Map.Entry<String, String>> getAsList() { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 return String.format(Locale.ROOT, "UrlResponseInfo@[%s][%s]: urlChain =
%s, " | 211 return String.format(Locale.ROOT, "UrlResponseInfo@[%s][%s]: urlChain =
%s, " |
| 209 + "httpStatus = %d %s, headers = %s, wasCached = %b, " | 212 + "httpStatus = %d %s, headers = %s, wasCached = %b, " |
| 210 + "negotiatedProtocol = %s, proxyServer= %s, receivedByt
esCount = %d", | 213 + "negotiatedProtocol = %s, proxyServer= %s, receivedByt
esCount = %d", |
| 211 // Prevent asserting on the contents of this string | 214 // Prevent asserting on the contents of this string |
| 212 Integer.toHexString(System.identityHashCode(this)), getUrl(), | 215 Integer.toHexString(System.identityHashCode(this)), getUrl(), |
| 213 getUrlChain().toString(), getHttpStatusCode(), getHttpStatusText
(), | 216 getUrlChain().toString(), getHttpStatusCode(), getHttpStatusText
(), |
| 214 getAllHeadersAsList().toString(), wasCached(), getNegotiatedProt
ocol(), | 217 getAllHeadersAsList().toString(), wasCached(), getNegotiatedProt
ocol(), |
| 215 getProxyServer(), getReceivedBytesCount()); | 218 getProxyServer(), getReceivedBytesCount()); |
| 216 } | 219 } |
| 217 | 220 |
| 218 // Sets mReceivedBytesCount. Must not be called after request completion or
cancellation. | 221 /** |
| 219 void setReceivedBytesCount(long currentReceivedBytesCount) { | 222 * Sets mReceivedBytesCount. Must not be called after request completion or
cancellation. |
| 223 * @hide only used by internal implementation. |
| 224 */ |
| 225 public void setReceivedBytesCount(long currentReceivedBytesCount) { |
| 220 mReceivedBytesCount.set(currentReceivedBytesCount); | 226 mReceivedBytesCount.set(currentReceivedBytesCount); |
| 221 } | 227 } |
| 222 } | 228 } |
| OLD | NEW |