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

Unified Diff: components/sync/core/write_transaction.cc

Issue 2407163004: [Sync] Move some directory-related things from core/ to syncable/. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « components/sync/core/write_transaction.h ('k') | components/sync/core_impl/change_reorder_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/core/write_transaction.cc
diff --git a/components/sync/core/write_transaction.cc b/components/sync/core/write_transaction.cc
deleted file mode 100644
index 45333e433bca979c865002aefdb155c9ff6d0f6b..0000000000000000000000000000000000000000
--- a/components/sync/core/write_transaction.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 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.
-
-#include "components/sync/core/write_transaction.h"
-
-#include "components/sync/syncable/directory.h"
-#include "components/sync/syncable/mutable_entry.h"
-#include "components/sync/syncable/syncable_write_transaction.h"
-
-namespace syncer {
-
-//////////////////////////////////////////////////////////////////////////
-// WriteTransaction member definitions
-WriteTransaction::WriteTransaction(const tracked_objects::Location& from_here,
- UserShare* share)
- : BaseTransaction(share), transaction_(NULL) {
- transaction_ = new syncable::WriteTransaction(from_here, syncable::SYNCAPI,
- share->directory.get());
-}
-
-WriteTransaction::WriteTransaction(const tracked_objects::Location& from_here,
- UserShare* share,
- int64_t* new_model_version)
- : BaseTransaction(share), transaction_(NULL) {
- transaction_ = new syncable::WriteTransaction(
- from_here, share->directory.get(), new_model_version);
-}
-
-WriteTransaction::~WriteTransaction() {
- delete transaction_;
-}
-
-syncable::BaseTransaction* WriteTransaction::GetWrappedTrans() const {
- return transaction_;
-}
-
-void WriteTransaction::SetDataTypeContext(
- ModelType type,
- SyncChangeProcessor::ContextRefreshStatus refresh_status,
- const std::string& context) {
- DCHECK(ProtocolTypes().Has(type));
- int field_number = GetSpecificsFieldNumberFromModelType(type);
- sync_pb::DataTypeContext local_context;
- GetDirectory()->GetDataTypeContext(transaction_, type, &local_context);
- if (local_context.context() == context)
- return;
-
- if (!local_context.has_data_type_id())
- local_context.set_data_type_id(field_number);
-
- DCHECK_EQ(field_number, local_context.data_type_id());
- DCHECK_GE(local_context.version(), 0);
- local_context.set_version(local_context.version() + 1);
- local_context.set_context(context);
- GetDirectory()->SetDataTypeContext(transaction_, type, local_context);
- if (refresh_status == SyncChangeProcessor::REFRESH_NEEDED) {
- DVLOG(1) << "Forcing refresh of type " << ModelTypeToString(type);
- // Clear the progress token from the progress markers. Preserve all other
- // state, in case a GC directive was present.
- sync_pb::DataTypeProgressMarker progress_marker;
- GetDirectory()->GetDownloadProgress(type, &progress_marker);
- progress_marker.clear_token();
- GetDirectory()->SetDownloadProgress(type, progress_marker);
-
- // Go through and reset the versions for all the synced entities of this
- // data type.
- GetDirectory()->ResetVersionsForType(transaction_, type);
- }
-
- // Note that it's possible for a GetUpdatesResponse that arrives immediately
- // after the context update to override the cleared progress markers.
- // TODO(zea): add a flag in the directory to prevent this from happening.
- // See crbug.com/360280
-}
-
-void WriteTransaction::UpdateEntriesMarkAttachmentAsOnServer(
- const AttachmentId& attachment_id) {
- syncable::Directory::Metahandles handles;
- GetDirectory()->GetMetahandlesByAttachmentId(
- transaction_, attachment_id.GetProto(), &handles);
- for (syncable::Directory::Metahandles::iterator iter = handles.begin();
- iter != handles.end(); ++iter) {
- syncable::MutableEntry entry(transaction_, syncable::GET_BY_HANDLE, *iter);
- entry.MarkAttachmentAsOnServer(attachment_id.GetProto());
- }
-}
-
-} // namespace syncer
« no previous file with comments | « components/sync/core/write_transaction.h ('k') | components/sync/core_impl/change_reorder_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698