| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 void WebRtcLoggingHandlerHost::StoreLogContinue( | 305 void WebRtcLoggingHandlerHost::StoreLogContinue( |
| 306 const std::string& log_id, | 306 const std::string& log_id, |
| 307 const GenericDoneCallback& callback) { | 307 const GenericDoneCallback& callback) { |
| 308 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 308 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 309 DCHECK(!callback.is_null()); | 309 DCHECK(!callback.is_null()); |
| 310 | 310 |
| 311 scoped_ptr<WebRtcLogPaths> log_paths(new WebRtcLogPaths()); | 311 scoped_ptr<WebRtcLogPaths> log_paths(new WebRtcLogPaths()); |
| 312 ReleaseRtpDumps(log_paths.get()); | 312 ReleaseRtpDumps(log_paths.get()); |
| 313 | 313 |
| 314 content::BrowserThread::PostTaskAndReplyWithResult( | 314 content::BrowserThread::PostTaskAndReplyWithResult( |
| 315 content::BrowserThread::FILE, | 315 content::BrowserThread::FILE, FROM_HERE, |
| 316 FROM_HERE, | |
| 317 base::Bind(&WebRtcLoggingHandlerHost::GetLogDirectoryAndEnsureExists, | 316 base::Bind(&WebRtcLoggingHandlerHost::GetLogDirectoryAndEnsureExists, |
| 318 this), | 317 this), |
| 319 base::Bind(&WebRtcLoggingHandlerHost::StoreLogInDirectory, this, log_id, | 318 base::Bind(&WebRtcLoggingHandlerHost::StoreLogInDirectory, this, log_id, |
| 320 Passed(&log_paths), callback)); | 319 base::Passed(&log_paths), callback)); |
| 321 } | 320 } |
| 322 | 321 |
| 323 void WebRtcLoggingHandlerHost::LogMessage(const std::string& message) { | 322 void WebRtcLoggingHandlerHost::LogMessage(const std::string& message) { |
| 324 BrowserThread::PostTask( | 323 BrowserThread::PostTask( |
| 325 BrowserThread::IO, | 324 BrowserThread::IO, |
| 326 FROM_HERE, | 325 FROM_HERE, |
| 327 base::Bind( | 326 base::Bind( |
| 328 &WebRtcLoggingHandlerHost::AddLogMessageFromBrowser, | 327 &WebRtcLoggingHandlerHost::AddLogMessageFromBrowser, |
| 329 this, | 328 this, |
| 330 WebRtcLoggingMessageData(base::Time::Now(), message))); | 329 WebRtcLoggingMessageData(base::Time::Now(), message))); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 | 671 |
| 673 void WebRtcLoggingHandlerHost::StoreLogInDirectory( | 672 void WebRtcLoggingHandlerHost::StoreLogInDirectory( |
| 674 const std::string& log_id, | 673 const std::string& log_id, |
| 675 scoped_ptr<WebRtcLogPaths> log_paths, | 674 scoped_ptr<WebRtcLogPaths> log_paths, |
| 676 const GenericDoneCallback& done_callback, | 675 const GenericDoneCallback& done_callback, |
| 677 const base::FilePath& directory) { | 676 const base::FilePath& directory) { |
| 678 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 677 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 679 log_paths->log_path = directory; | 678 log_paths->log_path = directory; |
| 680 | 679 |
| 681 log_buffer_->SetComplete(); | 680 log_buffer_->SetComplete(); |
| 682 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 681 BrowserThread::PostTask( |
| 682 BrowserThread::FILE, FROM_HERE, |
| 683 base::Bind(&WebRtcLogUploader::LoggingStoppedDoStore, | 683 base::Bind(&WebRtcLogUploader::LoggingStoppedDoStore, |
| 684 base::Unretained(g_browser_process->webrtc_log_uploader()), | 684 base::Unretained(g_browser_process->webrtc_log_uploader()), |
| 685 *log_paths.get(), log_id, Passed(&log_buffer_), Passed(&meta_data_), | 685 *log_paths.get(), log_id, base::Passed(&log_buffer_), |
| 686 done_callback)); | 686 base::Passed(&meta_data_), done_callback)); |
| 687 | 687 |
| 688 logging_state_ = CLOSED; | 688 logging_state_ = CLOSED; |
| 689 } | 689 } |
| 690 | 690 |
| 691 void WebRtcLoggingHandlerHost::DoUploadLogAndRtpDumps( | 691 void WebRtcLoggingHandlerHost::DoUploadLogAndRtpDumps( |
| 692 const base::FilePath& log_directory, | 692 const base::FilePath& log_directory, |
| 693 const UploadDoneCallback& callback) { | 693 const UploadDoneCallback& callback) { |
| 694 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 694 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 695 | 695 |
| 696 WebRtcLogUploadDoneData upload_done_data; | 696 WebRtcLogUploadDoneData upload_done_data; |
| 697 upload_done_data.log_path = log_directory; | 697 upload_done_data.log_path = log_directory; |
| 698 upload_done_data.callback = callback; | 698 upload_done_data.callback = callback; |
| 699 upload_done_data.host = this; | 699 upload_done_data.host = this; |
| 700 ReleaseRtpDumps(&upload_done_data); | 700 ReleaseRtpDumps(&upload_done_data); |
| 701 | 701 |
| 702 log_buffer_->SetComplete(); | 702 log_buffer_->SetComplete(); |
| 703 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind( | 703 BrowserThread::PostTask( |
| 704 &WebRtcLogUploader::LoggingStoppedDoUpload, | 704 BrowserThread::FILE, FROM_HERE, |
| 705 base::Unretained(g_browser_process->webrtc_log_uploader()), | 705 base::Bind(&WebRtcLogUploader::LoggingStoppedDoUpload, |
| 706 Passed(&log_buffer_), | 706 base::Unretained(g_browser_process->webrtc_log_uploader()), |
| 707 Passed(&meta_data_), | 707 base::Passed(&log_buffer_), base::Passed(&meta_data_), |
| 708 upload_done_data)); | 708 upload_done_data)); |
| 709 | 709 |
| 710 logging_state_ = CLOSED; | 710 logging_state_ = CLOSED; |
| 711 } | 711 } |
| 712 | 712 |
| 713 void WebRtcLoggingHandlerHost::CreateRtpDumpHandlerAndStart( | 713 void WebRtcLoggingHandlerHost::CreateRtpDumpHandlerAndStart( |
| 714 RtpDumpType type, | 714 RtpDumpType type, |
| 715 const GenericDoneCallback& callback, | 715 const GenericDoneCallback& callback, |
| 716 const base::FilePath& dump_dir) { | 716 const base::FilePath& dump_dir) { |
| 717 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 717 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 718 | 718 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 case STOPPED: | 789 case STOPPED: |
| 790 error_message_with_state += " State=stopped."; | 790 error_message_with_state += " State=stopped."; |
| 791 break; | 791 break; |
| 792 } | 792 } |
| 793 | 793 |
| 794 content::BrowserThread::PostTask( | 794 content::BrowserThread::PostTask( |
| 795 content::BrowserThread::UI, | 795 content::BrowserThread::UI, |
| 796 FROM_HERE, | 796 FROM_HERE, |
| 797 base::Bind(callback, success, error_message_with_state)); | 797 base::Bind(callback, success, error_message_with_state)); |
| 798 } | 798 } |
| OLD | NEW |