OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sync/internal_api/public/write_transaction.h" | 5 #include "sync/internal_api/public/write_transaction.h" |
6 | 6 |
7 #include "sync/syncable/directory.h" | 7 #include "sync/syncable/directory.h" |
| 8 #include "sync/syncable/mutable_entry.h" |
8 #include "sync/syncable/syncable_write_transaction.h" | 9 #include "sync/syncable/syncable_write_transaction.h" |
9 | 10 |
10 namespace syncer { | 11 namespace syncer { |
11 | 12 |
12 ////////////////////////////////////////////////////////////////////////// | 13 ////////////////////////////////////////////////////////////////////////// |
13 // WriteTransaction member definitions | 14 // WriteTransaction member definitions |
14 WriteTransaction::WriteTransaction(const tracked_objects::Location& from_here, | 15 WriteTransaction::WriteTransaction(const tracked_objects::Location& from_here, |
15 UserShare* share) | 16 UserShare* share) |
16 : BaseTransaction(share), | 17 : BaseTransaction(share), |
17 transaction_(NULL) { | 18 transaction_(NULL) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // data type. | 74 // data type. |
74 GetDirectory()->ResetVersionsForType(transaction_, type); | 75 GetDirectory()->ResetVersionsForType(transaction_, type); |
75 } | 76 } |
76 | 77 |
77 // Note that it's possible for a GetUpdatesResponse that arrives immediately | 78 // Note that it's possible for a GetUpdatesResponse that arrives immediately |
78 // after the context update to override the cleared progress markers. | 79 // after the context update to override the cleared progress markers. |
79 // TODO(zea): add a flag in the directory to prevent this from happening. | 80 // TODO(zea): add a flag in the directory to prevent this from happening. |
80 // See crbug.com/360280 | 81 // See crbug.com/360280 |
81 } | 82 } |
82 | 83 |
| 84 void WriteTransaction::UpdateEntriesWithAttachmentId( |
| 85 const AttachmentId& attachment_id) { |
| 86 syncable::Directory::Metahandles handles; |
| 87 GetDirectory()->GetMetahandlesByAttachmentId( |
| 88 transaction_, attachment_id.GetProto(), &handles); |
| 89 for (syncable::Directory::Metahandles::iterator iter = handles.begin(); |
| 90 iter != handles.end(); |
| 91 ++iter) { |
| 92 syncable::MutableEntry entry(transaction_, syncable::GET_BY_HANDLE, *iter); |
| 93 entry.UpdateAttachmentIdWithServerInfo(attachment_id.GetProto()); |
| 94 } |
| 95 } |
| 96 |
83 } // namespace syncer | 97 } // namespace syncer |
OLD | NEW |