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

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

Issue 272043002: Invoke AttachmentUploader and update AttachmentIds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initialize through SyncApiComponentFactory Created 6 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 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
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,
463 const sync_pb::AttachmentIdProto& attachment_id_proto,
464 Metahandles* result) {
465 DCHECK(result);
466 result->clear();
467 ScopedKernelLock lock(this);
468 IndexByAttachmentId::const_iterator index_iter =
469 kernel_->index_by_attachment_id.find(attachment_id_proto.unique_id());
470 if (index_iter == kernel_->index_by_attachment_id.end())
471 return;
472 const MetahandleSet& metahandle_set = index_iter->second;
473 std::copy(
474 metahandle_set.begin(), metahandle_set.end(), back_inserter(*result));
475 }
476
461 bool Directory::unrecoverable_error_set(const BaseTransaction* trans) const { 477 bool Directory::unrecoverable_error_set(const BaseTransaction* trans) const {
462 DCHECK(trans != NULL); 478 DCHECK(trans != NULL);
463 return unrecoverable_error_set_; 479 return unrecoverable_error_set_;
464 } 480 }
465 481
466 void Directory::ClearDirtyMetahandles() { 482 void Directory::ClearDirtyMetahandles() {
467 kernel_->transaction_mutex.AssertAcquired(); 483 kernel_->transaction_mutex.AssertAcquired();
468 kernel_->dirty_metahandles.clear(); 484 kernel_->dirty_metahandles.clear();
469 } 485 }
470 486
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 1438
1423 for (OrderedChildSet::const_iterator i = children->begin(); 1439 for (OrderedChildSet::const_iterator i = children->begin();
1424 i != children->end(); ++i) { 1440 i != children->end(); ++i) {
1425 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); 1441 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID));
1426 result->push_back((*i)->ref(META_HANDLE)); 1442 result->push_back((*i)->ref(META_HANDLE));
1427 } 1443 }
1428 } 1444 }
1429 1445
1430 } // namespace syncable 1446 } // namespace syncable
1431 } // namespace syncer 1447 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698