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

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

Issue 1904253002: Convert //media/blink from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « media/blink/buffered_data_source.h ('k') | media/blink/buffered_data_source_unittest.cc » ('j') | 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 "media/blink/buffered_data_source.h" 5 #include "media/blink/buffered_data_source.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 29 matching lines...) Expand all
40 class BufferedDataSource::ReadOperation { 40 class BufferedDataSource::ReadOperation {
41 public: 41 public:
42 ReadOperation(int64_t position, 42 ReadOperation(int64_t position,
43 int size, 43 int size,
44 uint8_t* data, 44 uint8_t* data,
45 const DataSource::ReadCB& callback); 45 const DataSource::ReadCB& callback);
46 ~ReadOperation(); 46 ~ReadOperation();
47 47
48 // Runs |callback_| with the given |result|, deleting the operation 48 // Runs |callback_| with the given |result|, deleting the operation
49 // afterwards. 49 // afterwards.
50 static void Run(scoped_ptr<ReadOperation> read_op, int result); 50 static void Run(std::unique_ptr<ReadOperation> read_op, int result);
51 51
52 // State for the number of times this read operation has been retried. 52 // State for the number of times this read operation has been retried.
53 int retries() { return retries_; } 53 int retries() { return retries_; }
54 void IncrementRetries() { ++retries_; } 54 void IncrementRetries() { ++retries_; }
55 55
56 int64_t position() { return position_; } 56 int64_t position() { return position_; }
57 int size() { return size_; } 57 int size() { return size_; }
58 uint8_t* data() { return data_; } 58 uint8_t* data() { return data_; }
59 59
60 private: 60 private:
(...skipping 19 matching lines...) Expand all
80 callback_(callback) { 80 callback_(callback) {
81 DCHECK(!callback_.is_null()); 81 DCHECK(!callback_.is_null());
82 } 82 }
83 83
84 BufferedDataSource::ReadOperation::~ReadOperation() { 84 BufferedDataSource::ReadOperation::~ReadOperation() {
85 DCHECK(callback_.is_null()); 85 DCHECK(callback_.is_null());
86 } 86 }
87 87
88 // static 88 // static
89 void BufferedDataSource::ReadOperation::Run( 89 void BufferedDataSource::ReadOperation::Run(
90 scoped_ptr<ReadOperation> read_op, int result) { 90 std::unique_ptr<ReadOperation> read_op,
91 int result) {
91 base::ResetAndReturn(&read_op->callback_).Run(result); 92 base::ResetAndReturn(&read_op->callback_).Run(result);
92 } 93 }
93 94
94 BufferedDataSource::BufferedDataSource( 95 BufferedDataSource::BufferedDataSource(
95 const GURL& url, 96 const GURL& url,
96 BufferedResourceLoader::CORSMode cors_mode, 97 BufferedResourceLoader::CORSMode cors_mode,
97 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 98 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
98 WebFrame* frame, 99 WebFrame* frame,
99 MediaLog* media_log, 100 MediaLog* media_log,
100 BufferedDataSourceHost* host, 101 BufferedDataSourceHost* host,
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 608 }
608 609
609 // If media is currently playing or the page indicated preload=auto or the 610 // If media is currently playing or the page indicated preload=auto or the
610 // the server does not support the byte range request or we do not want to go 611 // the server does not support the byte range request or we do not want to go
611 // too far ahead of the read head, use threshold strategy to enable/disable 612 // too far ahead of the read head, use threshold strategy to enable/disable
612 // deferring when the buffer is full/depleted. 613 // deferring when the buffer is full/depleted.
613 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); 614 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer);
614 } 615 }
615 616
616 } // namespace media 617 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/buffered_data_source.h ('k') | media/blink/buffered_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698