From 70ab61c9109f3626b44f2bee96de626d0acf8442 Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Tue, 16 Jun 2009 19:29:39 +0000 Subject: Access RenderThread::current() only on render thread Since the renfer to RenderThread is now stored in the thread local storage, we can only access RenderThread::current() from render thread. Change BufferedDataSource accordingly. Review URL: http://codereview.chromium.org/126183 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18513 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/media/buffered_data_source.h | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'chrome/renderer/media/buffered_data_source.h') diff --git a/chrome/renderer/media/buffered_data_source.h b/chrome/renderer/media/buffered_data_source.h index b5a0d91..0111629 100644 --- a/chrome/renderer/media/buffered_data_source.h +++ b/chrome/renderer/media/buffered_data_source.h @@ -30,7 +30,14 @@ class BufferedResourceLoader : public base::RefCountedThreadSafe, public webkit_glue::ResourceLoaderBridge::Peer { public: - BufferedResourceLoader(int32 routing_id, + // |message_loop| - The message loop this resource loader should run on. + // |routing_id| - Routing id to this view. + // |url| - URL for the resource to be loaded. + // |first_byte_position| - First byte to start loading from, -1 for not + // specified. + // |last_byte_position| - Last byte to be loaded, -1 for not specified. + BufferedResourceLoader(MessageLoop* message_loop, + int32 routing_id, const GURL& url, int64 first_byte_position, int64 last_byte_position); @@ -187,8 +194,11 @@ class BufferedDataSource : public media::DataSource { public: // Methods called from pipeline thread // Static methods for creating this class. - static media::FilterFactory* CreateFactory(int32 routing_id) { - return new media::FilterFactoryImpl1(routing_id); + static media::FilterFactory* CreateFactory(MessageLoop* message_loop, + int32 routing_id) { + return new media::FilterFactoryImpl2(message_loop, routing_id); } virtual bool Initialize(const std::string& url); @@ -206,7 +216,9 @@ class BufferedDataSource : public media::DataSource { const media::MediaFormat& media_format(); private: - friend class media::FilterFactoryImpl1; + friend class media::FilterFactoryImpl2; // Call to filter host to trigger an error, be sure not to call this method // while the lock is acquired. void HandleError(media::PipelineError error); @@ -217,7 +229,7 @@ class BufferedDataSource : public media::DataSource { void InitialRequestStarted(int error); void OnInitialRequestStarted(int error); - explicit BufferedDataSource(int32 routing_id); + explicit BufferedDataSource(MessageLoop* render_loop, int32 routing_id); virtual ~BufferedDataSource(); media::MediaFormat media_format_; @@ -237,6 +249,9 @@ class BufferedDataSource : public media::DataSource { // Members related to resource loading with RenderView. scoped_refptr buffered_resource_loader_; + // The message loop of the render thread. + MessageLoop* render_loop_; + // The message loop of the pipeline thread. MessageLoop* pipeline_loop_; -- cgit v1.1