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

Unified Diff: components/sync/driver/generic_change_processor.cc

Issue 2593803002: Make sync's change processors sequence-affine. (Closed)
Patch Set: CR Created 4 years 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
« no previous file with comments | « components/sync/driver/generic_change_processor.h ('k') | components/sync/driver/shared_change_processor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/driver/generic_change_processor.cc
diff --git a/components/sync/driver/generic_change_processor.cc b/components/sync/driver/generic_change_processor.cc
index 47f6217c88bbf24ea4fce0cab982395fe83854af..1dee59fda337dfbdee48bb11ed9df1a63826b28d 100644
--- a/components/sync/driver/generic_change_processor.cc
+++ b/components/sync/driver/generic_change_processor.cc
@@ -13,7 +13,7 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/threading/thread_task_runner_handle.h"
+#include "base/threading/sequenced_task_runner_handle.h"
#include "components/sync/base/unrecoverable_error_handler.h"
#include "components/sync/driver/sync_api_component_factory.h"
#include "components/sync/driver/sync_client.h"
@@ -119,7 +119,7 @@ GenericChangeProcessor::GenericChangeProcessor(
merge_result_(merge_result),
share_handle_(user_share),
weak_ptr_factory_(this) {
- DCHECK(CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
DCHECK_NE(type_, UNSPECIFIED);
if (attachment_store) {
std::string store_birthday;
@@ -135,25 +135,25 @@ GenericChangeProcessor::GenericChangeProcessor(
base::MakeUnique<base::WeakPtrFactory<AttachmentService>>(
attachment_service_.get());
attachment_service_proxy_ = AttachmentServiceProxy(
- base::ThreadTaskRunnerHandle::Get(),
+ base::SequencedTaskRunnerHandle::Get(),
attachment_service_weak_ptr_factory_->GetWeakPtr());
UploadAllAttachmentsNotOnServer();
} else {
attachment_service_proxy_ =
- AttachmentServiceProxy(base::ThreadTaskRunnerHandle::Get(),
+ AttachmentServiceProxy(base::SequencedTaskRunnerHandle::Get(),
base::WeakPtr<AttachmentService>());
}
}
GenericChangeProcessor::~GenericChangeProcessor() {
- DCHECK(CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
}
void GenericChangeProcessor::ApplyChangesFromSyncModel(
const BaseTransaction* trans,
int64_t model_version,
const ImmutableChangeRecordList& changes) {
- DCHECK(CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
DCHECK(syncer_changes_.empty());
for (ChangeRecordList::const_iterator it = changes.Get().begin();
it != changes.Get().end(); ++it) {
@@ -194,7 +194,7 @@ void GenericChangeProcessor::ApplyChangesFromSyncModel(
}
void GenericChangeProcessor::CommitChangesFromSyncModel() {
- DCHECK(CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
if (syncer_changes_.empty())
return;
if (!local_service_.get()) {
@@ -258,7 +258,7 @@ void GenericChangeProcessor::OnAttachmentUploaded(
SyncError GenericChangeProcessor::GetAllSyncDataReturnError(
SyncDataList* current_sync_data) const {
- DCHECK(CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
std::string type_name = ModelTypeToString(type_);
ReadTransaction trans(FROM_HERE, share_handle());
ReadNode root(&trans);
@@ -424,7 +424,7 @@ SyncError GenericChangeProcessor::AttemptDelete(
SyncError GenericChangeProcessor::ProcessSyncChanges(
const tracked_objects::Location& from_here,
const SyncChangeList& list_of_changes) {
- DCHECK(CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
if (list_of_changes.empty()) {
// No work. Exit without entering WriteTransaction.
@@ -644,7 +644,7 @@ SyncError GenericChangeProcessor::HandleActionUpdate(
}
bool GenericChangeProcessor::SyncModelHasUserCreatedNodes(bool* has_nodes) {
- DCHECK(CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
DCHECK(has_nodes);
std::string type_name = ModelTypeToString(type_);
std::string err_str =
@@ -665,7 +665,7 @@ bool GenericChangeProcessor::SyncModelHasUserCreatedNodes(bool* has_nodes) {
}
bool GenericChangeProcessor::CryptoReadyIfNecessary() {
- DCHECK(CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
// We only access the cryptographer while holding a transaction.
ReadTransaction trans(FROM_HERE, share_handle());
const ModelTypeSet encrypted_types = trans.GetEncryptedTypes();
@@ -675,12 +675,12 @@ bool GenericChangeProcessor::CryptoReadyIfNecessary() {
void GenericChangeProcessor::StartImpl() {}
UserShare* GenericChangeProcessor::share_handle() const {
- DCHECK(CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
return share_handle_;
}
void GenericChangeProcessor::UploadAllAttachmentsNotOnServer() {
- DCHECK(CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
DCHECK(attachment_service_.get());
AttachmentIdList ids;
{
« no previous file with comments | « components/sync/driver/generic_change_processor.h ('k') | components/sync/driver/shared_change_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698