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 /chrome/profile_import | |
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
Diffstat (limited to 'chrome/profile_import')
-rw-r--r-- | chrome/profile_import/profile_import_thread.cc | 19 | ||||
-rw-r--r-- | chrome/profile_import/profile_import_thread.h | 6 |
2 files changed, 10 insertions, 15 deletions
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); }; |