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_logging_handler_host.h" | 5 #include "chrome/browser/media/webrtc_logging_handler_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 276 |
277 void WebRtcLoggingHandlerHost::StartLoggingIfAllowed() { | 277 void WebRtcLoggingHandlerHost::StartLoggingIfAllowed() { |
278 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 278 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
279 if (!g_browser_process->webrtc_log_uploader()->ApplyForStartLogging()) { | 279 if (!g_browser_process->webrtc_log_uploader()->ApplyForStartLogging()) { |
280 logging_state_ = CLOSED; | 280 logging_state_ = CLOSED; |
281 FireGenericDoneCallback( | 281 FireGenericDoneCallback( |
282 &start_callback_, false, "Cannot start, maybe the maximum number of " | 282 &start_callback_, false, "Cannot start, maybe the maximum number of " |
283 "simultaneuos logs has been reached."); | 283 "simultaneuos logs has been reached."); |
284 return; | 284 return; |
285 } | 285 } |
286 system_request_context_ = g_browser_process->system_request_context(); | |
287 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( | 286 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( |
288 &WebRtcLoggingHandlerHost::DoStartLogging, this)); | 287 &WebRtcLoggingHandlerHost::DoStartLogging, this)); |
289 } | 288 } |
290 | 289 |
291 void WebRtcLoggingHandlerHost::DoStartLogging() { | 290 void WebRtcLoggingHandlerHost::DoStartLogging() { |
292 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
293 | 292 |
294 log_buffer_.reset(new unsigned char[kWebRtcLogSize]); | 293 log_buffer_.reset(new unsigned char[kWebRtcLogSize]); |
295 circular_buffer_.reset( | 294 circular_buffer_.reset( |
296 new PartialCircularBuffer(log_buffer_.get(), | 295 new PartialCircularBuffer(log_buffer_.get(), |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 WebRtcLogUploadDoneData upload_done_data; | 407 WebRtcLogUploadDoneData upload_done_data; |
409 upload_done_data.upload_list_path = | 408 upload_done_data.upload_list_path = |
410 WebRtcLogUploadList::GetFilePathForProfile(profile_); | 409 WebRtcLogUploadList::GetFilePathForProfile(profile_); |
411 upload_done_data.callback = upload_callback_; | 410 upload_done_data.callback = upload_callback_; |
412 upload_done_data.host = this; | 411 upload_done_data.host = this; |
413 upload_callback_.Reset(); | 412 upload_callback_.Reset(); |
414 | 413 |
415 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind( | 414 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind( |
416 &WebRtcLogUploader::LoggingStoppedDoUpload, | 415 &WebRtcLogUploader::LoggingStoppedDoUpload, |
417 base::Unretained(g_browser_process->webrtc_log_uploader()), | 416 base::Unretained(g_browser_process->webrtc_log_uploader()), |
418 system_request_context_, | |
419 Passed(&log_buffer_), | 417 Passed(&log_buffer_), |
420 kWebRtcLogSize, | 418 kWebRtcLogSize, |
421 meta_data_, | 419 meta_data_, |
422 upload_done_data)); | 420 upload_done_data)); |
423 | 421 |
424 meta_data_.clear(); | 422 meta_data_.clear(); |
425 circular_buffer_.reset(); | 423 circular_buffer_.reset(); |
426 } | 424 } |
427 | 425 |
428 void WebRtcLoggingHandlerHost::FireGenericDoneCallback( | 426 void WebRtcLoggingHandlerHost::FireGenericDoneCallback( |
429 GenericDoneCallback* callback, bool success, | 427 GenericDoneCallback* callback, bool success, |
430 const std::string& error_message) { | 428 const std::string& error_message) { |
431 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 429 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
432 DCHECK(!(*callback).is_null()); | 430 DCHECK(!(*callback).is_null()); |
433 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 431 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
434 base::Bind(*callback, success, | 432 base::Bind(*callback, success, |
435 error_message)); | 433 error_message)); |
436 (*callback).Reset(); | 434 (*callback).Reset(); |
437 } | 435 } |
OLD | NEW |