Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: chrome/browser/media/webrtc_logging_handler_host.cc

Issue 211033006: Move destruction of WebRtcLogUploader to post threads teardown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor fix to unit test + rebase. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/media/webrtc_logging_handler_host.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 void WebRtcLoggingHandlerHost::StartLoggingIfAllowed() { 288 void WebRtcLoggingHandlerHost::StartLoggingIfAllowed() {
289 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 289 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
290 if (!g_browser_process->webrtc_log_uploader()->ApplyForStartLogging()) { 290 if (!g_browser_process->webrtc_log_uploader()->ApplyForStartLogging()) {
291 logging_state_ = CLOSED; 291 logging_state_ = CLOSED;
292 FireGenericDoneCallback( 292 FireGenericDoneCallback(
293 &start_callback_, false, "Cannot start, maybe the maximum number of " 293 &start_callback_, false, "Cannot start, maybe the maximum number of "
294 "simultaneuos logs has been reached."); 294 "simultaneuos logs has been reached.");
295 return; 295 return;
296 } 296 }
297 system_request_context_ = g_browser_process->system_request_context();
298 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( 297 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(
299 &WebRtcLoggingHandlerHost::DoStartLogging, this)); 298 &WebRtcLoggingHandlerHost::DoStartLogging, this));
300 } 299 }
301 300
302 void WebRtcLoggingHandlerHost::DoStartLogging() { 301 void WebRtcLoggingHandlerHost::DoStartLogging() {
303 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 302 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
304 303
305 log_buffer_.reset(new unsigned char[kWebRtcLogSize]); 304 log_buffer_.reset(new unsigned char[kWebRtcLogSize]);
306 circular_buffer_.reset( 305 circular_buffer_.reset(
307 new PartialCircularBuffer(log_buffer_.get(), 306 new PartialCircularBuffer(log_buffer_.get(),
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 WebRtcLogUploadDoneData upload_done_data; 431 WebRtcLogUploadDoneData upload_done_data;
433 432
434 upload_done_data.log_path = log_directory; 433 upload_done_data.log_path = log_directory;
435 upload_done_data.callback = upload_callback_; 434 upload_done_data.callback = upload_callback_;
436 upload_done_data.host = this; 435 upload_done_data.host = this;
437 upload_callback_.Reset(); 436 upload_callback_.Reset();
438 437
439 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind( 438 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(
440 &WebRtcLogUploader::LoggingStoppedDoUpload, 439 &WebRtcLogUploader::LoggingStoppedDoUpload,
441 base::Unretained(g_browser_process->webrtc_log_uploader()), 440 base::Unretained(g_browser_process->webrtc_log_uploader()),
442 system_request_context_,
443 Passed(&log_buffer_), 441 Passed(&log_buffer_),
444 kWebRtcLogSize, 442 kWebRtcLogSize,
445 meta_data_, 443 meta_data_,
446 upload_done_data)); 444 upload_done_data));
447 445
448 meta_data_.clear(); 446 meta_data_.clear();
449 circular_buffer_.reset(); 447 circular_buffer_.reset();
450 } 448 }
451 449
452 void WebRtcLoggingHandlerHost::FireGenericDoneCallback( 450 void WebRtcLoggingHandlerHost::FireGenericDoneCallback(
453 GenericDoneCallback* callback, bool success, 451 GenericDoneCallback* callback, bool success,
454 const std::string& error_message) { 452 const std::string& error_message) {
455 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 453 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
456 DCHECK(!(*callback).is_null()); 454 DCHECK(!(*callback).is_null());
457 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 455 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
458 base::Bind(*callback, success, 456 base::Bind(*callback, success,
459 error_message)); 457 error_message));
460 (*callback).Reset(); 458 (*callback).Reset();
461 } 459 }
OLDNEW
« no previous file with comments | « chrome/browser/media/webrtc_logging_handler_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698