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

Unified Diff: chrome/renderer/media/data_source_impl.cc

Issue 40059: Changed several references from "char" to "uint8" which is the appropriate de... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/media/data_source_impl.h ('k') | media/base/buffers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/media/data_source_impl.cc
===================================================================
--- chrome/renderer/media/data_source_impl.cc (revision 10837)
+++ chrome/renderer/media/data_source_impl.cc (working copy)
@@ -45,7 +45,7 @@
// Post a close file stream task to IO message loop, it will signal the read
// event.
io_loop_->PostTask(
- FROM_HERE,NewRunnableMethod(this, &DataSourceImpl::OnCloseFileStream));
+ FROM_HERE, NewRunnableMethod(this, &DataSourceImpl::OnCloseFileStream));
// Wait for close to finish for FileStream.
close_event_.Wait();
@@ -61,14 +61,14 @@
// We should get a call back at OnReceivedResponse().
media_format_.SetAsString(media::MediaFormat::kMimeType,
media::mime_type::kApplicationOctetStream);
- media_format_.SetAsString(media::MediaFormat::kURL, url);
+ media_format_.SetAsString(media::MediaFormat::kURL, url);
return true;
}
-size_t DataSourceImpl::Read(char* data, size_t size) {
+size_t DataSourceImpl::Read(uint8* data, size_t size) {
DCHECK(stream_.get());
// Wait until we have downloaded the requested bytes.
- while(!stopped_) {
+ while (!stopped_) {
{
AutoLock auto_lock(lock_);
if (position_ + size <= downloaded_bytes_)
@@ -99,7 +99,7 @@
bool DataSourceImpl::SetPosition(int64 position) {
DCHECK(stream_.get());
- while(!stopped_) {
+ while (!stopped_) {
{
AutoLock auto_lock(lock_);
if (position < downloaded_bytes_)
@@ -142,17 +142,19 @@
host_->InitializationComplete();
}
-void DataSourceImpl::OnReadFileStream(char* data, size_t size) {
+void DataSourceImpl::OnReadFileStream(uint8* data, size_t size) {
if (!stopped_ && stream_.get()) {
+ // net::FileStream::Read wants a char*, not uint8*.
+ char* c_data = reinterpret_cast<char*>(data);
+ COMPILE_ASSERT(sizeof(*c_data) == sizeof(*data), data_not_sizeof_char);
+
// This method IO operation is asynchronous, it is expected to return
// ERROR_IO_PENDING, when the operation is done, OnDidFileStreamRead() will
- // be called.
- int rv = stream_->Read(data, size, &read_callback_);
-
- // Since the file handle is asynchronous, return value other than
- // ERROR_IO_PENDING is an error.
- if (rv != net::ERR_IO_PENDING) {
- // TODO(hclam): using something like PipelineError::PIPELINE_READ_ERROR.
+ // be called. Since the file handle is asynchronous, return value other
+ // than ERROR_IO_PENDING is an error.
+ if (stream_->Read(c_data, size, &read_callback_) != net::ERR_IO_PENDING) {
+ // TODO(hclam): change to PipelineError::PIPELINE_ERROR_READ once ralphl
+ // gets the new pipeline CL checked in.
host_->Error(media::PIPELINE_ERROR_NETWORK);
}
}
« no previous file with comments | « chrome/renderer/media/data_source_impl.h ('k') | media/base/buffers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698