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 <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 | 451 |
452 void Directory::UpdateAttachmentIndex( | 452 void Directory::UpdateAttachmentIndex( |
453 const int64 metahandle, | 453 const int64 metahandle, |
454 const sync_pb::AttachmentMetadata& old_metadata, | 454 const sync_pb::AttachmentMetadata& old_metadata, |
455 const sync_pb::AttachmentMetadata& new_metadata) { | 455 const sync_pb::AttachmentMetadata& new_metadata) { |
456 ScopedKernelLock lock(this); | 456 ScopedKernelLock lock(this); |
457 RemoveFromAttachmentIndex(metahandle, old_metadata, lock); | 457 RemoveFromAttachmentIndex(metahandle, old_metadata, lock); |
458 AddToAttachmentIndex(metahandle, new_metadata, lock); | 458 AddToAttachmentIndex(metahandle, new_metadata, lock); |
459 } | 459 } |
460 | 460 |
461 void Directory::GetMetahandlesByAttachmentId( | |
462 BaseTransaction* trans, | |
maniscalco
2014/05/09 18:12:11
I want to confirm my understanding. The only reas
pavely
2014/05/13 23:06:44
Yes, that's right. If unaware developer tries to c
maniscalco
2014/05/15 20:09:28
Yeah, the only reason I suggesting DCHECKing the t
| |
463 const sync_pb::AttachmentIdProto& attachment_id_proto, | |
464 Metahandles* result) { | |
maniscalco
2014/05/09 18:12:11
nit: consider DCHECKing result.
pavely
2014/05/13 23:06:44
Done.
| |
465 ScopedKernelLock lock(this); | |
466 IndexByAttachmentId::iterator index_iter = | |
maniscalco
2014/05/09 18:12:11
Could this be made a const_iterator?
pavely
2014/05/13 23:06:44
Done.
| |
467 kernel_->index_by_attachment_id.find(attachment_id_proto.unique_id()); | |
468 if (index_iter == kernel_->index_by_attachment_id.end()) | |
469 return; | |
maniscalco
2014/05/09 18:12:11
From the header comment and method name, it's not
pavely
2014/05/13 23:06:44
Yes, I should have cleared it.
Done.
On 2014/05/09
| |
470 const MetahandleSet& metahandle_set = index_iter->second; | |
471 copy(metahandle_set.begin(), metahandle_set.end(), back_inserter(*result)); | |
maniscalco
2014/05/09 18:12:11
Huh, I would have expected this to need std::. Ma
pavely
2014/05/13 23:06:44
Maybe... I copied it from GetUnsyncedMetaHandles.
| |
472 } | |
473 | |
461 bool Directory::unrecoverable_error_set(const BaseTransaction* trans) const { | 474 bool Directory::unrecoverable_error_set(const BaseTransaction* trans) const { |
462 DCHECK(trans != NULL); | 475 DCHECK(trans != NULL); |
463 return unrecoverable_error_set_; | 476 return unrecoverable_error_set_; |
464 } | 477 } |
465 | 478 |
466 void Directory::ClearDirtyMetahandles() { | 479 void Directory::ClearDirtyMetahandles() { |
467 kernel_->transaction_mutex.AssertAcquired(); | 480 kernel_->transaction_mutex.AssertAcquired(); |
468 kernel_->dirty_metahandles.clear(); | 481 kernel_->dirty_metahandles.clear(); |
469 } | 482 } |
470 | 483 |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1422 | 1435 |
1423 for (OrderedChildSet::const_iterator i = children->begin(); | 1436 for (OrderedChildSet::const_iterator i = children->begin(); |
1424 i != children->end(); ++i) { | 1437 i != children->end(); ++i) { |
1425 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); | 1438 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); |
1426 result->push_back((*i)->ref(META_HANDLE)); | 1439 result->push_back((*i)->ref(META_HANDLE)); |
1427 } | 1440 } |
1428 } | 1441 } |
1429 | 1442 |
1430 } // namespace syncable | 1443 } // namespace syncable |
1431 } // namespace syncer | 1444 } // namespace syncer |
OLD | NEW |