OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/directory.h" | 5 #include "sync/syncable/directory.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 STLValueDeleter<MetahandlesMap> deleter(&tmp_handles_map); | 182 STLValueDeleter<MetahandlesMap> deleter(&tmp_handles_map); |
183 | 183 |
184 JournalIndex delete_journals; | 184 JournalIndex delete_journals; |
185 MetahandleSet metahandles_to_purge; | 185 MetahandleSet metahandles_to_purge; |
186 | 186 |
187 DirOpenResult result = store_->Load(&tmp_handles_map, &delete_journals, | 187 DirOpenResult result = store_->Load(&tmp_handles_map, &delete_journals, |
188 &metahandles_to_purge, &info); | 188 &metahandles_to_purge, &info); |
189 if (OPENED != result) | 189 if (OPENED != result) |
190 return result; | 190 return result; |
191 | 191 |
| 192 DCHECK(!kernel_); |
192 kernel_ = new Kernel(name, info, delegate, transaction_observer); | 193 kernel_ = new Kernel(name, info, delegate, transaction_observer); |
193 delete_journal_.reset(new DeleteJournal(&delete_journals)); | 194 delete_journal_.reset(new DeleteJournal(&delete_journals)); |
194 InitializeIndices(&tmp_handles_map); | 195 InitializeIndices(&tmp_handles_map); |
195 | 196 |
196 // Write back the share info to reserve some space in 'next_id'. This will | 197 // Write back the share info to reserve some space in 'next_id'. This will |
197 // prevent local ID reuse in the case of an early crash. See the comments in | 198 // prevent local ID reuse in the case of an early crash. See the comments in |
198 // TakeSnapshotForSaveChanges() or crbug.com/142987 for more information. | 199 // TakeSnapshotForSaveChanges() or crbug.com/142987 for more information. |
199 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY; | 200 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY; |
200 | 201 |
201 kernel_->metahandles_to_purge.swap(metahandles_to_purge); | 202 kernel_->metahandles_to_purge.swap(metahandles_to_purge); |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 // server. To avoid re-uploading the same attachment mulitple times, we | 1542 // server. To avoid re-uploading the same attachment mulitple times, we |
1542 // remove any ids known to be on the server from the id_set we are about to | 1543 // remove any ids known to be on the server from the id_set we are about to |
1543 // return. | 1544 // return. |
1544 // | 1545 // |
1545 // TODO(maniscalco): Eliminate redundant metadata storage (bug 415203). | 1546 // TODO(maniscalco): Eliminate redundant metadata storage (bug 415203). |
1546 std::set_difference(not_on_server_id_set.begin(), not_on_server_id_set.end(), | 1547 std::set_difference(not_on_server_id_set.begin(), not_on_server_id_set.end(), |
1547 on_server_id_set.begin(), on_server_id_set.end(), | 1548 on_server_id_set.begin(), on_server_id_set.end(), |
1548 std::back_inserter(*ids)); | 1549 std::back_inserter(*ids)); |
1549 } | 1550 } |
1550 | 1551 |
| 1552 Directory::Kernel* Directory::kernel() { |
| 1553 return kernel_; |
| 1554 } |
| 1555 |
| 1556 const Directory::Kernel* Directory::kernel() const { |
| 1557 return kernel_; |
| 1558 } |
| 1559 |
1551 } // namespace syncable | 1560 } // namespace syncable |
1552 } // namespace syncer | 1561 } // namespace syncer |
OLD | NEW |