OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ |
6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 typedef struct z_stream_s z_stream; | 28 typedef struct z_stream_s z_stream; |
29 | 29 |
30 // Used when uploading is done to perform post-upload actions. |log_path| is | 30 // Used when uploading is done to perform post-upload actions. |log_path| is |
31 // also used pre-upload. | 31 // also used pre-upload. |
32 struct WebRtcLogUploadDoneData { | 32 struct WebRtcLogUploadDoneData { |
33 WebRtcLogUploadDoneData(); | 33 WebRtcLogUploadDoneData(); |
34 ~WebRtcLogUploadDoneData(); | 34 ~WebRtcLogUploadDoneData(); |
35 | 35 |
36 base::FilePath log_path; | 36 base::FilePath log_path; |
37 base::FilePath incoming_rtp_dump; | |
38 base::FilePath outgoing_rtp_dump; | |
39 WebRtcLoggingHandlerHost::UploadDoneCallback callback; | 37 WebRtcLoggingHandlerHost::UploadDoneCallback callback; |
40 scoped_refptr<WebRtcLoggingHandlerHost> host; | 38 scoped_refptr<WebRtcLoggingHandlerHost> host; |
41 std::string local_log_id; | 39 std::string local_log_id; |
42 }; | 40 }; |
43 | 41 |
44 // WebRtcLogUploader uploads WebRTC logs, keeps count of how many logs have | 42 // WebRtcLogUploader uploads WebRTC logs, keeps count of how many logs have |
45 // been started and denies further logs if a limit is reached. It also adds | 43 // been started and denies further logs if a limit is reached. It also adds |
46 // the timestamp and report ID of the uploded log to a text file. There must | 44 // the timestamp and report ID of the uploded log to a text file. There must |
47 // only be one object of this type. | 45 // only be one object of this type. |
48 class WebRtcLogUploader : public net::URLFetcherDelegate { | 46 class WebRtcLogUploader : public net::URLFetcherDelegate { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 private: | 92 private: |
95 FRIEND_TEST_ALL_PREFIXES(WebRtcLogUploaderTest, | 93 FRIEND_TEST_ALL_PREFIXES(WebRtcLogUploaderTest, |
96 AddLocallyStoredLogInfoToUploadListFile); | 94 AddLocallyStoredLogInfoToUploadListFile); |
97 FRIEND_TEST_ALL_PREFIXES(WebRtcLogUploaderTest, | 95 FRIEND_TEST_ALL_PREFIXES(WebRtcLogUploaderTest, |
98 AddUploadedLogInfoToUploadListFile); | 96 AddUploadedLogInfoToUploadListFile); |
99 | 97 |
100 // Sets up a multipart body to be uploaded. The body is produced according | 98 // Sets up a multipart body to be uploaded. The body is produced according |
101 // to RFC 2046. | 99 // to RFC 2046. |
102 void SetupMultipart(std::string* post_data, | 100 void SetupMultipart(std::string* post_data, |
103 const std::vector<uint8>& compressed_log, | 101 const std::vector<uint8>& compressed_log, |
104 const base::FilePath& incoming_rtp_dump, | |
105 const base::FilePath& outgoing_rtp_dump, | |
106 const std::map<std::string, std::string>& meta_data); | 102 const std::map<std::string, std::string>& meta_data); |
107 | 103 |
| 104 // Adds |compressed_log| to |post_data|. |
| 105 void AddLogData(std::string* post_data, |
| 106 const std::vector<uint8>& compressed_log); |
| 107 |
108 void CompressLog(std::vector<uint8>* compressed_log, | 108 void CompressLog(std::vector<uint8>* compressed_log, |
109 uint8* input, | 109 uint8* input, |
110 uint32 input_size); | 110 uint32 input_size); |
111 | 111 |
112 void ResizeForNextOutput(std::vector<uint8>* compressed_log, | 112 void ResizeForNextOutput(std::vector<uint8>* compressed_log, |
113 z_stream* stream); | 113 z_stream* stream); |
114 | 114 |
115 void CreateAndStartURLFetcher( | 115 void CreateAndStartURLFetcher( |
116 const WebRtcLogUploadDoneData& upload_done_data, | 116 const WebRtcLogUploadDoneData& upload_done_data, |
117 scoped_ptr<std::string> post_data); | 117 scoped_ptr<std::string> post_data); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // Only accessed on the UI thread. | 169 // Only accessed on the UI thread. |
170 UploadDoneDataMap upload_done_data_; | 170 UploadDoneDataMap upload_done_data_; |
171 | 171 |
172 // When shutting down, don't create new URLFetchers. | 172 // When shutting down, don't create new URLFetchers. |
173 bool shutting_down_; | 173 bool shutting_down_; |
174 | 174 |
175 DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader); | 175 DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader); |
176 }; | 176 }; |
177 | 177 |
178 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ | 178 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ |
OLD | NEW |