summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 17:53:07 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 17:53:07 +0000
commit5af2c5d8f4dac890633084af4dd545fc488906ce (patch)
tree5604e1482d19e4e9c8f3449fb74ab3d1bd23b2cd
parent75a0110add915d18817bb982035b042e568b6ed4 (diff)
downloadchromium_src-5af2c5d8f4dac890633084af4dd545fc488906ce.zip
chromium_src-5af2c5d8f4dac890633084af4dd545fc488906ce.tar.gz
chromium_src-5af2c5d8f4dac890633084af4dd545fc488906ce.tar.bz2
Fix import crash in Mac 10.6 only.
A DictionaryValue we need to keep was being autoreleased in the Mac message loop. The import process uses only C++ code, so we just make a deep copy of the (very small, 5 strings) Dictionary when it's passed into the bridge. BUG=46003 TEST=import works on Mac OS 10.6 and 10.5 Review URL: http://codereview.chromium.org/2715006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49284 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/importer/importer_bridge.cc13
-rw-r--r--chrome/browser/importer/importer_bridge.h3
2 files changed, 10 insertions, 6 deletions
diff --git a/chrome/browser/importer/importer_bridge.cc b/chrome/browser/importer/importer_bridge.cc
index 2a913d2..72a73a6 100644
--- a/chrome/browser/importer/importer_bridge.cc
+++ b/chrome/browser/importer/importer_bridge.cc
@@ -77,6 +77,7 @@ void InProcessImporterBridge::SetKeywords(
void InProcessImporterBridge::SetPasswordForm(
const webkit_glue::PasswordForm& form) {
+ LOG(ERROR) << "IPImporterBridge::SetPasswordForm";
ChromeThread::PostTask(
ChromeThread::UI, FROM_HERE,
NewRunnableMethod(writer_, &ProfileWriter::AddPasswordForm, form));
@@ -113,8 +114,11 @@ std::wstring InProcessImporterBridge::GetLocalizedString(int message_id) {
ExternalProcessImporterBridge::ExternalProcessImporterBridge(
ProfileImportThread* profile_import_thread,
const DictionaryValue& localized_strings)
- : profile_import_thread_(profile_import_thread),
- localized_strings_(localized_strings) {
+ : profile_import_thread_(profile_import_thread) {
+ // Bridge needs to make its own copy because OS 10.6 autoreleases the
+ // localized_strings value that is passed in (see http://crbug.com/46003 ).
+ localized_strings_.reset(
+ static_cast<DictionaryValue*>(localized_strings.DeepCopy()));
}
void ExternalProcessImporterBridge::AddBookmarkEntries(
@@ -157,8 +161,7 @@ void ExternalProcessImporterBridge::SetKeywords(
void ExternalProcessImporterBridge::SetPasswordForm(
const webkit_glue::PasswordForm& form) {
- // TODO(mirandac): http://crbug.com/18775
- NOTIMPLEMENTED();
+ profile_import_thread_->NotifyPasswordFormReady(form);
}
void ExternalProcessImporterBridge::NotifyItemStarted(
@@ -181,7 +184,7 @@ void ExternalProcessImporterBridge::NotifyEnded() {
std::wstring ExternalProcessImporterBridge::GetLocalizedString(
int message_id) {
std::wstring message;
- localized_strings_.GetString(IntToWString(message_id), &message);
+ localized_strings_->GetString(IntToWString(message_id), &message);
return message;
}
diff --git a/chrome/browser/importer/importer_bridge.h b/chrome/browser/importer/importer_bridge.h
index c6358da..993ec54 100644
--- a/chrome/browser/importer/importer_bridge.h
+++ b/chrome/browser/importer/importer_bridge.h
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/importer/importer_data_types.h"
@@ -159,7 +160,7 @@ class ExternalProcessImporterBridge : public ImporterBridge {
// Holds strings needed by the external importer because the resource
// bundle isn't available to the external process.
- const DictionaryValue& localized_strings_;
+ scoped_ptr<DictionaryValue> localized_strings_;
DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterBridge);
};