| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |