| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 306 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 307 | 307 |
| 308 // |rtp_dump_handler_| could be NULL if we are waiting for the FILE thread to | 308 // |rtp_dump_handler_| could be NULL if we are waiting for the FILE thread to |
| 309 // create/ensure the log directory. | 309 // create/ensure the log directory. |
| 310 if (rtp_dump_handler_) { | 310 if (rtp_dump_handler_) { |
| 311 rtp_dump_handler_->OnRtpPacket( | 311 rtp_dump_handler_->OnRtpPacket( |
| 312 packet_header.get(), header_length, packet_length, incoming); | 312 packet_header.get(), header_length, packet_length, incoming); |
| 313 } | 313 } |
| 314 } | 314 } |
| 315 | 315 |
| 316 void WebRtcLoggingHandlerHost::OnChannelClosing() { | 316 void WebRtcLoggingHandlerHost::OnSenderClosing() { |
| 317 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 317 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 318 if (logging_state_ == STARTED || logging_state_ == STOPPED) { | 318 if (logging_state_ == STARTED || logging_state_ == STOPPED) { |
| 319 if (upload_log_on_render_close_) { | 319 if (upload_log_on_render_close_) { |
| 320 logging_state_ = UPLOADING; | 320 logging_state_ = UPLOADING; |
| 321 logging_started_time_ = base::Time(); | 321 logging_started_time_ = base::Time(); |
| 322 | 322 |
| 323 content::BrowserThread::PostTaskAndReplyWithResult( | 323 content::BrowserThread::PostTaskAndReplyWithResult( |
| 324 content::BrowserThread::FILE, | 324 content::BrowserThread::FILE, |
| 325 FROM_HERE, | 325 FROM_HERE, |
| 326 base::Bind(&WebRtcLoggingHandlerHost::GetLogDirectoryAndEnsureExists, | 326 base::Bind(&WebRtcLoggingHandlerHost::GetLogDirectoryAndEnsureExists, |
| 327 this), | 327 this), |
| 328 base::Bind(&WebRtcLoggingHandlerHost::TriggerUpload, this)); | 328 base::Bind(&WebRtcLoggingHandlerHost::TriggerUpload, this)); |
| 329 } else { | 329 } else { |
| 330 g_browser_process->webrtc_log_uploader()->LoggingStoppedDontUpload(); | 330 g_browser_process->webrtc_log_uploader()->LoggingStoppedDontUpload(); |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 content::BrowserMessageFilter::OnChannelClosing(); | 333 content::BrowserMessageFilter::OnSenderClosing(); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void WebRtcLoggingHandlerHost::OnDestruct() const { | 336 void WebRtcLoggingHandlerHost::OnDestruct() const { |
| 337 BrowserThread::DeleteOnIOThread::Destruct(this); | 337 BrowserThread::DeleteOnIOThread::Destruct(this); |
| 338 } | 338 } |
| 339 | 339 |
| 340 bool WebRtcLoggingHandlerHost::OnMessageReceived(const IPC::Message& message) { | 340 bool WebRtcLoggingHandlerHost::OnMessageReceived(const IPC::Message& message) { |
| 341 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 341 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 342 bool handled = true; | 342 bool handled = true; |
| 343 IPC_BEGIN_MESSAGE_MAP(WebRtcLoggingHandlerHost, message) | 343 IPC_BEGIN_MESSAGE_MAP(WebRtcLoggingHandlerHost, message) |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 void WebRtcLoggingHandlerHost::DoStartRtpDump(RtpDumpType type, | 609 void WebRtcLoggingHandlerHost::DoStartRtpDump(RtpDumpType type, |
| 610 GenericDoneCallback* callback) { | 610 GenericDoneCallback* callback) { |
| 611 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 611 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 612 DCHECK(rtp_dump_handler_); | 612 DCHECK(rtp_dump_handler_); |
| 613 | 613 |
| 614 std::string error; | 614 std::string error; |
| 615 | 615 |
| 616 bool result = rtp_dump_handler_->StartDump(type, &error); | 616 bool result = rtp_dump_handler_->StartDump(type, &error); |
| 617 FireGenericDoneCallback(callback, result, error); | 617 FireGenericDoneCallback(callback, result, error); |
| 618 } | 618 } |
| OLD | NEW |