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

Side by Side Diff: media/blink/multibuffer_data_source.cc

Issue 1544313002: Convert Pass()→std::move() in //media (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
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 "media/blink/multibuffer_data_source.h" 5 #include "media/blink/multibuffer_data_source.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
9 #include "base/location.h" 11 #include "base/location.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
12 #include "media/base/media_log.h" 14 #include "media/base/media_log.h"
13 #include "media/blink/multibuffer_reader.h" 15 #include "media/blink/multibuffer_reader.h"
14 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
15 17
16 using blink::WebFrame; 18 using blink::WebFrame;
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 378
377 if (!reader_) { 379 if (!reader_) {
378 CreateResourceLoader(read_op_->position(), kPositionNotSpecified); 380 CreateResourceLoader(read_op_->position(), kPositionNotSpecified);
379 } else { 381 } else {
380 reader_->Seek(read_op_->position()); 382 reader_->Seek(read_op_->position());
381 } 383 }
382 384
383 int64_t available = reader_->Available(); 385 int64_t available = reader_->Available();
384 if (available < 0) { 386 if (available < 0) {
385 // A failure has occured. 387 // A failure has occured.
386 ReadOperation::Run(read_op_.Pass(), kReadError); 388 ReadOperation::Run(std::move(read_op_), kReadError);
387 return; 389 return;
388 } 390 }
389 if (available) { 391 if (available) {
390 bytes_read = 392 bytes_read =
391 static_cast<int>(std::min<int64_t>(available, read_op_->size())); 393 static_cast<int>(std::min<int64_t>(available, read_op_->size()));
392 bytes_read = reader_->TryRead(read_op_->data(), bytes_read); 394 bytes_read = reader_->TryRead(read_op_->data(), bytes_read);
393 ReadOperation::Run(read_op_.Pass(), bytes_read); 395 ReadOperation::Run(std::move(read_op_), bytes_read);
394 } else { 396 } else {
395 reader_->Wait(1, base::Bind(&MultibufferDataSource::ReadTask, 397 reader_->Wait(1, base::Bind(&MultibufferDataSource::ReadTask,
396 weak_factory_.GetWeakPtr())); 398 weak_factory_.GetWeakPtr()));
397 UpdateLoadingState(false); 399 UpdateLoadingState(false);
398 } 400 }
399 } 401 }
400 402
401 void MultibufferDataSource::StopInternal_Locked() { 403 void MultibufferDataSource::StopInternal_Locked() {
402 lock_.AssertAcquired(); 404 lock_.AssertAcquired();
403 if (stop_signal_received_) 405 if (stop_signal_received_)
404 return; 406 return;
405 407
406 stop_signal_received_ = true; 408 stop_signal_received_ = true;
407 409
408 // Initialize() isn't part of the DataSource interface so don't call it in 410 // Initialize() isn't part of the DataSource interface so don't call it in
409 // response to Stop(). 411 // response to Stop().
410 init_cb_.Reset(); 412 init_cb_.Reset();
411 413
412 if (read_op_) 414 if (read_op_)
413 ReadOperation::Run(read_op_.Pass(), kReadError); 415 ReadOperation::Run(std::move(read_op_), kReadError);
414 } 416 }
415 417
416 void MultibufferDataSource::StopLoader() { 418 void MultibufferDataSource::StopLoader() {
417 DCHECK(render_task_runner_->BelongsToCurrentThread()); 419 DCHECK(render_task_runner_->BelongsToCurrentThread());
418 reader_.reset(nullptr); 420 reader_.reset(nullptr);
419 } 421 }
420 422
421 void MultibufferDataSource::SetBitrateTask(int bitrate) { 423 void MultibufferDataSource::SetBitrateTask(int bitrate) {
422 DCHECK(render_task_runner_->BelongsToCurrentThread()); 424 DCHECK(render_task_runner_->BelongsToCurrentThread());
423 DCHECK(reader_.get()); 425 DCHECK(reader_.get());
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 reader_->SetMaxBuffer(back_buffer, pin_forwards); 565 reader_->SetMaxBuffer(back_buffer, pin_forwards);
564 566
565 if (preload_ == METADATA) { 567 if (preload_ == METADATA) {
566 reader_->SetPreload(0, 0); 568 reader_->SetPreload(0, 0);
567 } else { 569 } else {
568 reader_->SetPreload(preload + kPreloadHighExtra, preload); 570 reader_->SetPreload(preload + kPreloadHighExtra, preload);
569 } 571 }
570 } 572 }
571 573
572 } // namespace media 574 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/key_system_config_selector.cc ('k') | media/blink/resource_multibuffer_data_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698