Chromium Code Reviews| 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 // Change for readability | |
| 6 | |
| 5 #ifndef COMPONENTS_RAPPOR_LOG_UPLOADER_H_ | 7 #ifndef COMPONENTS_RAPPOR_LOG_UPLOADER_H_ |
| 6 #define COMPONENTS_RAPPOR_LOG_UPLOADER_H_ | 8 #define COMPONENTS_RAPPOR_LOG_UPLOADER_H_ |
| 7 | 9 |
| 8 #include <queue> | 10 #include <queue> |
| 9 #include <string> | 11 #include <string> |
| 10 | 12 |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 13 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 14 #include "net/url_request/url_fetcher_delegate.h" | 16 #include "net/url_request/url_fetcher_delegate.h" |
| 15 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
| 16 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 17 | 19 |
| 18 namespace net { | 20 namespace net { |
| 19 class URLFetcher; | 21 class URLFetcher; |
| 20 } | 22 } |
|
ktl
2014/03/17 11:22:25
Add end-of-namespace comment.
Ilya Sherman
2014/03/17 19:14:36
These are generally omitted in Chromium code for f
| |
| 21 | 23 |
| 22 namespace rappor { | 24 namespace rappor { |
| 23 | 25 |
| 24 // Handles uploading logs to an external server. | 26 // Handles uploading logs to an external server. |
| 25 class LogUploader : public net::URLFetcherDelegate { | 27 class LogUploader : public net::URLFetcherDelegate { |
| 26 public: | 28 public: |
| 27 // Constructor takes the server_url that logs should be uploaded to, the | 29 // Constructor takes the server_url that logs should be uploaded to, the |
| 28 // mime_type of the uploaded data, and request_context to create uploads | 30 // mime_type of the uploaded data, and request_context to create uploads |
| 29 // with. | 31 // with. |
| 30 LogUploader(const GURL& server_url, | 32 LogUploader(const GURL& server_url, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 49 // Starts transmission of the next log. Exposed for tests. | 51 // Starts transmission of the next log. Exposed for tests. |
| 50 void StartScheduledUpload(); | 52 void StartScheduledUpload(); |
| 51 | 53 |
| 52 // Increases the upload interval each time it's called, to handle the case | 54 // Increases the upload interval each time it's called, to handle the case |
| 53 // where the server is having issues. Exposed for tests. | 55 // where the server is having issues. Exposed for tests. |
| 54 static base::TimeDelta BackOffUploadInterval(base::TimeDelta); | 56 static base::TimeDelta BackOffUploadInterval(base::TimeDelta); |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 // Implementation of net::URLFetcherDelegate. Called after transmission | 59 // Implementation of net::URLFetcherDelegate. Called after transmission |
| 58 // completes (either successfully or with failure). | 60 // completes (either successfully or with failure). |
| 59 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 61 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
|
ktl
2014/03/17 11:22:25
Where's OVERRIDE defined? The current google3 pref
Ilya Sherman
2014/03/17 19:14:36
The style used here is the prevailing Chromium sty
| |
| 60 | 62 |
| 61 // Called when the upload is completed. | 63 // Called when the upload is completed. |
| 62 void OnUploadFinished(bool server_is_healthy, bool more_logs_remaining); | 64 void OnUploadFinished(bool server_is_healthy, bool more_logs_remaining); |
| 63 | 65 |
| 64 // The server URL to upload logs to. | 66 // The server URL to upload logs to. |
| 65 const GURL server_url_; | 67 const GURL server_url_; |
| 66 | 68 |
| 67 // The mime type to specify on uploaded logs. | 69 // The mime type to specify on uploaded logs. |
| 68 const std::string mime_type_; | 70 const std::string mime_type_; |
| 69 | 71 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 85 // The interval to wait after an upload's URLFetcher completion before | 87 // The interval to wait after an upload's URLFetcher completion before |
| 86 // starting the next upload attempt. | 88 // starting the next upload attempt. |
| 87 base::TimeDelta upload_interval_; | 89 base::TimeDelta upload_interval_; |
| 88 | 90 |
| 89 DISALLOW_COPY_AND_ASSIGN(LogUploader); | 91 DISALLOW_COPY_AND_ASSIGN(LogUploader); |
| 90 }; | 92 }; |
| 91 | 93 |
| 92 } // namespace rappor | 94 } // namespace rappor |
| 93 | 95 |
| 94 #endif // COMPONENTS_RAPPOR_LOG_UPLOADER_H_ | 96 #endif // COMPONENTS_RAPPOR_LOG_UPLOADER_H_ |
| OLD | NEW |