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

Side by Side Diff: media/filters/file_data_source.cc

Issue 435023002: Revert "Revert 285479 "Make DataSource::Stop() synchronous."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « media/filters/file_data_source.h ('k') | media/filters/file_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/filters/file_data_source.h" 5 #include "media/filters/file_data_source.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace media { 11 namespace media {
12 12
13 FileDataSource::FileDataSource() 13 FileDataSource::FileDataSource()
14 : force_read_errors_(false), 14 : force_read_errors_(false),
15 force_streaming_(false) { 15 force_streaming_(false) {
16 } 16 }
17 17
18 FileDataSource::FileDataSource(base::File file) 18 FileDataSource::FileDataSource(base::File file)
19 : force_read_errors_(false), 19 : force_read_errors_(false),
20 force_streaming_(false) { 20 force_streaming_(false) {
21 file_.Initialize(file.Pass()); 21 file_.Initialize(file.Pass());
22 } 22 }
23 23
24 bool FileDataSource::Initialize(const base::FilePath& file_path) { 24 bool FileDataSource::Initialize(const base::FilePath& file_path) {
25 DCHECK(!file_.IsValid()); 25 DCHECK(!file_.IsValid());
26 return file_.Initialize(file_path); 26 return file_.Initialize(file_path);
27 } 27 }
28 28
29 void FileDataSource::Stop(const base::Closure& callback) { 29 void FileDataSource::Stop() {
30 callback.Run();
31 } 30 }
32 31
33 void FileDataSource::Read(int64 position, int size, uint8* data, 32 void FileDataSource::Read(int64 position, int size, uint8* data,
34 const DataSource::ReadCB& read_cb) { 33 const DataSource::ReadCB& read_cb) {
35 if (force_read_errors_ || !file_.IsValid()) { 34 if (force_read_errors_ || !file_.IsValid()) {
36 read_cb.Run(kReadError); 35 read_cb.Run(kReadError);
37 return; 36 return;
38 } 37 }
39 38
40 int64 file_size = file_.length(); 39 int64 file_size = file_.length();
(...skipping 17 matching lines...) Expand all
58 57
59 bool FileDataSource::IsStreaming() { 58 bool FileDataSource::IsStreaming() {
60 return force_streaming_; 59 return force_streaming_;
61 } 60 }
62 61
63 void FileDataSource::SetBitrate(int bitrate) {} 62 void FileDataSource::SetBitrate(int bitrate) {}
64 63
65 FileDataSource::~FileDataSource() {} 64 FileDataSource::~FileDataSource() {}
66 65
67 } // namespace media 66 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/file_data_source.h ('k') | media/filters/file_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698