| 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 <queue> | 9 #include <queue> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.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 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // The mime type to specify on uploaded logs. | 83 // The mime type to specify on uploaded logs. |
| 84 const std::string mime_type_; | 84 const std::string mime_type_; |
| 85 | 85 |
| 86 // The request context used to send uploads. | 86 // The request context used to send uploads. |
| 87 scoped_refptr<net::URLRequestContextGetter> request_context_; | 87 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 88 | 88 |
| 89 // True if the uploader is currently running. | 89 // True if the uploader is currently running. |
| 90 bool is_running_; | 90 bool is_running_; |
| 91 | 91 |
| 92 // The outstanding transmission that appears as a URL Fetch operation. | 92 // The outstanding transmission that appears as a URL Fetch operation. |
| 93 scoped_ptr<net::URLFetcher> current_fetch_; | 93 std::unique_ptr<net::URLFetcher> current_fetch_; |
| 94 | 94 |
| 95 // The logs that still need to be uploaded. | 95 // The logs that still need to be uploaded. |
| 96 std::queue<std::string> queued_logs_; | 96 std::queue<std::string> queued_logs_; |
| 97 | 97 |
| 98 // A timer used to delay before attempting another upload. | 98 // A timer used to delay before attempting another upload. |
| 99 base::OneShotTimer upload_timer_; | 99 base::OneShotTimer upload_timer_; |
| 100 | 100 |
| 101 // Indicates that the last triggered upload hasn't resolved yet. | 101 // Indicates that the last triggered upload hasn't resolved yet. |
| 102 bool has_callback_pending_; | 102 bool has_callback_pending_; |
| 103 | 103 |
| 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 |