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

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

Issue 1445003002: Use std::default_delete as the default deleter for scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address more comments Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_rtp_dump_writer.h" 5 #include "chrome/browser/media/webrtc_rtp_dump_writer.h"
6 6
7 #include "base/big_endian.h" 7 #include "base/big_endian.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 scoped_ptr<size_t> bytes_written(new size_t(0)); 371 scoped_ptr<size_t> bytes_written(new size_t(0));
372 372
373 FileThreadWorker* worker = incoming ? incoming_file_thread_worker_.get() 373 FileThreadWorker* worker = incoming ? incoming_file_thread_worker_.get()
374 : outgoing_file_thread_worker_.get(); 374 : outgoing_file_thread_worker_.get();
375 375
376 // Using "Unretained(worker)" because |worker| is owner by this object and it 376 // Using "Unretained(worker)" because |worker| is owner by this object and it
377 // guaranteed to be deleted on the FILE thread before this object goes away. 377 // guaranteed to be deleted on the FILE thread before this object goes away.
378 base::Closure task = 378 base::Closure task =
379 base::Bind(&FileThreadWorker::CompressAndWriteToFileOnFileThread, 379 base::Bind(&FileThreadWorker::CompressAndWriteToFileOnFileThread,
380 base::Unretained(worker), 380 base::Unretained(worker), base::Passed(&new_buffer),
381 Passed(&new_buffer), 381 end_stream, result.get(), bytes_written.get());
382 end_stream,
383 result.get(),
384 bytes_written.get());
385 382
386 // OnFlushDone is necessary to avoid running the callback after this 383 // OnFlushDone is necessary to avoid running the callback after this
387 // object is gone. 384 // object is gone.
388 base::Closure reply = base::Bind(&WebRtcRtpDumpWriter::OnFlushDone, 385 base::Closure reply = base::Bind(
389 weak_ptr_factory_.GetWeakPtr(), 386 &WebRtcRtpDumpWriter::OnFlushDone, weak_ptr_factory_.GetWeakPtr(),
390 callback, 387 callback, base::Passed(&result), base::Passed(&bytes_written));
391 Passed(&result),
392 Passed(&bytes_written));
393 388
394 // Define the task and reply outside the method call so that getting and 389 // Define the task and reply outside the method call so that getting and
395 // passing the scoped_ptr does not depend on the argument evaluation order. 390 // passing the scoped_ptr does not depend on the argument evaluation order.
396 BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE, task, reply); 391 BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE, task, reply);
397 392
398 if (end_stream) { 393 if (end_stream) {
399 bool success = BrowserThread::DeleteSoon( 394 bool success = BrowserThread::DeleteSoon(
400 BrowserThread::FILE, 395 BrowserThread::FILE,
401 FROM_HERE, 396 FROM_HERE,
402 incoming ? incoming_file_thread_worker_.release() 397 incoming ? incoming_file_thread_worker_.release()
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 base::Bind(&WebRtcRtpDumpWriter::OnDumpEnded, 440 base::Bind(&WebRtcRtpDumpWriter::OnDumpEnded,
446 weak_ptr_factory_.GetWeakPtr(), 441 weak_ptr_factory_.GetWeakPtr(),
447 context, 442 context,
448 false)); 443 false));
449 return; 444 return;
450 } 445 }
451 446
452 // This object might be deleted after running the callback. 447 // This object might be deleted after running the callback.
453 context.callback.Run(context.incoming_succeeded, context.outgoing_succeeded); 448 context.callback.Run(context.incoming_succeeded, context.outgoing_succeeded);
454 } 449 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698