Roll src/third_party/WebKit 5dc6c7a:f688398 (svn 201993:201994)
[chromium-blink-merge.git] / sync / syncable / scoped_parent_child_index_updater.cc
blob0dc3e95332399d1a0242d24d2d7cf62eee6621e1
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.
5 #include "sync/syncable/scoped_parent_child_index_updater.h"
7 #include "sync/syncable/parent_child_index.h"
9 namespace syncer {
10 namespace syncable {
12 ScopedParentChildIndexUpdater::ScopedParentChildIndexUpdater(
13 ScopedKernelLock& proof_of_lock,
14 EntryKernel* entry,
15 ParentChildIndex* index) : entry_(entry), index_(index) {
16 if (ParentChildIndex::ShouldInclude(entry_)) {
17 index_->Remove(entry_);
21 ScopedParentChildIndexUpdater::~ScopedParentChildIndexUpdater() {
22 if (ParentChildIndex::ShouldInclude(entry_)) {
23 index_->Insert(entry_);
27 } // namespace syncer
28 } // namespace syncable