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

Side by Side Diff: content/public/child/request_peer.h

Issue 1159113009: Revert of Make WebURLLoader capable of retaining received buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « content/public/child/fixed_received_data.cc ('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 // 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 #ifndef CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ 5 #ifndef CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_
6 #define CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ 6 #define CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
13 12
14 class GURL; 13 class GURL;
15 14
16 namespace base { 15 namespace base {
17 class TimeTicks; 16 class TimeTicks;
18 } 17 }
19 18
20 namespace net { 19 namespace net {
21 struct RedirectInfo; 20 struct RedirectInfo;
22 } 21 }
23 22
24 namespace content { 23 namespace content {
25 24
26 struct ResourceResponseInfo; 25 struct ResourceResponseInfo;
27 26
28 // This is implemented by our custom resource loader within content. The Peer 27 // This is implemented by our custom resource loader within content. The Peer
29 // and it's bridge should have identical lifetimes as they represent each end of 28 // and it's bridge should have identical lifetimes as they represent each end of
30 // a communication channel. 29 // a communication channel.
31 // 30 //
32 // These callbacks mirror net::URLRequest::Delegate and the order and 31 // These callbacks mirror net::URLRequest::Delegate and the order and
33 // conditions in which they will be called are identical. See url_request.h 32 // conditions in which they will be called are identical. See url_request.h
34 // for more information. 33 // for more information.
35 class CONTENT_EXPORT RequestPeer { 34 class CONTENT_EXPORT RequestPeer {
36 public: 35 public:
37 // This class represents data gotten from the Browser process. Each data
38 // consists of |payload|, |length| and |encoded_length|. The payload is
39 // valid only when the data instance is valid.
40 // In order to work with Chrome resource loading IPC, it is desirable to
41 // reclaim data in FIFO order in a RequestPeer in terms of performance.
42 // |payload|, |length| and |encoded_length| functions are thread-safe, but
43 // the data object itself must be destroyed on the original thread.
44 class CONTENT_EXPORT ReceivedData {
45 public:
46 virtual ~ReceivedData() {}
47 virtual const char* payload() const = 0;
48 virtual int length() const = 0;
49 // The encoded_length is the length of the encoded data transferred
50 // over the network, which could be different from data length (e.g. for
51 // gzipped content).
52 virtual int encoded_length() const = 0;
53 };
54
55 // Called as upload progress is made. 36 // Called as upload progress is made.
56 // note: only for requests with upload progress enabled. 37 // note: only for requests with upload progress enabled.
57 virtual void OnUploadProgress(uint64 position, uint64 size) = 0; 38 virtual void OnUploadProgress(uint64 position, uint64 size) = 0;
58 39
59 // Called when a redirect occurs. The implementation may return false to 40 // Called when a redirect occurs. The implementation may return false to
60 // suppress the redirect. The ResourceResponseInfo provides information about 41 // suppress the redirect. The ResourceResponseInfo provides information about
61 // the redirect response and the RedirectInfo includes information about the 42 // the redirect response and the RedirectInfo includes information about the
62 // request to be made if the method returns true. 43 // request to be made if the method returns true.
63 virtual bool OnReceivedRedirect(const net::RedirectInfo& redirect_info, 44 virtual bool OnReceivedRedirect(const net::RedirectInfo& redirect_info,
64 const ResourceResponseInfo& info) = 0; 45 const ResourceResponseInfo& info) = 0;
65 46
66 // Called when response headers are available (after all redirects have 47 // Called when response headers are available (after all redirects have
67 // been followed). 48 // been followed).
68 virtual void OnReceivedResponse(const ResourceResponseInfo& info) = 0; 49 virtual void OnReceivedResponse(const ResourceResponseInfo& info) = 0;
69 50
70 // Called when a chunk of response data is downloaded. This method may be 51 // Called when a chunk of response data is downloaded. This method may be
71 // called multiple times or not at all if an error occurs. This method is 52 // called multiple times or not at all if an error occurs. This method is
72 // only called if RequestInfo::download_to_file was set to true, and in 53 // only called if RequestInfo::download_to_file was set to true, and in
73 // that case, OnReceivedData will not be called. 54 // that case, OnReceivedData will not be called.
74 // The encoded_data_length is the length of the encoded data transferred 55 // The encoded_data_length is the length of the encoded data transferred
75 // over the network, which could be different from data length (e.g. for 56 // over the network, which could be different from data length (e.g. for
76 // gzipped content). 57 // gzipped content).
77 virtual void OnDownloadedData(int len, int encoded_data_length) = 0; 58 virtual void OnDownloadedData(int len, int encoded_data_length) = 0;
78 59
79 // Called when a chunk of response data is available. This method may 60 // Called when a chunk of response data is available. This method may
80 // be called multiple times or not at all if an error occurs. 61 // be called multiple times or not at all if an error occurs.
81 virtual void OnReceivedData(scoped_ptr<ReceivedData> data) = 0; 62 // The encoded_data_length is the length of the encoded data transferred
63 // over the network, which could be different from data length (e.g. for
64 // gzipped content).
65 virtual void OnReceivedData(const char* data,
66 int data_length,
67 int encoded_data_length) = 0;
82 68
83 // Called when metadata generated by the renderer is retrieved from the 69 // Called when metadata generated by the renderer is retrieved from the
84 // cache. This method may be called zero or one times. 70 // cache. This method may be called zero or one times.
85 virtual void OnReceivedCachedMetadata(const char* data, int len) {} 71 virtual void OnReceivedCachedMetadata(const char* data, int len) {}
86 72
87 // Called when the response is complete. This method signals completion of 73 // Called when the response is complete. This method signals completion of
88 // the resource load. 74 // the resource load.
89 virtual void OnCompletedRequest(int error_code, 75 virtual void OnCompletedRequest(int error_code,
90 bool was_ignored_by_handler, 76 bool was_ignored_by_handler,
91 bool stale_copy_in_cache, 77 bool stale_copy_in_cache,
92 const std::string& security_info, 78 const std::string& security_info,
93 const base::TimeTicks& completion_time, 79 const base::TimeTicks& completion_time,
94 int64 total_transfer_size) = 0; 80 int64 total_transfer_size) = 0;
95 81
96 protected: 82 protected:
97 virtual ~RequestPeer() {} 83 virtual ~RequestPeer() {}
98 }; 84 };
99 85
100 } // namespace content 86 } // namespace content
101 87
102 #endif // CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ 88 #endif // CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_
OLDNEW
« no previous file with comments | « content/public/child/fixed_received_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698