| 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/syncable/mutable_entry.h" | 5 #include "sync/syncable/mutable_entry.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "sync/internal_api/public/base/unique_position.h" | 8 #include "sync/internal_api/public/base/unique_position.h" |
| 9 #include "sync/syncable/directory.h" | 9 #include "sync/syncable/directory.h" |
| 10 #include "sync/syncable/scoped_kernel_lock.h" | 10 #include "sync/syncable/scoped_kernel_lock.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 write_transaction()->TrackChangesTo(kernel_); | 177 write_transaction()->TrackChangesTo(kernel_); |
| 178 if (value == kernel_->ref(IS_DEL)) { | 178 if (value == kernel_->ref(IS_DEL)) { |
| 179 return; | 179 return; |
| 180 } | 180 } |
| 181 if (value) { | 181 if (value) { |
| 182 // If the server never knew about this item and it's deleted then we don't | 182 // If the server never knew about this item and it's deleted then we don't |
| 183 // need to keep it around. Unsetting IS_UNSYNCED will: | 183 // need to keep it around. Unsetting IS_UNSYNCED will: |
| 184 // - Ensure that the item is never committed to the server. | 184 // - Ensure that the item is never committed to the server. |
| 185 // - Allow any items with the same UNIQUE_CLIENT_TAG created on other | 185 // - Allow any items with the same UNIQUE_CLIENT_TAG created on other |
| 186 // clients to override this entry. | 186 // clients to override this entry. |
| 187 // - Let us delete this entry permanently through | 187 // - Let us delete this entry permanently when we next restart sync - see |
| 188 // DirectoryBackingStore::DropDeletedEntries() when we next restart sync. | 188 // DirectoryBackingStore::SafeToPurgeOnLoading. |
| 189 // This will save memory and avoid crbug.com/125381. | 189 // This will avoid crbug.com/125381. |
| 190 // Note: do not unset IsUnsynced if the syncer is in the middle of | 190 // Note: do not unset IsUnsynced if the syncer is in the middle of |
| 191 // attempting to commit this entity. | 191 // attempting to commit this entity. |
| 192 if (!GetId().ServerKnows() && !GetSyncing()) { | 192 if (!GetId().ServerKnows() && !GetSyncing()) { |
| 193 PutIsUnsynced(false); | 193 PutIsUnsynced(false); |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 | 196 |
| 197 { | 197 { |
| 198 ScopedKernelLock lock(dir()); | 198 ScopedKernelLock lock(dir()); |
| 199 // Some indices don't include deleted items and must be updated | 199 // Some indices don't include deleted items and must be updated |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 DCHECK_NE(static_cast<MutableEntry*>(NULL), e); | 292 DCHECK_NE(static_cast<MutableEntry*>(NULL), e); |
| 293 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; | 293 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; |
| 294 if (!(e->PutIsUnsynced(true))) | 294 if (!(e->PutIsUnsynced(true))) |
| 295 return false; | 295 return false; |
| 296 e->PutSyncing(false); | 296 e->PutSyncing(false); |
| 297 return true; | 297 return true; |
| 298 } | 298 } |
| 299 | 299 |
| 300 } // namespace syncable | 300 } // namespace syncable |
| 301 } // namespace syncer | 301 } // namespace syncer |
| OLD | NEW |