diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-08 23:35:47 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-08 23:35:47 +0000 |
commit | 0d7e79fa8ce1bef5ca6d413c908c267c35f5867a (patch) | |
tree | 5509297bccd2e1b4c8abd0680090547c4b707f18 | |
parent | f94151690a90af7029a1ab6ddb0f7679af3a9c7d (diff) | |
download | chromium_src-0d7e79fa8ce1bef5ca6d413c908c267c35f5867a.zip chromium_src-0d7e79fa8ce1bef5ca6d413c908c267c35f5867a.tar.gz chromium_src-0d7e79fa8ce1bef5ca6d413c908c267c35f5867a.tar.bz2 |
Revert 61899 for breaking cookes on file:// URLs.
BUG=58553
=================================================
Fix instances of passing raw pointers to RefCounted objects in tasks.
Some of these manually handled it correctly by using AddRef()/Release() pairs. I switched them to make_scoped_refptr() to be more consistent. This also makes them cleanup properly on MessageLoop shutdown if we start deleting tasks.
BUG=28083
TEST=builds
Review URL: http://codereview.chromium.org/3581008
TBR=willchan@chromium.org
Review URL: http://codereview.chromium.org/3654001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62043 0039d316-1c4b-4281-b951-d872f2087c98
22 files changed, 90 insertions, 158 deletions
diff --git a/chrome/browser/automation/automation_resource_message_filter.cc b/chrome/browser/automation/automation_resource_message_filter.cc index 92c4a17..7dac439 100644 --- a/chrome/browser/automation/automation_resource_message_filter.cc +++ b/chrome/browser/automation/automation_resource_message_filter.cc @@ -226,11 +226,7 @@ bool AutomationResourceMessageFilter::RegisterRenderView( BrowserThread::IO, FROM_HERE, NewRunnableFunction( AutomationResourceMessageFilter::RegisterRenderViewInIOThread, - renderer_pid, - renderer_id, - tab_handle, - make_scoped_refptr(filter), - pending_view)); + renderer_pid, renderer_id, tab_handle, filter, pending_view)); return true; } @@ -255,10 +251,7 @@ bool AutomationResourceMessageFilter::ResumePendingRenderView( BrowserThread::IO, FROM_HERE, NewRunnableFunction( AutomationResourceMessageFilter::ResumePendingRenderViewInIOThread, - renderer_pid, - renderer_id, - tab_handle, - make_scoped_refptr(filter))); + renderer_pid, renderer_id, tab_handle, filter)); return true; } diff --git a/chrome/browser/debugger/devtools_http_protocol_handler.cc b/chrome/browser/debugger/devtools_http_protocol_handler.cc index e064018..4ab1a79 100644 --- a/chrome/browser/debugger/devtools_http_protocol_handler.cc +++ b/chrome/browser/debugger/devtools_http_protocol_handler.cc @@ -95,7 +95,7 @@ void DevToolsHttpProtocolHandler::OnHttpRequest( FROM_HERE, NewRunnableMethod(this, &DevToolsHttpProtocolHandler::OnHttpRequestUI, - scoped_refptr<HttpListenSocket>(socket), + socket, info)); return; } @@ -123,7 +123,7 @@ void DevToolsHttpProtocolHandler::OnWebSocketRequest( NewRunnableMethod( this, &DevToolsHttpProtocolHandler::OnWebSocketRequestUI, - make_scoped_refptr(socket), + socket, request)); } @@ -135,7 +135,7 @@ void DevToolsHttpProtocolHandler::OnWebSocketMessage(HttpListenSocket* socket, NewRunnableMethod( this, &DevToolsHttpProtocolHandler::OnWebSocketMessageUI, - make_scoped_refptr(socket), + socket, data)); } @@ -160,7 +160,7 @@ void DevToolsHttpProtocolHandler::OnClose(HttpListenSocket* socket) { NewRunnableMethod( this, &DevToolsHttpProtocolHandler::OnCloseUI, - make_scoped_refptr(socket))); + socket)); } void DevToolsHttpProtocolHandler::OnHttpRequestUI( diff --git a/chrome/browser/download/download_file_manager.cc b/chrome/browser/download/download_file_manager.cc index 10fe2fe..fc94314 100644 --- a/chrome/browser/download/download_file_manager.cc +++ b/chrome/browser/download/download_file_manager.cc @@ -174,13 +174,9 @@ void DownloadFileManager::StartDownload(DownloadCreateInfo* info) { return; } - ChromeThread::PostTask( - ChromeThread::FILE, - FROM_HERE, - NewRunnableMethod(this, - &DownloadFileManager::CreateDownloadFile, - info, - make_scoped_refptr(manager))); + ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE, + NewRunnableMethod(this, &DownloadFileManager::CreateDownloadFile, + info, manager)); } // We don't forward an update to the UI thread here, since we want to throttle diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index af3049e..b90feaf 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -76,7 +76,7 @@ void DownloadManager::Shutdown() { ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE, NewRunnableMethod(file_manager_, &DownloadFileManager::OnDownloadManagerShutdown, - make_scoped_refptr(this))); + this)); } // 'in_progress_' may contain DownloadItems that have not finished the start @@ -437,12 +437,8 @@ void DownloadManager::CreateDownloadItem(DownloadCreateInfo* info, ChromeThread::PostTask( ChromeThread::FILE, FROM_HERE, NewRunnableMethod( - file_manager_, - &DownloadFileManager::OnFinalDownloadName, - download->id(), - target_path, - !info->is_dangerous, - make_scoped_refptr(this))); + file_manager_, &DownloadFileManager::OnFinalDownloadName, + download->id(), target_path, !info->is_dangerous, this)); } else { // The download hasn't finished and it is a safe download. We need to // rename it to its intermediate '.crdownload' path. @@ -450,11 +446,8 @@ void DownloadManager::CreateDownloadItem(DownloadCreateInfo* info, ChromeThread::PostTask( ChromeThread::FILE, FROM_HERE, NewRunnableMethod( - file_manager_, - &DownloadFileManager::OnIntermediateDownloadName, - download->id(), - download_path, - make_scoped_refptr(this))); + file_manager_, &DownloadFileManager::OnIntermediateDownloadName, + download->id(), download_path, this)); download->set_need_final_rename(true); } @@ -539,12 +532,8 @@ void DownloadManager::OnAllDataSaved(int32 download_id, int64 size) { ChromeThread::PostTask( ChromeThread::FILE, FROM_HERE, NewRunnableMethod( - file_manager_, - &DownloadFileManager::OnFinalDownloadName, - download->id(), - download->full_path(), - false, - make_scoped_refptr(this))); + file_manager_, &DownloadFileManager::OnFinalDownloadName, + download->id(), download->full_path(), false, this)); return; } diff --git a/chrome/browser/download/save_file_manager.cc b/chrome/browser/download/save_file_manager.cc index b1c59a9..00e9251 100644 --- a/chrome/browser/download/save_file_manager.cc +++ b/chrome/browser/download/save_file_manager.cc @@ -131,16 +131,14 @@ void SaveFileManager::SaveURL(const GURL& url, DCHECK(url.is_valid()); ChromeThread::PostTask( - ChromeThread::IO, - FROM_HERE, - NewRunnableMethod( - this, - &SaveFileManager::OnSaveURL, - url, - referrer, - render_process_host_id, - render_view_id, - make_scoped_refptr(request_context_getter))); + ChromeThread::IO, FROM_HERE, + NewRunnableMethod(this, + &SaveFileManager::OnSaveURL, + url, + referrer, + render_process_host_id, + render_view_id, + request_context_getter)); } else { // We manually start the save job. SaveFileCreateInfo* info = new SaveFileCreateInfo(file_full_path, @@ -252,6 +250,7 @@ void SaveFileManager::UpdateSaveProgress(int save_id, this, &SaveFileManager::OnUpdateSaveProgress, save_file->save_id(), save_file->bytes_so_far(), write_success)); } + data->Release(); } // The IO thread will call this when saving is completed or it got error when diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index 071e95b..4ce3e36 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -1025,7 +1025,8 @@ void SavePackage::OnReceivedSerializedHtmlData(const GURL& frame_url, if (!data.empty()) { // Prepare buffer for saving HTML data. - scoped_refptr<net::IOBuffer> new_data = new net::IOBuffer(data.size()); + net::IOBuffer* new_data = new net::IOBuffer(data.size()); + new_data->AddRef(); // We'll pass the buffer to SaveFileManager. memcpy(new_data->data(), data.data(), data.size()); // Call write file functionality in file thread. diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc index d99b1e9..879d7cb 100644 --- a/chrome/browser/importer/importer_unittest.cc +++ b/chrome/browser/importer/importer_unittest.cc @@ -120,15 +120,9 @@ class ImporterTest : public testing::Test { int items = HISTORY | PASSWORDS | FAVORITES; if (import_search_plugins) items = items | SEARCH_ENGINES; - loop->PostTask( - FROM_HERE, - NewRunnableMethod(host.get(), - &ImporterHost::StartImportSettings, - profile_info, - static_cast<Profile*>(NULL), - items, - make_scoped_refptr(writer), - true)); + loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), + &ImporterHost::StartImportSettings, profile_info, + static_cast<Profile*>(NULL), items, writer, true)); loop->Run(); } @@ -704,23 +698,17 @@ TEST_F(ImporterTest, MAYBE(Firefox2Importer)) { MessageLoop* loop = MessageLoop::current(); scoped_refptr<ImporterHost> host = new ImporterHost(); - scoped_refptr<FirefoxObserver> observer = new FirefoxObserver(); + FirefoxObserver* observer = new FirefoxObserver(); host->SetObserver(observer); ProfileInfo profile_info; profile_info.browser_type = FIREFOX2; profile_info.app_path = app_path_; profile_info.source_path = profile_path_; - loop->PostTask( - FROM_HERE, - NewRunnableMethod( - host.get(), - &ImporterHost::StartImportSettings, - profile_info, - static_cast<Profile*>(NULL), - HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES, - observer, - true)); + loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), + &ImporterHost::StartImportSettings, profile_info, + static_cast<Profile*>(NULL), + HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES, observer, true)); loop->Run(); } diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc index 6dc08d0..17e99c4 100644 --- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc @@ -151,17 +151,9 @@ void DOMStorageDispatcherHost::OnStorageAreaId(int64 namespace_id, DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); ChromeURLRequestContext* url_request_context = resource_message_filter_->GetRequestContextForURL(GURL(origin)); - ChromeThread::PostTask( - ChromeThread::WEBKIT, - FROM_HERE, - NewRunnableMethod( - this, - &DOMStorageDispatcherHost::OnStorageAreaIdWebKit, - namespace_id, - origin, - reply_msg, - make_scoped_refptr( - url_request_context->host_content_settings_map()))); + ChromeThread::PostTask(ChromeThread::WEBKIT, FROM_HERE, NewRunnableMethod( + this, &DOMStorageDispatcherHost::OnStorageAreaIdWebKit, namespace_id, + origin, reply_msg, url_request_context->host_content_settings_map())); } void DOMStorageDispatcherHost::OnStorageAreaIdWebKit( diff --git a/chrome/browser/notifications/desktop_notification_service_unittest.cc b/chrome/browser/notifications/desktop_notification_service_unittest.cc index 0e52cb4..f88466b 100644 --- a/chrome/browser/notifications/desktop_notification_service_unittest.cc +++ b/chrome/browser/notifications/desktop_notification_service_unittest.cc @@ -41,10 +41,8 @@ class ThreadProxy : public base::RefCountedThreadSafe<ThreadProxy> { int CacheHasPermission(NotificationsPrefsCache* cache, const GURL& url) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, - NewRunnableMethod(this, - &ThreadProxy::CacheHasPermissionIO, - make_scoped_refptr(cache), - url)); + NewRunnableMethod(this, &ThreadProxy::CacheHasPermissionIO, + cache, url)); io_event_.Signal(); ui_event_.Wait(); // Wait for IO thread to be done. ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, diff --git a/chrome/browser/renderer_host/audio_renderer_host.cc b/chrome/browser/renderer_host/audio_renderer_host.cc index 8e0fdc5..af63515 100644 --- a/chrome/browser/renderer_host/audio_renderer_host.cc +++ b/chrome/browser/renderer_host/audio_renderer_host.cc @@ -126,7 +126,7 @@ void AudioRendererHost::OnCreated(media::AudioOutputController* controller) { NewRunnableMethod( this, &AudioRendererHost::DoCompleteCreation, - make_scoped_refptr(controller))); + controller)); } void AudioRendererHost::OnPlaying(media::AudioOutputController* controller) { @@ -136,7 +136,7 @@ void AudioRendererHost::OnPlaying(media::AudioOutputController* controller) { NewRunnableMethod( this, &AudioRendererHost::DoSendPlayingMessage, - make_scoped_refptr(controller))); + controller)); } void AudioRendererHost::OnPaused(media::AudioOutputController* controller) { @@ -146,7 +146,7 @@ void AudioRendererHost::OnPaused(media::AudioOutputController* controller) { NewRunnableMethod( this, &AudioRendererHost::DoSendPausedMessage, - make_scoped_refptr(controller))); + controller)); } void AudioRendererHost::OnError(media::AudioOutputController* controller, @@ -156,7 +156,7 @@ void AudioRendererHost::OnError(media::AudioOutputController* controller, FROM_HERE, NewRunnableMethod(this, &AudioRendererHost::DoHandleError, - make_scoped_refptr(controller), + controller, error_code)); } @@ -167,7 +167,7 @@ void AudioRendererHost::OnMoreData(media::AudioOutputController* controller, FROM_HERE, NewRunnableMethod(this, &AudioRendererHost::DoRequestMoreData, - make_scoped_refptr(controller), + controller, buffers_state)); } diff --git a/chrome/browser/renderer_host/save_file_resource_handler.cc b/chrome/browser/renderer_host/save_file_resource_handler.cc index 436917d..06c4a62 100644 --- a/chrome/browser/renderer_host/save_file_resource_handler.cc +++ b/chrome/browser/renderer_host/save_file_resource_handler.cc @@ -80,8 +80,8 @@ bool SaveFileResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, bool SaveFileResourceHandler::OnReadCompleted(int request_id, int* bytes_read) { DCHECK(read_buffer_); // We are passing ownership of this buffer to the save file manager. - scoped_refptr<net::IOBuffer> buffer = NULL; - read_buffer_.swap(buffer); + net::IOBuffer* buffer = NULL; + read_buffer_.swap(&buffer); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, NewRunnableMethod(save_manager_, diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index e1fbab8..da38f18 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -386,6 +386,9 @@ void SafeBrowsingService::OnIOInitialize( mackey_url_prefix, disable_auto_update); + // Balance the reference added by Start(). + request_context_getter->Release(); + protocol_manager_->Initialize(); } @@ -645,16 +648,14 @@ void SafeBrowsingService::Start() { } // We will issue network fetches using the default profile's request context. - scoped_refptr<URLRequestContextGetter> request_context_getter = + URLRequestContextGetter* request_context_getter = GetDefaultProfile()->GetRequestContext(); + request_context_getter->AddRef(); // Balanced in OnIOInitialize. BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, NewRunnableMethod( - this, - &SafeBrowsingService::OnIOInitialize, - client_key, - wrapped_key, + this, &SafeBrowsingService::OnIOInitialize, client_key, wrapped_key, request_context_getter)); } diff --git a/chrome/profile_import/profile_import_thread.cc b/chrome/profile_import/profile_import_thread.cc index 5700823..6f097b3 100644 --- a/chrome/profile_import/profile_import_thread.cc +++ b/chrome/profile_import/profile_import_thread.cc @@ -32,8 +32,6 @@ ProfileImportThread::ProfileImportThread() ChildProcess::current()->AddRefProcess(); // Balanced in Cleanup(). } -ProfileImportThread::~ProfileImportThread() {} - void ProfileImportThread::OnControlMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(ProfileImportThread, msg) IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_StartImport, @@ -51,6 +49,7 @@ void ProfileImportThread::OnImportStart( const DictionaryValue& localized_strings, bool import_to_bookmark_bar) { bridge_ = new ExternalProcessImporterBridge(this, localized_strings); + bridge_->AddRef(); // Balanced in Cleanup(). ImporterList importer_list; importer_ = importer_list.CreateImporterByType(profile_info.browser_type); @@ -60,6 +59,7 @@ void ProfileImportThread::OnImportStart( return; } + importer_->AddRef(); // Balanced in Cleanup(). importer_->set_import_to_bookmark_bar(import_to_bookmark_bar); items_to_import_ = items; @@ -71,14 +71,9 @@ void ProfileImportThread::OnImportStart( NOTREACHED(); Cleanup(); } - import_thread_->message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod( - importer_.get(), - &Importer::StartImport, - profile_info, - items, - bridge_)); + import_thread_->message_loop()->PostTask(FROM_HERE, + NewRunnableMethod(importer_, &Importer::StartImport, + profile_info, items, bridge_)); } void ProfileImportThread::OnImportCancel() { @@ -189,7 +184,7 @@ void ProfileImportThread::NotifyKeywordsReady( void ProfileImportThread::Cleanup() { importer_->Cancel(); - importer_ = NULL; - bridge_ = NULL; + importer_->Release(); + bridge_->Release(); ChildProcess::current()->ReleaseProcess(); } diff --git a/chrome/profile_import/profile_import_thread.h b/chrome/profile_import/profile_import_thread.h index 079fa4c..f780cc5 100644 --- a/chrome/profile_import/profile_import_thread.h +++ b/chrome/profile_import/profile_import_thread.h @@ -28,7 +28,7 @@ class InProcessImporterBridge; class ProfileImportThread : public ChildThread { public: ProfileImportThread(); - virtual ~ProfileImportThread(); + virtual ~ProfileImportThread() {} // Returns the one profile import thread. static ProfileImportThread* current() { @@ -84,7 +84,7 @@ class ProfileImportThread : public ChildThread { // Bridge object is passed to importer, so that it can send IPC calls // directly back to the ProfileImportProcessHost. - scoped_refptr<ExternalProcessImporterBridge> bridge_; + ExternalProcessImporterBridge* bridge_; // importer::ProfileType enum from importer_list, stored in ProfileInfo // struct in importer. @@ -94,7 +94,7 @@ class ProfileImportThread : public ChildThread { uint16 items_to_import_; // Importer of the appropriate type (Firefox, Safari, IE, etc.) - scoped_refptr<Importer> importer_; + Importer* importer_; DISALLOW_COPY_AND_ASSIGN(ProfileImportThread); }; diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index 3aeaa88..db562c3 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -386,12 +386,8 @@ void ServiceProcess::SaveChromotingConfig( // And then do the update. chromoting_config_->Update( - NewRunnableFunction(&SaveChromotingConfigFunc, - chromoting_config_, - login, - token, - host_id, - host_name)); + NewRunnableFunction(&SaveChromotingConfigFunc, chromoting_config_.get(), + login, token, host_id, host_name)); // And then save the key pair. host_key_pair->Save(chromoting_config_); diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index feca4eb..9785216 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -196,6 +196,9 @@ void ChannelProxy::Context::OnAddFilter(MessageFilter* filter) { // so that the filter gets access to the Channel. if (channel_) filter->OnFilterAdded(channel_); + + // Balances the AddRef in ChannelProxy::AddFilter. + filter->Release(); } // Called on the IPC::Channel thread @@ -314,20 +317,16 @@ bool ChannelProxy::Send(Message* message) { } void ChannelProxy::AddFilter(MessageFilter* filter) { - context_->ipc_message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod( - context_.get(), - &Context::OnAddFilter, - make_scoped_refptr(filter))); + // We want to addref the filter to prevent it from + // being destroyed before the OnAddFilter call is invoked. + filter->AddRef(); + context_->ipc_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( + context_.get(), &Context::OnAddFilter, filter)); } void ChannelProxy::RemoveFilter(MessageFilter* filter) { - context_->ipc_message_loop()->PostTask( - FROM_HERE, NewRunnableMethod( - context_.get(), - &Context::OnRemoveFilter, - make_scoped_refptr(filter))); + context_->ipc_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( + context_.get(), &Context::OnRemoveFilter, filter)); } void ChannelProxy::ClearIPCMessageLoop() { diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc index 5d7759c..bd9e9fe 100644 --- a/media/base/pipeline_impl.cc +++ b/media/base/pipeline_impl.cc @@ -93,12 +93,8 @@ bool PipelineImpl::Start(FilterFactory* factory, // Kick off initialization! running_ = true; - message_loop_->PostTask( - FROM_HERE, - NewRunnableMethod(this, - &PipelineImpl::StartTask, - make_scoped_refptr(factory), - url, + message_loop_->PostTask(FROM_HERE, + NewRunnableMethod(this, &PipelineImpl::StartTask, factory, url, callback.release())); return true; } diff --git a/media/filters/decoder_base.h b/media/filters/decoder_base.h index 355bb06..60245ed 100644 --- a/media/filters/decoder_base.h +++ b/media/filters/decoder_base.h @@ -30,26 +30,21 @@ class DecoderBase : public Decoder { // MediaFilter implementation. virtual void Stop(FilterCallback* callback) { - this->message_loop()->PostTask( - FROM_HERE, + this->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, &DecoderBase::StopTask, callback)); } virtual void Seek(base::TimeDelta time, FilterCallback* callback) { - this->message_loop()->PostTask( - FROM_HERE, + this->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, &DecoderBase::SeekTask, time, callback)); } // Decoder implementation. virtual void Initialize(DemuxerStream* demuxer_stream, FilterCallback* callback) { - this->message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, - &DecoderBase::InitializeTask, - make_scoped_refptr(demuxer_stream), + this->message_loop()->PostTask(FROM_HERE, + NewRunnableMethod(this, &DecoderBase::InitializeTask, demuxer_stream, callback)); } diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc index 5869e3a..797481b 100644 --- a/media/filters/ffmpeg_demuxer.cc +++ b/media/filters/ffmpeg_demuxer.cc @@ -310,11 +310,8 @@ void FFmpegDemuxer::OnAudioRendererDisabled() { void FFmpegDemuxer::Initialize(DataSource* data_source, FilterCallback* callback) { - message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, - &FFmpegDemuxer::InitializeTask, - make_scoped_refptr(data_source), + message_loop()->PostTask(FROM_HERE, + NewRunnableMethod(this, &FFmpegDemuxer::InitializeTask, data_source, callback)); } diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc index 73deb74..c79f679 100644 --- a/media/filters/ffmpeg_video_decoder.cc +++ b/media/filters/ffmpeg_video_decoder.cc @@ -36,12 +36,11 @@ FFmpegVideoDecoder::~FFmpegVideoDecoder() { void FFmpegVideoDecoder::Initialize(DemuxerStream* demuxer_stream, FilterCallback* callback) { if (MessageLoop::current() != message_loop()) { - message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, - &FFmpegVideoDecoder::Initialize, - make_scoped_refptr(demuxer_stream), - callback)); + message_loop()->PostTask(FROM_HERE, + NewRunnableMethod(this, + &FFmpegVideoDecoder::Initialize, + demuxer_stream, + callback)); return; } diff --git a/media/filters/omx_video_decoder.cc b/media/filters/omx_video_decoder.cc index 178a29c..82793de 100644 --- a/media/filters/omx_video_decoder.cc +++ b/media/filters/omx_video_decoder.cc @@ -57,7 +57,7 @@ void OmxVideoDecoder::Initialize(DemuxerStream* demuxer_stream, FROM_HERE, NewRunnableMethod(this, &OmxVideoDecoder::Initialize, - make_scoped_refptr(demuxer_stream), + demuxer_stream, callback)); return; } diff --git a/remoting/host/host_key_pair.cc b/remoting/host/host_key_pair.cc index cabac20..f2ec6987 100644 --- a/remoting/host/host_key_pair.cc +++ b/remoting/host/host_key_pair.cc @@ -55,9 +55,7 @@ void HostKeyPair::Save(MutableHostConfig* host_config) { DCHECK(key_.get() != NULL); host_config->Update( - NewRunnableMethod(this, - &HostKeyPair::DoSave, - make_scoped_refptr(host_config))); + NewRunnableMethod(this, &HostKeyPair::DoSave, host_config)); } void HostKeyPair::DoSave(MutableHostConfig* host_config) const { |