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

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

Issue 6142009: Upating the app, ceee, chrome, ipc, media, and net directories to use the correct lock.h file. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Unified patch updating all references to the new base/synchronization/lock.h Created 9 years, 11 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/video_renderer_base.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <limits> 5 #include <limits>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "media/base/filter_host.h" 10 #include "media/base/filter_host.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 media_format_.SetAsString(MediaFormat::kMimeType, 44 media_format_.SetAsString(MediaFormat::kMimeType,
45 mime_type::kApplicationOctetStream); 45 mime_type::kApplicationOctetStream);
46 media_format_.SetAsString(MediaFormat::kURL, url); 46 media_format_.SetAsString(MediaFormat::kURL, url);
47 host()->SetTotalBytes(file_size_); 47 host()->SetTotalBytes(file_size_);
48 host()->SetBufferedBytes(file_size_); 48 host()->SetBufferedBytes(file_size_);
49 callback->Run(); 49 callback->Run();
50 } 50 }
51 51
52 void FileDataSource::Stop(FilterCallback* callback) { 52 void FileDataSource::Stop(FilterCallback* callback) {
53 AutoLock l(lock_); 53 base::AutoLock l(lock_);
54 if (file_) { 54 if (file_) {
55 file_util::CloseFile(file_); 55 file_util::CloseFile(file_);
56 file_ = NULL; 56 file_ = NULL;
57 file_size_ = 0; 57 file_size_ = 0;
58 } 58 }
59 if (callback) { 59 if (callback) {
60 callback->Run(); 60 callback->Run();
61 delete callback; 61 delete callback;
62 } 62 }
63 } 63 }
64 64
65 const MediaFormat& FileDataSource::media_format() { 65 const MediaFormat& FileDataSource::media_format() {
66 return media_format_; 66 return media_format_;
67 } 67 }
68 68
69 void FileDataSource::Read(int64 position, size_t size, uint8* data, 69 void FileDataSource::Read(int64 position, size_t size, uint8* data,
70 ReadCallback* read_callback) { 70 ReadCallback* read_callback) {
71 DCHECK(file_); 71 DCHECK(file_);
72 AutoLock l(lock_); 72 base::AutoLock l(lock_);
73 scoped_ptr<ReadCallback> callback(read_callback); 73 scoped_ptr<ReadCallback> callback(read_callback);
74 if (file_) { 74 if (file_) {
75 #if defined(OS_WIN) 75 #if defined(OS_WIN)
76 if (_fseeki64(file_, position, SEEK_SET)) { 76 if (_fseeki64(file_, position, SEEK_SET)) {
77 callback->RunWithParams( 77 callback->RunWithParams(
78 Tuple1<size_t>(static_cast<size_t>(DataSource::kReadError))); 78 Tuple1<size_t>(static_cast<size_t>(DataSource::kReadError)));
79 return; 79 return;
80 } 80 }
81 #else 81 #else
82 CHECK(position <= std::numeric_limits<int32>::max()); 82 CHECK(position <= std::numeric_limits<int32>::max());
(...skipping 11 matching lines...) Expand all
94 return; 94 return;
95 } 95 }
96 } 96 }
97 97
98 callback->RunWithParams(Tuple1<size_t>(static_cast<size_t>(kReadError))); 98 callback->RunWithParams(Tuple1<size_t>(static_cast<size_t>(kReadError)));
99 } 99 }
100 100
101 bool FileDataSource::GetSize(int64* size_out) { 101 bool FileDataSource::GetSize(int64* size_out) {
102 DCHECK(size_out); 102 DCHECK(size_out);
103 DCHECK(file_); 103 DCHECK(file_);
104 AutoLock l(lock_); 104 base::AutoLock l(lock_);
105 *size_out = file_size_; 105 *size_out = file_size_;
106 return (NULL != file_); 106 return (NULL != file_);
107 } 107 }
108 108
109 bool FileDataSource::IsStreaming() { 109 bool FileDataSource::IsStreaming() {
110 return false; 110 return false;
111 } 111 }
112 112
113 } // namespace media 113 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/file_data_source.h ('k') | media/filters/video_renderer_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698