summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-26 23:49:24 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-26 23:49:24 +0000
commit92b0417bd59b83f6a4908a6bb19ef833852faf08 (patch)
tree928d80c5d866f659fe6977f7d8817eeea8319b25 /chrome/renderer
parent9e717c32ba0e9710d06d2f3fac3a291f3d4e4ec5 (diff)
downloadchromium_src-92b0417bd59b83f6a4908a6bb19ef833852faf08.zip
chromium_src-92b0417bd59b83f6a4908a6bb19ef833852faf08.tar.gz
chromium_src-92b0417bd59b83f6a4908a6bb19ef833852faf08.tar.bz2
Lots of files touched for a very simple change. Everywhere we used a const MediaFormat* we now
use a const MediaFormat&. This makes for simpler code and for better pointer reference safety. Review URL: http://codereview.chromium.org/42635 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12623 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/media/audio_renderer_impl.cc8
-rw-r--r--chrome/renderer/media/audio_renderer_impl.h8
-rw-r--r--chrome/renderer/media/data_source_impl.cc16
-rw-r--r--chrome/renderer/media/data_source_impl.h6
4 files changed, 15 insertions, 23 deletions
diff --git a/chrome/renderer/media/audio_renderer_impl.cc b/chrome/renderer/media/audio_renderer_impl.cc
index 5df76ba..9677b32 100644
--- a/chrome/renderer/media/audio_renderer_impl.cc
+++ b/chrome/renderer/media/audio_renderer_impl.cc
@@ -29,14 +29,14 @@ AudioRendererImpl::~AudioRendererImpl() {
}
bool AudioRendererImpl::IsMediaFormatSupported(
- const media::MediaFormat* media_format) {
+ const media::MediaFormat& media_format) {
int channels;
int sample_rate;
int sample_bits;
return ParseMediaFormat(media_format, &channels, &sample_rate, &sample_bits);
}
-bool AudioRendererImpl::OnInitialize(const media::MediaFormat* media_format) {
+bool AudioRendererImpl::OnInitialize(const media::MediaFormat& media_format) {
// Parse integer values in MediaFormat.
int channels;
int sample_rate;
@@ -156,7 +156,3 @@ void AudioRendererImpl::OnNotifyAudioPacketReady() {
delegate_->view()->NotifyAudioPacketReady(stream_id_, filled);
}
}
-
-const media::MediaFormat* AudioRendererImpl::GetMediaFormat() {
- return &media_format_;
-}
diff --git a/chrome/renderer/media/audio_renderer_impl.h b/chrome/renderer/media/audio_renderer_impl.h
index c0a8257..d062bb0 100644
--- a/chrome/renderer/media/audio_renderer_impl.h
+++ b/chrome/renderer/media/audio_renderer_impl.h
@@ -108,7 +108,7 @@ class AudioRendererImpl : public media::AudioRendererBase {
return new media::FilterFactoryImpl1<AudioRendererImpl,
WebMediaPlayerDelegateImpl*>(delegate);
}
- static bool IsMediaFormatSupported(const media::MediaFormat* format);
+ static bool IsMediaFormatSupported(const media::MediaFormat& format);
// Methods call from RenderView when audio related IPC messages are received
// from browser process.
@@ -123,7 +123,6 @@ class AudioRendererImpl : public media::AudioRendererBase {
// Methods called on pipeline thread ----------------------------------------
// media::MediaFilter implementation.
virtual void SetPlaybackRate(float rate);
- const media::MediaFormat* GetMediaFormat();
// media::AudioRenderer implementation.
virtual void SetVolume(float volume);
@@ -134,7 +133,7 @@ class AudioRendererImpl : public media::AudioRendererBase {
protected:
// Methods called on audio renderer thread ----------------------------------
// These methods are called from AudioRendererBase.
- virtual bool OnInitialize(const media::MediaFormat* media_format);
+ virtual bool OnInitialize(const media::MediaFormat& media_format);
virtual void OnStop();
private:
@@ -159,9 +158,6 @@ class AudioRendererImpl : public media::AudioRendererBase {
WebMediaPlayerDelegateImpl* delegate_;
- // A map of media format information.
- media::MediaFormat media_format_;
-
// ID of the stream created in the browser process.
int32 stream_id_;
diff --git a/chrome/renderer/media/data_source_impl.cc b/chrome/renderer/media/data_source_impl.cc
index e084413..51efb6f 100644
--- a/chrome/renderer/media/data_source_impl.cc
+++ b/chrome/renderer/media/data_source_impl.cc
@@ -215,10 +215,10 @@ void DataSourceImpl::OnInitialize(std::string uri) {
"GET",
GURL(uri),
GURL(uri),
- GURL(), // TODO(hclam): provide referer here.
- "null", // TODO(abarth): provide frame_origin
- "null", // TODO(abarth): provide main_frame_origin
- std::string(), // Provide no header.
+ GURL(), // TODO(hclam): provide referer here.
+ "null", // TODO(abarth): provide frame_origin
+ "null", // TODO(abarth): provide main_frame_origin
+ std::string(), // Provide no header.
// Prefer to load from cache, also enable downloading the file, the
// resource will be saved to a single response data file if it's possible.
net::LOAD_PREFERRING_CACHE | net::LOAD_ENABLE_DOWNLOAD_FILE,
@@ -244,9 +244,9 @@ void DataSourceImpl::OnDownloadProgress(uint64 position, uint64 size) {
AutoLock auto_lock(lock_);
downloaded_bytes_ = position;
if (!total_bytes_known_) {
- if (size == kuint64max)
+ if (size == kuint64max) {
total_bytes_ = position;
- else {
+ } else {
total_bytes_ = size;
total_bytes_known_ = true;
}
@@ -308,6 +308,6 @@ std::string DataSourceImpl::GetURLForDebugging() {
return uri_;
}
-const media::MediaFormat* DataSourceImpl::GetMediaFormat() {
- return &media_format_;
+const media::MediaFormat& DataSourceImpl::media_format() {
+ return media_format_;
}
diff --git a/chrome/renderer/media/data_source_impl.h b/chrome/renderer/media/data_source_impl.h
index 9190b25..6f8d688 100644
--- a/chrome/renderer/media/data_source_impl.h
+++ b/chrome/renderer/media/data_source_impl.h
@@ -136,7 +136,7 @@ class DataSourceImpl : public media::DataSource,
virtual bool SetPosition(int64 position);
virtual bool GetSize(int64* size_out);
- const media::MediaFormat* GetMediaFormat();
+ const media::MediaFormat& media_format();
private:
friend class media::FilterFactoryImpl1<DataSourceImpl,
@@ -164,7 +164,7 @@ class DataSourceImpl : public media::DataSource,
// in construction and can be accessed in all threads safely.
WebMediaPlayerDelegateImpl* delegate_;
- // Message loop of render thread.
+ // Message loop of render thread.
MessageLoop* render_loop_;
// A common lock for protecting members accessed by multiple threads.
@@ -173,7 +173,7 @@ class DataSourceImpl : public media::DataSource,
// A flag that indicates whether this object has been called to stop.
bool stopped_;
- // URI to the resource being downloaded.
+ // URI to the resource being downloaded.
std::string uri_;
// Members for keeping track of downloading progress.