OLD | NEW |
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 COMPONENTS_RAPPOR_LOG_UPLOADER_H_ | 5 #ifndef COMPONENTS_RAPPOR_LOG_UPLOADER_H_ |
6 #define COMPONENTS_RAPPOR_LOG_UPLOADER_H_ | 6 #define COMPONENTS_RAPPOR_LOG_UPLOADER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "components/rappor/log_uploader_interface.h" | 16 #include "components/rappor/log_uploader_interface.h" |
17 #include "net/url_request/url_fetcher_delegate.h" | 17 #include "net/url_request/url_fetcher_delegate.h" |
18 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 class URLFetcher; | 22 class URLFetcher; |
23 } | 23 } |
24 | 24 |
25 namespace rappor { | 25 namespace rappor { |
26 | 26 |
27 // Uploads logs from RapporService. Logs are passed in via QueueLog(), stored | 27 // Uploads logs from RapporServiceImpl. Logs are passed in via QueueLog(), |
28 // internally, and uploaded one at a time. A queued log will be uploaded at a | 28 // stored internally, and uploaded one at a time. A queued log will be uploaded |
29 // fixed interval after the successful upload of the previous logs. If an | 29 // at a fixed interval after the successful upload of the previous logs. If an |
30 // upload fails, the uploader will keep retrying the upload with an exponential | 30 // upload fails, the uploader will keep retrying the upload with an exponential |
31 // backoff interval. | 31 // backoff interval. |
32 class LogUploader : public net::URLFetcherDelegate, | 32 class LogUploader : public net::URLFetcherDelegate, |
33 public LogUploaderInterface { | 33 public LogUploaderInterface { |
34 public: | 34 public: |
35 // Constructor takes the |server_url| that logs should be uploaded to, the | 35 // Constructor takes the |server_url| that logs should be uploaded to, the |
36 // |mime_type| of the uploaded data, and |request_context| to create uploads | 36 // |mime_type| of the uploaded data, and |request_context| to create uploads |
37 // with. | 37 // with. |
38 LogUploader(const GURL& server_url, | 38 LogUploader(const GURL& server_url, |
39 const std::string& mime_type, | 39 const std::string& mime_type, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // The interval to wait after an upload's URLFetcher completion before | 104 // The interval to wait after an upload's URLFetcher completion before |
105 // starting the next upload attempt. | 105 // starting the next upload attempt. |
106 base::TimeDelta upload_interval_; | 106 base::TimeDelta upload_interval_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(LogUploader); | 108 DISALLOW_COPY_AND_ASSIGN(LogUploader); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace rappor | 111 } // namespace rappor |
112 | 112 |
113 #endif // COMPONENTS_RAPPOR_LOG_UPLOADER_H_ | 113 #endif // COMPONENTS_RAPPOR_LOG_UPLOADER_H_ |
OLD | NEW |