summaryrefslogtreecommitdiffstats
path: root/chrome/browser/webdata
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 21:59:00 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 21:59:00 +0000
commit0677c6951f4458c6b56484e9a0fc074466761dc8 (patch)
tree89e9df8281fb6a40d70f61a2abffd558bfa36ea9 /chrome/browser/webdata
parentef31c68d5fa6fdd04ff9a794a8064e566038a160 (diff)
downloadchromium_src-0677c6951f4458c6b56484e9a0fc074466761dc8.zip
chromium_src-0677c6951f4458c6b56484e9a0fc074466761dc8.tar.gz
chromium_src-0677c6951f4458c6b56484e9a0fc074466761dc8.tar.bz2
[Sync] Have SyncableService's take ownership of their SyncChangeProcessor.
The UIDataTypeController now uses a SharedChangeProcessor, and passes a ref to the SyncableService's. Every SyncableService now owns its own change processor. Additionally, we use the ScopedPtr::Pass semantics for passing around SyncChangeProcessors to ensure SyncableServices properly take ownership. This, along with all the test updates it requires (most of the patch) fixes several leaks introduced in the previous patch to remove the Syncable Service Adapter. SyncableServiceMock is removed as it didn't play nice with scoped_ptr parameters (and was hardly used). BUG=117098,117538 TEST=unit_tests with valgrind/drmemory/heapcheck TBR=georgy@chromium.org Review URL: https://chromiumcodereview.appspot.com/9749012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128578 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata')
-rw-r--r--chrome/browser/webdata/autocomplete_syncable_service.cc5
-rw-r--r--chrome/browser/webdata/autocomplete_syncable_service.h4
-rw-r--r--chrome/browser/webdata/autofill_profile_syncable_service.cc5
-rw-r--r--chrome/browser/webdata/autofill_profile_syncable_service.h2
-rw-r--r--chrome/browser/webdata/autofill_profile_syncable_service_unittest.cc6
5 files changed, 13 insertions, 9 deletions
diff --git a/chrome/browser/webdata/autocomplete_syncable_service.cc b/chrome/browser/webdata/autocomplete_syncable_service.cc
index af1cde1..3b3ecb1 100644
--- a/chrome/browser/webdata/autocomplete_syncable_service.cc
+++ b/chrome/browser/webdata/autocomplete_syncable_service.cc
@@ -79,9 +79,10 @@ AutocompleteSyncableService::AutocompleteSyncableService()
SyncError AutocompleteSyncableService::MergeDataAndStartSyncing(
syncable::ModelType type,
const SyncDataList& initial_sync_data,
- SyncChangeProcessor* sync_processor) {
+ scoped_ptr<SyncChangeProcessor> sync_processor) {
DCHECK(CalledOnValidThread());
DCHECK(!sync_processor_.get());
+ DCHECK(sync_processor.get());
VLOG(1) << "Associating Autocomplete: MergeDataAndStartSyncing";
std::vector<AutofillEntry> entries;
@@ -97,7 +98,7 @@ SyncError AutocompleteSyncableService::MergeDataAndStartSyncing(
new_db_entries[it->key()] = std::make_pair(SyncChange::ACTION_ADD, it);
}
- sync_processor_.reset(sync_processor);
+ sync_processor_ = sync_processor.Pass();
std::vector<AutofillEntry> new_synced_entries;
// Go through and check for all the entries that sync already knows about.
diff --git a/chrome/browser/webdata/autocomplete_syncable_service.h b/chrome/browser/webdata/autocomplete_syncable_service.h
index 963a1ad..0c38849 100644
--- a/chrome/browser/webdata/autocomplete_syncable_service.h
+++ b/chrome/browser/webdata/autocomplete_syncable_service.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_WEBDATA_AUTOCOMPLETE_SYNCABLE_SERVICE_H_
@@ -50,7 +50,7 @@ class AutocompleteSyncableService
virtual SyncError MergeDataAndStartSyncing(
syncable::ModelType type,
const SyncDataList& initial_sync_data,
- SyncChangeProcessor* sync_processor) OVERRIDE;
+ scoped_ptr<SyncChangeProcessor> sync_processor) OVERRIDE;
virtual void StopSyncing(syncable::ModelType type) OVERRIDE;
virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE;
virtual SyncError ProcessSyncChanges(
diff --git a/chrome/browser/webdata/autofill_profile_syncable_service.cc b/chrome/browser/webdata/autofill_profile_syncable_service.cc
index f73a6618..fe1222d 100644
--- a/chrome/browser/webdata/autofill_profile_syncable_service.cc
+++ b/chrome/browser/webdata/autofill_profile_syncable_service.cc
@@ -59,9 +59,10 @@ AutofillProfileSyncableService::AutofillProfileSyncableService()
SyncError AutofillProfileSyncableService::MergeDataAndStartSyncing(
syncable::ModelType type,
const SyncDataList& initial_sync_data,
- SyncChangeProcessor* sync_processor) {
+ scoped_ptr<SyncChangeProcessor> sync_processor) {
DCHECK(CalledOnValidThread());
DCHECK(!sync_processor_.get());
+ DCHECK(sync_processor.get());
DVLOG(1) << "Associating Autofill: MergeDataAndStartSyncing";
if (!LoadAutofillData(&profiles_.get())) {
@@ -84,7 +85,7 @@ SyncError AutofillProfileSyncableService::MergeDataAndStartSyncing(
}
}
- sync_processor_.reset(sync_processor);
+ sync_processor_ = sync_processor.Pass();
GUIDToProfileMap remaining_profiles;
CreateGUIDToProfileMap(profiles_.get(), &remaining_profiles);
diff --git a/chrome/browser/webdata/autofill_profile_syncable_service.h b/chrome/browser/webdata/autofill_profile_syncable_service.h
index 6926572..59c1e4a 100644
--- a/chrome/browser/webdata/autofill_profile_syncable_service.h
+++ b/chrome/browser/webdata/autofill_profile_syncable_service.h
@@ -51,7 +51,7 @@ class AutofillProfileSyncableService
virtual SyncError MergeDataAndStartSyncing(
syncable::ModelType type,
const SyncDataList& initial_sync_data,
- SyncChangeProcessor* sync_processor) OVERRIDE;
+ scoped_ptr<SyncChangeProcessor> sync_processor) OVERRIDE;
virtual void StopSyncing(syncable::ModelType type) OVERRIDE;
virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE;
virtual SyncError ProcessSyncChanges(
diff --git a/chrome/browser/webdata/autofill_profile_syncable_service_unittest.cc b/chrome/browser/webdata/autofill_profile_syncable_service_unittest.cc
index 147e2ef..11a4dc3 100644
--- a/chrome/browser/webdata/autofill_profile_syncable_service_unittest.cc
+++ b/chrome/browser/webdata/autofill_profile_syncable_service_unittest.cc
@@ -169,7 +169,8 @@ TEST_F(AutofillProfileSyncableServiceTest, MergeDataAndStartSyncing) {
// Takes ownership of sync_processor_.
autofill_syncable_service_.MergeDataAndStartSyncing(
- syncable::AUTOFILL_PROFILE, data_list, sync_processor_.release());
+ syncable::AUTOFILL_PROFILE, data_list,
+ sync_processor_.PassAs<SyncChangeProcessor>());
autofill_syncable_service_.StopSyncing(syncable::AUTOFILL_PROFILE);
}
@@ -199,7 +200,8 @@ TEST_F(AutofillProfileSyncableServiceTest, GetAllSyncData) {
SyncDataList data_list;
// Takes ownership of sync_processor_.
autofill_syncable_service_.MergeDataAndStartSyncing(
- syncable::AUTOFILL_PROFILE, data_list, sync_processor_.release());
+ syncable::AUTOFILL_PROFILE, data_list,
+ sync_processor_.PassAs<SyncChangeProcessor>());
SyncDataList data =
autofill_syncable_service_.GetAllSyncData(syncable::AUTOFILL_PROFILE);