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

Side by Side Diff: http_fetcher.h

Issue 5835004: AU: MultiHttpFetcher cleanup/rewrite (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: fixes for review/merge latest trunk Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « SConstruct ('k') | http_fetcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__ 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__ 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Used to unpause an HttpFetcher and let the bytes stream in again. 79 // Used to unpause an HttpFetcher and let the bytes stream in again.
80 // If a delegate is set, ReceivedBytes() may be called on it before 80 // If a delegate is set, ReceivedBytes() may be called on it before
81 // Unpause() returns 81 // Unpause() returns
82 virtual void Unpause() = 0; 82 virtual void Unpause() = 0;
83 83
84 // These two function are overloaded in LibcurlHttp fetcher to speed 84 // These two function are overloaded in LibcurlHttp fetcher to speed
85 // testing. 85 // testing.
86 virtual void set_idle_seconds(int seconds) {} 86 virtual void set_idle_seconds(int seconds) {}
87 virtual void set_retry_seconds(int seconds) {} 87 virtual void set_retry_seconds(int seconds) {}
88 88
89 ProxyResolver* proxy_resolver() const { return proxy_resolver_; }
90
91 // These are used for testing:
92 virtual void SetConnectionAsExpensive(bool is_expensive) {}
93 virtual void SetBuildType(bool is_official) {}
94
89 protected: 95 protected:
90 // The URL we're actively fetching from 96 // The URL we're actively fetching from
91 std::string url_; 97 std::string url_;
92 98
93 // POST data for the transfer, and whether or not it was ever set 99 // POST data for the transfer, and whether or not it was ever set
94 bool post_data_set_; 100 bool post_data_set_;
95 std::vector<char> post_data_; 101 std::vector<char> post_data_;
96 102
97 // The server's HTTP response code from the last transfer. This 103 // The server's HTTP response code from the last transfer. This
98 // field should be set to 0 when a new transfer is initiated, and 104 // field should be set to 0 when a new transfer is initiated, and
(...skipping 16 matching lines...) Expand all
115 class HttpFetcherDelegate { 121 class HttpFetcherDelegate {
116 public: 122 public:
117 // Called every time bytes are received. 123 // Called every time bytes are received.
118 virtual void ReceivedBytes(HttpFetcher* fetcher, 124 virtual void ReceivedBytes(HttpFetcher* fetcher,
119 const char* bytes, 125 const char* bytes,
120 int length) = 0; 126 int length) = 0;
121 127
122 // Called if the fetcher seeks to a particular offset. 128 // Called if the fetcher seeks to a particular offset.
123 virtual void SeekToOffset(off_t offset) {} 129 virtual void SeekToOffset(off_t offset) {}
124 130
125 // Called when the transfer has completed successfully or been aborted through 131 // When a transfer has completed, exactly one of these two methods will be
126 // means other than TerminateTransfer. It's OK to destroy the |fetcher| object 132 // called. TransferTerminated is called when the transfer has been aborted
127 // in this callback. 133 // through TerminateTransfer. TransferComplete is called in all other
134 // situations. It's OK to destroy the |fetcher| object in this callback.
128 virtual void TransferComplete(HttpFetcher* fetcher, bool successful) = 0; 135 virtual void TransferComplete(HttpFetcher* fetcher, bool successful) = 0;
129
130 // Called when the transfer has been aborted through TerminateTransfer. It's
131 // OK to destroy the |fetcher| object in this callback.
132 virtual void TransferTerminated(HttpFetcher* fetcher) {} 136 virtual void TransferTerminated(HttpFetcher* fetcher) {}
133 }; 137 };
134 138
135 } // namespace chromeos_update_engine 139 } // namespace chromeos_update_engine
136 140
137 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__ 141 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__
OLDNEW
« no previous file with comments | « SConstruct ('k') | http_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698