OLD | NEW |
| (Empty) |
1 // Copyright (c) 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. | |
4 | |
5 #include "sync/syncable/scoped_parent_child_index_updater.h" | |
6 | |
7 #include "sync/syncable/parent_child_index.h" | |
8 | |
9 namespace syncer { | |
10 namespace syncable { | |
11 | |
12 ScopedParentChildIndexUpdater::ScopedParentChildIndexUpdater( | |
13 const ScopedKernelLock& proof_of_lock, | |
14 EntryKernel* entry, | |
15 ParentChildIndex* index) | |
16 : entry_(entry), index_(index) { | |
17 if (ParentChildIndex::ShouldInclude(entry_)) { | |
18 index_->Remove(entry_); | |
19 } | |
20 } | |
21 | |
22 ScopedParentChildIndexUpdater::~ScopedParentChildIndexUpdater() { | |
23 if (ParentChildIndex::ShouldInclude(entry_)) { | |
24 index_->Insert(entry_); | |
25 } | |
26 } | |
27 | |
28 } // namespace syncable | |
29 } // namespace syncer | |
OLD | NEW |