| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 int dataLength, | 80 int dataLength, |
| 81 int encodedDataLength) {} | 81 int encodedDataLength) {} |
| 82 | 82 |
| 83 // Called when a chunk of response data is received. |dataLength| is the | 83 // Called when a chunk of response data is received. |dataLength| is the |
| 84 // number of bytes pointed to by |data|. |encodedDataLength| is the number | 84 // number of bytes pointed to by |data|. |encodedDataLength| is the number |
| 85 // of bytes actually received from network to serve this chunk, including | 85 // of bytes actually received from network to serve this chunk, including |
| 86 // HTTP headers and framing if relevant. It is 0 if the response was served | 86 // HTTP headers and framing if relevant. It is 0 if the response was served |
| 87 // from cache, and -1 if this information is unavailable. | 87 // from cache, and -1 if this information is unavailable. |
| 88 // TODO(ricea): -1 is problematic for consumers maintaining a running | 88 // TODO(ricea): -1 is problematic for consumers maintaining a running |
| 89 // total. Investigate using 0 for all unavailable cases. | 89 // total. Investigate using 0 for all unavailable cases. |
| 90 // |encodedBodyLength| is the number of bytes used to store this chunk, | |
| 91 // possibly encrypted, excluding headers or framing. It is set even if the | |
| 92 // response was served from cache. | |
| 93 virtual void didReceiveData(WebURLLoader*, | 90 virtual void didReceiveData(WebURLLoader*, |
| 94 const char* data, | 91 const char* data, |
| 95 int dataLength, | 92 int dataLength, |
| 96 int encodedDataLength, | 93 int encodedDataLength) {} |
| 97 int encodedBodyLength) {} | |
| 98 | 94 |
| 99 // Called when a chunk of renderer-generated metadata is received from the | 95 // Called when a chunk of renderer-generated metadata is received from the |
| 100 // cache. | 96 // cache. |
| 101 virtual void didReceiveCachedMetadata(WebURLLoader*, | 97 virtual void didReceiveCachedMetadata(WebURLLoader*, |
| 102 const char* data, | 98 const char* data, |
| 103 int dataLength) {} | 99 int dataLength) {} |
| 104 | 100 |
| 105 // Called when the load completes successfully. | 101 // Called when the load completes successfully. |
| 106 // |totalEncodedDataLength| may be equal to kUnknownEncodedDataLength. | 102 // |totalEncodedDataLength| may be equal to kUnknownEncodedDataLength. |
| 107 virtual void didFinishLoading(WebURLLoader* loader, | 103 virtual void didFinishLoading(WebURLLoader* loader, |
| 108 double finishTime, | 104 double finishTime, |
| 109 int64_t totalEncodedDataLength) {} | 105 int64_t totalEncodedDataLength, |
| 106 int64_t totalEncodedBodyLength) {} |
| 110 | 107 |
| 111 // Called when the load completes with an error. | 108 // Called when the load completes with an error. |
| 112 // |totalEncodedDataLength| may be equal to kUnknownEncodedDataLength. | 109 // |totalEncodedDataLength| may be equal to kUnknownEncodedDataLength. |
| 113 virtual void didFail(WebURLLoader*, | 110 virtual void didFail(WebURLLoader*, |
| 114 const WebURLError&, | 111 const WebURLError&, |
| 115 int64_t totalEncodedDataLength) {} | 112 int64_t totalEncodedDataLength, |
| 113 int64_t totalEncodedBodyLength) {} |
| 116 | 114 |
| 117 // Value passed to didFinishLoading when total encoded data length isn't | 115 // Value passed to didFinishLoading when total encoded data length isn't |
| 118 // known. | 116 // known. |
| 119 static const int64_t kUnknownEncodedDataLength = -1; | 117 static const int64_t kUnknownEncodedDataLength = -1; |
| 120 | 118 |
| 121 protected: | 119 protected: |
| 122 virtual ~WebURLLoaderClient() {} | 120 virtual ~WebURLLoaderClient() {} |
| 123 }; | 121 }; |
| 124 | 122 |
| 125 } // namespace blink | 123 } // namespace blink |
| 126 | 124 |
| 127 #endif | 125 #endif |
| OLD | NEW |