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

Side by Side Diff: components/rappor/log_uploader.h

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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
« no previous file with comments | « components/rappor/byte_vector_utils.h ('k') | components/rappor/log_uploader_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 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 <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 21 matching lines...) Expand all
32 public: 32 public:
33 // Constructor takes the |server_url| that logs should be uploaded to, the 33 // Constructor takes the |server_url| that logs should be uploaded to, the
34 // |mime_type| of the uploaded data, and |request_context| to create uploads 34 // |mime_type| of the uploaded data, and |request_context| to create uploads
35 // with. 35 // with.
36 LogUploader(const GURL& server_url, 36 LogUploader(const GURL& server_url,
37 const std::string& mime_type, 37 const std::string& mime_type,
38 net::URLRequestContextGetter* request_context); 38 net::URLRequestContextGetter* request_context);
39 39
40 // If the object is destroyed (or the program terminates) while logs are 40 // If the object is destroyed (or the program terminates) while logs are
41 // queued, the logs are lost. 41 // queued, the logs are lost.
42 virtual ~LogUploader(); 42 ~LogUploader() override;
43 43
44 // Adds an entry to the queue of logs to be uploaded to the server. The 44 // Adds an entry to the queue of logs to be uploaded to the server. The
45 // uploader makes no assumptions about the format of |log| and simply sends 45 // uploader makes no assumptions about the format of |log| and simply sends
46 // it verbatim to the server. 46 // it verbatim to the server.
47 void QueueLog(const std::string& log); 47 void QueueLog(const std::string& log);
48 48
49 protected: 49 protected:
50 // Checks if an upload has been scheduled. 50 // Checks if an upload has been scheduled.
51 virtual bool IsUploadScheduled() const; 51 virtual bool IsUploadScheduled() const;
52 52
53 // Schedules a future call to StartScheduledUpload if one isn't already 53 // Schedules a future call to StartScheduledUpload if one isn't already
54 // pending. Can be overridden for testing. 54 // pending. Can be overridden for testing.
55 virtual void ScheduleNextUpload(base::TimeDelta interval); 55 virtual void ScheduleNextUpload(base::TimeDelta interval);
56 56
57 // Starts transmission of the next log. Exposed for tests. 57 // Starts transmission of the next log. Exposed for tests.
58 void StartScheduledUpload(); 58 void StartScheduledUpload();
59 59
60 // Increases the upload interval each time it's called, to handle the case 60 // Increases the upload interval each time it's called, to handle the case
61 // where the server is having issues. Exposed for tests. 61 // where the server is having issues. Exposed for tests.
62 static base::TimeDelta BackOffUploadInterval(base::TimeDelta); 62 static base::TimeDelta BackOffUploadInterval(base::TimeDelta);
63 63
64 private: 64 private:
65 // Implements net::URLFetcherDelegate. Called after transmission completes 65 // Implements net::URLFetcherDelegate. Called after transmission completes
66 // (whether successful or not). 66 // (whether successful or not).
67 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; 67 void OnURLFetchComplete(const net::URLFetcher* source) override;
68 68
69 // Called when the upload is completed. 69 // Called when the upload is completed.
70 void OnUploadFinished(bool server_is_healthy, bool more_logs_remaining); 70 void OnUploadFinished(bool server_is_healthy, bool more_logs_remaining);
71 71
72 // The server URL to upload logs to. 72 // The server URL to upload logs to.
73 const GURL server_url_; 73 const GURL server_url_;
74 74
75 // The mime type to specify on uploaded logs. 75 // The mime type to specify on uploaded logs.
76 const std::string mime_type_; 76 const std::string mime_type_;
77 77
(...skipping 15 matching lines...) Expand all
93 // The interval to wait after an upload's URLFetcher completion before 93 // The interval to wait after an upload's URLFetcher completion before
94 // starting the next upload attempt. 94 // starting the next upload attempt.
95 base::TimeDelta upload_interval_; 95 base::TimeDelta upload_interval_;
96 96
97 DISALLOW_COPY_AND_ASSIGN(LogUploader); 97 DISALLOW_COPY_AND_ASSIGN(LogUploader);
98 }; 98 };
99 99
100 } // namespace rappor 100 } // namespace rappor
101 101
102 #endif // COMPONENTS_RAPPOR_LOG_UPLOADER_H_ 102 #endif // COMPONENTS_RAPPOR_LOG_UPLOADER_H_
OLDNEW
« no previous file with comments | « components/rappor/byte_vector_utils.h ('k') | components/rappor/log_uploader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698