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

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: Fix Android build 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
« no previous file with comments | « sync/syncable/directory.h ('k') | sync/syncable/directory_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 456
457 void Directory::UpdateAttachmentIndex( 457 void Directory::UpdateAttachmentIndex(
458 const int64 metahandle, 458 const int64 metahandle,
459 const sync_pb::AttachmentMetadata& old_metadata, 459 const sync_pb::AttachmentMetadata& old_metadata,
460 const sync_pb::AttachmentMetadata& new_metadata) { 460 const sync_pb::AttachmentMetadata& new_metadata) {
461 ScopedKernelLock lock(this); 461 ScopedKernelLock lock(this);
462 RemoveFromAttachmentIndex(metahandle, old_metadata, lock); 462 RemoveFromAttachmentIndex(metahandle, old_metadata, lock);
463 AddToAttachmentIndex(metahandle, new_metadata, lock); 463 AddToAttachmentIndex(metahandle, new_metadata, lock);
464 } 464 }
465 465
466 void Directory::GetMetahandlesByAttachmentId(
467 BaseTransaction* trans,
468 const sync_pb::AttachmentIdProto& attachment_id_proto,
469 Metahandles* result) {
470 DCHECK(result);
471 result->clear();
472 ScopedKernelLock lock(this);
473 IndexByAttachmentId::const_iterator index_iter =
474 kernel_->index_by_attachment_id.find(attachment_id_proto.unique_id());
475 if (index_iter == kernel_->index_by_attachment_id.end())
476 return;
477 const MetahandleSet& metahandle_set = index_iter->second;
478 std::copy(
479 metahandle_set.begin(), metahandle_set.end(), back_inserter(*result));
480 }
481
466 bool Directory::unrecoverable_error_set(const BaseTransaction* trans) const { 482 bool Directory::unrecoverable_error_set(const BaseTransaction* trans) const {
467 DCHECK(trans != NULL); 483 DCHECK(trans != NULL);
468 return unrecoverable_error_set_; 484 return unrecoverable_error_set_;
469 } 485 }
470 486
471 void Directory::ClearDirtyMetahandles() { 487 void Directory::ClearDirtyMetahandles() {
472 kernel_->transaction_mutex.AssertAcquired(); 488 kernel_->transaction_mutex.AssertAcquired();
473 kernel_->dirty_metahandles.clear(); 489 kernel_->dirty_metahandles.clear();
474 } 490 }
475 491
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 1443
1428 for (OrderedChildSet::const_iterator i = children->begin(); 1444 for (OrderedChildSet::const_iterator i = children->begin();
1429 i != children->end(); ++i) { 1445 i != children->end(); ++i) {
1430 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); 1446 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID));
1431 result->push_back((*i)->ref(META_HANDLE)); 1447 result->push_back((*i)->ref(META_HANDLE));
1432 } 1448 }
1433 } 1449 }
1434 1450
1435 } // namespace syncable 1451 } // namespace syncable
1436 } // namespace syncer 1452 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/directory.h ('k') | sync/syncable/directory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698