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

Unified Diff: sync/syncable/mutable_entry.cc

Issue 11863011: Revert 176340 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 | « sync/syncable/mutable_entry.h ('k') | sync/syncable/syncable_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/mutable_entry.cc
===================================================================
--- sync/syncable/mutable_entry.cc (revision 176351)
+++ sync/syncable/mutable_entry.cc (working copy)
@@ -19,9 +19,15 @@
namespace syncer {
namespace syncable {
-void MutableEntry::Init(WriteTransaction* trans,
- ModelType model_type,
- const Id& parent_id,
+MutableEntry::MutableEntry(WriteTransaction* trans, Create,
+ const Id& parent_id, const string& name)
+ : Entry(trans),
+ write_transaction_(trans) {
+ Init(trans, parent_id, name);
+}
+
+
+void MutableEntry::Init(WriteTransaction* trans, const Id& parent_id,
const string& name) {
scoped_ptr<EntryKernel> kernel(new EntryKernel);
kernel_ = NULL;
@@ -37,15 +43,9 @@
// We match the database defaults here
kernel->put(BASE_VERSION, CHANGES_VERSION);
kernel->put(SERVER_ORDINAL_IN_PARENT, NodeOrdinal::CreateInitialOrdinal());
-
- // Normally the SPECIFICS setting code is wrapped in logic to deal with
- // unknown fields and encryption. Since all we want to do here is ensure that
- // GetModelType() returns a correct value from the very beginning, these
- // few lines are sufficient.
- sync_pb::EntitySpecifics specifics;
- AddDefaultFieldValue(model_type, &specifics);
- kernel->put(SPECIFICS, specifics);
-
+ if (!trans->directory()->InsertEntry(trans, kernel.get())) {
+ return; // We failed inserting, nothing more to do.
+ }
// Because this entry is new, it was originally deleted.
kernel->put(IS_DEL, true);
trans->SaveOriginal(kernel.get());
@@ -55,17 +55,6 @@
kernel_ = kernel.release();
}
-MutableEntry::MutableEntry(WriteTransaction* trans,
- Create,
- ModelType model_type,
- const Id& parent_id,
- const string& name)
- : Entry(trans),
- write_transaction_(trans) {
- Init(trans, model_type, parent_id, name);
- DCHECK(trans->directory()->InsertEntry(trans, kernel_));
-}
-
MutableEntry::MutableEntry(WriteTransaction* trans, CreateNewUpdateItem,
const Id& id)
: Entry(trans), write_transaction_(trans) {
« no previous file with comments | « sync/syncable/mutable_entry.h ('k') | sync/syncable/syncable_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698