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

Side by Side Diff: public/platform/WebURLLoaderClient.h

Issue 603903003: [Streams] Pass WebDataConsumerHandle when the response arrives. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@web-data-pipe
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/web/AssociatedURLLoader.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef WebURLLoaderClient_h 31 #ifndef WebURLLoaderClient_h
32 #define WebURLLoaderClient_h 32 #define WebURLLoaderClient_h
33 33
34 #include "public/platform/WebDataConsumerHandle.h"
35
34 namespace blink { 36 namespace blink {
35 37
36 class WebURLLoader; 38 class WebURLLoader;
37 class WebURLRequest; 39 class WebURLRequest;
38 class WebURLResponse; 40 class WebURLResponse;
39 struct WebURLError; 41 struct WebURLError;
40 42
41 class WebURLLoaderClient { 43 class WebURLLoaderClient {
42 public: 44 public:
43 // Called when following a redirect. |newRequest| contains the request 45 // Called when following a redirect. |newRequest| contains the request
44 // generated by the redirect. The client may modify |newRequest|. 46 // generated by the redirect. The client may modify |newRequest|.
45 virtual void willSendRequest( 47 virtual void willSendRequest(
46 WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirect Response) { } 48 WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirect Response) { }
47 49
48 // Called to report upload progress. The bytes reported correspond to 50 // Called to report upload progress. The bytes reported correspond to
49 // the HTTP message body. 51 // the HTTP message body.
50 virtual void didSendData( 52 virtual void didSendData(
51 WebURLLoader*, unsigned long long bytesSent, unsigned long long totalByt esToBeSent) { } 53 WebURLLoader*, unsigned long long bytesSent, unsigned long long totalByt esToBeSent) { }
52 54
53 // Called when response headers are received. 55 // Called when response headers are received.
54 virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) { } 56 virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) { }
55 57
58 // Called when response headers are received.
59 // The ownership of |handle| is transferred to the callee.
60 virtual void didReceiveResponse(WebURLLoader* loader, const WebURLResponse& response, WebDataConsumerHandle* handle)
61 {
62 delete handle;
63 didReceiveResponse(loader, response);
64 }
65
56 // Called when a chunk of response data is downloaded. This is only called 66 // Called when a chunk of response data is downloaded. This is only called
57 // if WebURLRequest's downloadToFile flag was set to true. 67 // if WebURLRequest's downloadToFile flag was set to true.
58 virtual void didDownloadData(WebURLLoader*, int dataLength, int encodedDataL ength) { } 68 virtual void didDownloadData(WebURLLoader*, int dataLength, int encodedDataL ength) { }
59 69
60 // Called when a chunk of response data is received. 70 // Called when a chunk of response data is received.
61 virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength, int encodedDataLength) { } 71 virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength, int encodedDataLength) { }
62 72
63 // Called when a chunk of renderer-generated metadata is received from the c ache. 73 // Called when a chunk of renderer-generated metadata is received from the c ache.
64 virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int d ataLength) { } 74 virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int d ataLength) { }
65 75
66 // Called when the load completes successfully. 76 // Called when the load completes successfully.
67 // |totalEncodedDataLength| may be equal to kUnknownEncodedDataLength. 77 // |totalEncodedDataLength| may be equal to kUnknownEncodedDataLength.
68 virtual void didFinishLoading(WebURLLoader* loader, double finishTime, int64 _t totalEncodedDataLength) { } 78 virtual void didFinishLoading(WebURLLoader* loader, double finishTime, int64 _t totalEncodedDataLength) { }
69 79
70 // Called when the load completes with an error. 80 // Called when the load completes with an error.
71 virtual void didFail(WebURLLoader*, const WebURLError&) { } 81 virtual void didFail(WebURLLoader*, const WebURLError&) { }
72 82
73 // Value passed to didFinishLoading when total encoded data length isn't kno wn. 83 // Value passed to didFinishLoading when total encoded data length isn't kno wn.
74 static const int64_t kUnknownEncodedDataLength = -1; 84 static const int64_t kUnknownEncodedDataLength = -1;
75 85
76 protected: 86 protected:
77 virtual ~WebURLLoaderClient() { } 87 virtual ~WebURLLoaderClient() { }
78 }; 88 };
79 89
80 } // namespace blink 90 } // namespace blink
81 91
82 #endif 92 #endif
OLDNEW
« no previous file with comments | « Source/web/AssociatedURLLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698