Update V8 to version 3.31.22 (based on 322bb23e82fc4e6f7493ce53a282ccdf82066195).
[chromium-blink-merge.git] / sync / syncable / mutable_entry.h
blob615fe806c26f2a1806e1e1eb890d8508130775d5
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef SYNC_SYNCABLE_MUTABLE_ENTRY_H_
6 #define SYNC_SYNCABLE_MUTABLE_ENTRY_H_
8 #include "sync/base/sync_export.h"
9 #include "sync/internal_api/public/base/model_type.h"
10 #include "sync/syncable/entry.h"
11 #include "sync/syncable/metahandle_set.h"
12 #include "sync/syncable/model_neutral_mutable_entry.h"
14 namespace syncer {
15 class WriteNode;
17 namespace syncable {
19 enum Create {
20 CREATE
23 class WriteTransaction;
25 // A mutable meta entry. Changes get committed to the database when the
26 // WriteTransaction is destroyed.
27 class SYNC_EXPORT_PRIVATE MutableEntry : public ModelNeutralMutableEntry {
28 void Init(WriteTransaction* trans, ModelType model_type,
29 const Id& parent_id, const std::string& name);
31 public:
32 MutableEntry(WriteTransaction* trans, CreateNewUpdateItem, const Id& id);
33 MutableEntry(WriteTransaction* trans, Create, ModelType model_type,
34 const Id& parent_id, const std::string& name);
35 MutableEntry(WriteTransaction* trans, GetByHandle, int64);
36 MutableEntry(WriteTransaction* trans, GetById, const Id&);
37 MutableEntry(WriteTransaction* trans, GetByClientTag, const std::string& tag);
38 MutableEntry(WriteTransaction* trans, GetTypeRoot, ModelType type);
40 inline WriteTransaction* write_transaction() const {
41 return write_transaction_;
44 // Model-changing setters. These setters make user-visible changes that will
45 // need to be communicated either to the local model or the sync server.
46 void PutLocalExternalId(int64 value);
47 void PutMtime(base::Time value);
48 void PutCtime(base::Time value);
49 void PutParentId(const Id& value);
50 void PutIsDir(bool value);
51 void PutIsDel(bool value);
52 void PutNonUniqueName(const std::string& value);
53 void PutSpecifics(const sync_pb::EntitySpecifics& value);
54 void PutUniquePosition(const UniquePosition& value);
56 // Sets the position of this item, and updates the entry kernels of the
57 // adjacent siblings so that list invariants are maintained. Returns false
58 // and fails if |predecessor_id| does not identify a sibling. Pass the root
59 // ID to put the node in first position.
60 bool PutPredecessor(const Id& predecessor_id);
62 void PutAttachmentMetadata(
63 const sync_pb::AttachmentMetadata& attachment_metadata);
65 // Update attachment metadata for |attachment_id| to indicate that this
66 // attachment has been uploaded to the sync server.
67 void MarkAttachmentAsOnServer(
68 const sync_pb::AttachmentIdProto& attachment_id);
70 private:
71 // Kind of redundant. We should reduce the number of pointers
72 // floating around if at all possible. Could we store this in Directory?
73 // Scope: Set on construction, never changed after that.
74 WriteTransaction* const write_transaction_;
76 DISALLOW_COPY_AND_ASSIGN(MutableEntry);
79 // This function sets only the flags needed to get this entry to sync.
80 bool MarkForSyncing(syncable::MutableEntry* e);
82 } // namespace syncable
83 } // namespace syncer
85 #endif // SYNC_SYNCABLE_MUTABLE_ENTRY_H_