OLD | NEW |
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 bool FileDataSource::Initialize(const FilePath& file_path) { | 18 bool FileDataSource::Initialize(const base::FilePath& file_path) { |
19 DCHECK(!file_.IsValid()); | 19 DCHECK(!file_.IsValid()); |
20 | 20 |
21 if (!file_.Initialize(file_path)) | 21 if (!file_.Initialize(file_path)) |
22 return false; | 22 return false; |
23 | 23 |
24 UpdateHostBytes(); | 24 UpdateHostBytes(); |
25 return true; | 25 return true; |
26 } | 26 } |
27 | 27 |
28 void FileDataSource::set_host(DataSourceHost* host) { | 28 void FileDataSource::set_host(DataSourceHost* host) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 FileDataSource::~FileDataSource() {} | 69 FileDataSource::~FileDataSource() {} |
70 | 70 |
71 void FileDataSource::UpdateHostBytes() { | 71 void FileDataSource::UpdateHostBytes() { |
72 if (host() && file_.IsValid()) { | 72 if (host() && file_.IsValid()) { |
73 host()->SetTotalBytes(file_.length()); | 73 host()->SetTotalBytes(file_.length()); |
74 host()->AddBufferedByteRange(0, file_.length()); | 74 host()->AddBufferedByteRange(0, file_.length()); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 } // namespace media | 78 } // namespace media |
OLD | NEW |