OLD | NEW |
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_LIBCURL_HTTP_FETCHER_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <curl/curl.h> | 10 #include <curl/curl.h> |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 static gboolean StaticRetryTimeoutCallback(void* arg) { | 78 static gboolean StaticRetryTimeoutCallback(void* arg) { |
79 return static_cast<LibcurlHttpFetcher*>(arg)->RetryTimeoutCallback(); | 79 return static_cast<LibcurlHttpFetcher*>(arg)->RetryTimeoutCallback(); |
80 } | 80 } |
81 | 81 |
82 // Calls into curl_multi_perform to let libcurl do its work. Returns after | 82 // Calls into curl_multi_perform to let libcurl do its work. Returns after |
83 // curl_multi_perform is finished, which may actually be after more than | 83 // curl_multi_perform is finished, which may actually be after more than |
84 // one call to curl_multi_perform. This method will set up the glib run | 84 // one call to curl_multi_perform. This method will set up the glib run |
85 // loop with sources for future work that libcurl will do. | 85 // loop with sources for future work that libcurl will do. |
86 // This method will not block. | 86 // This method will not block. |
87 // Returns true if we should resume immediately after this call. | 87 // Returns true if we should resume immediately after this call. |
88 bool CurlPerformOnce(); | 88 void CurlPerformOnce(); |
89 | 89 |
90 // Sets up glib main loop sources as needed by libcurl. This is generally | 90 // Sets up glib main loop sources as needed by libcurl. This is generally |
91 // the file descriptor of the socket and a timer in case nothing happens | 91 // the file descriptor of the socket and a timer in case nothing happens |
92 // on the fds. | 92 // on the fds. |
93 void SetupMainloopSources(); | 93 void SetupMainloopSources(); |
94 | 94 |
95 // Callback called by libcurl when new data has arrived on the transfer | 95 // Callback called by libcurl when new data has arrived on the transfer |
96 size_t LibcurlWrite(void *ptr, size_t size, size_t nmemb); | 96 size_t LibcurlWrite(void *ptr, size_t size, size_t nmemb); |
97 static size_t StaticLibcurlWrite(void *ptr, size_t size, | 97 static size_t StaticLibcurlWrite(void *ptr, size_t size, |
98 size_t nmemb, void *stream) { | 98 size_t nmemb, void *stream) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // Number of resumes performed. | 132 // Number of resumes performed. |
133 int retry_count_; | 133 int retry_count_; |
134 | 134 |
135 long idle_ms_; | 135 long idle_ms_; |
136 DISALLOW_COPY_AND_ASSIGN(LibcurlHttpFetcher); | 136 DISALLOW_COPY_AND_ASSIGN(LibcurlHttpFetcher); |
137 }; | 137 }; |
138 | 138 |
139 } // namespace chromeos_update_engine | 139 } // namespace chromeos_update_engine |
140 | 140 |
141 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ | 141 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ |
OLD | NEW |