Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2840)

Unified Diff: chrome/browser/sync/glue/generic_change_processor.cc

Issue 8274020: Revert 105404 - [Sync] Refactor non-frontend DTC to handle new API properly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/generic_change_processor.cc
===================================================================
--- chrome/browser/sync/glue/generic_change_processor.cc (revision 105407)
+++ chrome/browser/sync/glue/generic_change_processor.cc (working copy)
@@ -16,28 +16,27 @@
#include "chrome/browser/sync/internal_api/write_node.h"
#include "chrome/browser/sync/internal_api/write_transaction.h"
#include "chrome/browser/sync/unrecoverable_error_handler.h"
-#include "content/browser/browser_thread.h"
namespace browser_sync {
GenericChangeProcessor::GenericChangeProcessor(
+ SyncableService* local_service,
UnrecoverableErrorHandler* error_handler,
- const base::WeakPtr<SyncableService>& local_service,
sync_api::UserShare* user_share)
: ChangeProcessor(error_handler),
local_service_(local_service),
- share_handle_(user_share) {
- DCHECK(CalledOnValidThread());
+ user_share_(user_share) {
+ DCHECK(local_service_);
}
GenericChangeProcessor::~GenericChangeProcessor() {
- DCHECK(CalledOnValidThread());
+ // Set to null to ensure it's not used after destruction.
+ local_service_ = NULL;
}
void GenericChangeProcessor::ApplyChangesFromSyncModel(
const sync_api::BaseTransaction* trans,
const sync_api::ImmutableChangeRecordList& changes) {
- DCHECK(CalledOnValidThread());
DCHECK(running());
DCHECK(syncer_changes_.empty());
for (sync_api::ChangeRecordList::const_iterator it =
@@ -66,18 +65,12 @@
}
void GenericChangeProcessor::CommitChangesFromSyncModel() {
- DCHECK(CalledOnValidThread());
if (!running())
return;
if (syncer_changes_.empty())
return;
- if (!local_service_) {
- syncable::ModelType type = syncer_changes_[0].sync_data().GetDataType();
- SyncError error(FROM_HERE, "Local service destroyed.", type);
- error_handler()->OnUnrecoverableError(error.location(), error.message());
- }
SyncError error = local_service_->ProcessSyncChanges(FROM_HERE,
- syncer_changes_);
+ syncer_changes_);
syncer_changes_.clear();
if (error.IsSet()) {
error_handler()->OnUnrecoverableError(error.location(), error.message());
@@ -87,7 +80,6 @@
SyncError GenericChangeProcessor::GetSyncDataForType(
syncable::ModelType type,
SyncDataList* current_sync_data) {
- DCHECK(CalledOnValidThread());
std::string type_name = syncable::ModelTypeToString(type);
sync_api::ReadTransaction trans(FROM_HERE, share_handle());
sync_api::ReadNode root(&trans);
@@ -145,7 +137,6 @@
SyncError GenericChangeProcessor::ProcessSyncChanges(
const tracked_objects::Location& from_here,
const SyncChangeList& list_of_changes) {
- DCHECK(CalledOnValidThread());
sync_api::WriteTransaction trans(from_here, share_handle());
for (SyncChangeList::const_iterator iter = list_of_changes.begin();
@@ -225,7 +216,6 @@
bool GenericChangeProcessor::SyncModelHasUserCreatedNodes(
syncable::ModelType type,
bool* has_nodes) {
- DCHECK(CalledOnValidThread());
DCHECK(has_nodes);
DCHECK_NE(type, syncable::UNSPECIFIED);
std::string type_name = syncable::ModelTypeToString(type);
@@ -246,7 +236,6 @@
}
bool GenericChangeProcessor::CryptoReadyIfNecessary(syncable::ModelType type) {
- DCHECK(CalledOnValidThread());
DCHECK_NE(type, syncable::UNSPECIFIED);
// We only access the cryptographer while holding a transaction.
sync_api::ReadTransaction trans(FROM_HERE, share_handle());
@@ -256,17 +245,12 @@
trans.GetCryptographer()->is_ready();
}
-void GenericChangeProcessor::StartImpl(Profile* profile) {
- DCHECK(CalledOnValidThread());
-}
+void GenericChangeProcessor::StartImpl(Profile* profile) {}
-void GenericChangeProcessor::StopImpl() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-}
+void GenericChangeProcessor::StopImpl() {}
-sync_api::UserShare* GenericChangeProcessor::share_handle() const {
- DCHECK(CalledOnValidThread());
- return share_handle_;
+sync_api::UserShare* GenericChangeProcessor::share_handle() {
+ return user_share_;
}
} // namespace browser_sync
« no previous file with comments | « chrome/browser/sync/glue/generic_change_processor.h ('k') | chrome/browser/sync/glue/new_non_frontend_data_type_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698