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 #include "chrome/browser/media/webrtc_log_uploader.h" | 5 #include "chrome/browser/media/webrtc_log_uploader.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "chrome/common/chrome_version_info.h" | 10 #include "chrome/common/chrome_version_info.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 AddLogData(post_data, log_buffer, log_buffer_length); | 122 AddLogData(post_data, log_buffer, log_buffer_length); |
123 net::AddMultipartFinalDelimiterForUpload(kMultipartBoundary, post_data); | 123 net::AddMultipartFinalDelimiterForUpload(kMultipartBoundary, post_data); |
124 } | 124 } |
125 | 125 |
126 void WebRtcLogUploader::AddLogData(std::string* post_data, | 126 void WebRtcLogUploader::AddLogData(std::string* post_data, |
127 uint8* log_buffer, | 127 uint8* log_buffer, |
128 uint32 log_buffer_length) { | 128 uint32 log_buffer_length) { |
129 post_data->append("--"); | 129 post_data->append("--"); |
130 post_data->append(kMultipartBoundary); | 130 post_data->append(kMultipartBoundary); |
131 post_data->append("\r\n"); | 131 post_data->append("\r\n"); |
132 post_data->append("Content-Disposition: form-data; name=\"log\""); | 132 post_data->append("Content-Disposition: form-data; name=\"webrtc_log\""); |
133 post_data->append("; filename=\"log.gz\"\r\n"); | 133 post_data->append("; filename=\"webrtc_log.gz\"\r\n"); |
134 post_data->append("Content-Type: application/gzip\r\n\r\n"); | 134 post_data->append("Content-Type: application/gzip\r\n\r\n"); |
135 | 135 |
136 CompressLog(post_data, log_buffer, log_buffer_length); | 136 CompressLog(post_data, log_buffer, log_buffer_length); |
137 | 137 |
138 post_data->append("\r\n"); | 138 post_data->append("\r\n"); |
139 } | 139 } |
140 | 140 |
141 void WebRtcLogUploader::CompressLog(std::string* post_data, | 141 void WebRtcLogUploader::CompressLog(std::string* post_data, |
142 uint8* input, | 142 uint8* input, |
143 uint32 input_size) { | 143 uint32 input_size) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 size_t old_size = post_data->size() - stream->avail_out; | 189 size_t old_size = post_data->size() - stream->avail_out; |
190 post_data->resize(old_size + kIntermediateCompressionBufferBytes); | 190 post_data->resize(old_size + kIntermediateCompressionBufferBytes); |
191 stream->next_out = reinterpret_cast<uint8*>(&(*post_data)[old_size]); | 191 stream->next_out = reinterpret_cast<uint8*>(&(*post_data)[old_size]); |
192 stream->avail_out = kIntermediateCompressionBufferBytes; | 192 stream->avail_out = kIntermediateCompressionBufferBytes; |
193 } | 193 } |
194 | 194 |
195 void WebRtcLogUploader::DecreaseLogCount() { | 195 void WebRtcLogUploader::DecreaseLogCount() { |
196 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 196 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
197 --log_count_; | 197 --log_count_; |
198 } | 198 } |
OLD | NEW |