Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: sync/syncable/syncable_write_transaction.cc

Issue 15308003: sync: Test and improve bookmark performance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/syncable_write_transaction.h" 5 #include "sync/syncable/syncable_write_transaction.h"
6 6
7 #include "sync/syncable/directory.h" 7 #include "sync/syncable/directory.h"
8 #include "sync/syncable/directory_change_delegate.h" 8 #include "sync/syncable/directory_change_delegate.h"
9 #include "sync/syncable/mutable_entry.h" 9 #include "sync/syncable/mutable_entry.h"
10 #include "sync/syncable/transaction_observer.h" 10 #include "sync/syncable/transaction_observer.h"
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 34
35 void WriteTransaction::SaveOriginal(const EntryKernel* entry) { 35 void WriteTransaction::SaveOriginal(const EntryKernel* entry) {
36 if (!entry) { 36 if (!entry) {
37 return; 37 return;
38 } 38 }
39 // Insert only if it's not already there. 39 // Insert only if it's not already there.
40 const int64 handle = entry->ref(META_HANDLE); 40 const int64 handle = entry->ref(META_HANDLE);
41 EntryKernelMutationMap::iterator it = mutations_.lower_bound(handle); 41 EntryKernelMutationMap::iterator it = mutations_.lower_bound(handle);
42 if (it == mutations_.end() || it->first != handle) { 42 if (it == mutations_.end() || it->first != handle) {
43 EntryKernelMutation mutation; 43 mutations_[handle].original = *entry;
44 mutation.original = *entry;
45 ignore_result(mutations_.insert(it, std::make_pair(handle, mutation)));
46 } 44 }
47 } 45 }
48 46
49 ImmutableEntryKernelMutationMap WriteTransaction::RecordMutations() { 47 ImmutableEntryKernelMutationMap WriteTransaction::RecordMutations() {
50 directory_->kernel_->transaction_mutex.AssertAcquired(); 48 directory_->kernel_->transaction_mutex.AssertAcquired();
51 for (syncable::EntryKernelMutationMap::iterator it = mutations_.begin(); 49 for (syncable::EntryKernelMutationMap::iterator it = mutations_.begin();
52 it != mutations_.end();) { 50 it != mutations_.end();) {
53 EntryKernel* kernel = directory()->GetEntryByHandle(it->first); 51 EntryKernel* kernel = directory()->GetEntryByHandle(it->first);
54 if (!kernel) { 52 if (!kernel) {
55 NOTREACHED(); 53 NOTREACHED();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 ENUM_CASE(SYNCAPI); 173 ENUM_CASE(SYNCAPI);
176 }; 174 };
177 NOTREACHED(); 175 NOTREACHED();
178 return std::string(); 176 return std::string();
179 } 177 }
180 178
181 #undef ENUM_CASE 179 #undef ENUM_CASE
182 180
183 } // namespace syncable 181 } // namespace syncable
184 } // namespace syncer 182 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698