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

Side by Side Diff: chrome/browser/sync_file_system/drive_metadata_store.cc

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/sync_file_system/drive_metadata_store.h" 5 #include "chrome/browser/sync_file_system/drive_metadata_store.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 void DriveMetadataStore::DidUpdateOrigin( 639 void DriveMetadataStore::DidUpdateOrigin(
640 const SyncStatusCallback& callback, 640 const SyncStatusCallback& callback,
641 SyncStatusCode status) { 641 SyncStatusCode status) {
642 UpdateDBStatus(status); 642 UpdateDBStatus(status);
643 callback.Run(status); 643 callback.Run(status);
644 } 644 }
645 645
646 void DriveMetadataStore::WriteToDB(scoped_ptr<leveldb::WriteBatch> batch, 646 void DriveMetadataStore::WriteToDB(scoped_ptr<leveldb::WriteBatch> batch,
647 const SyncStatusCallback& callback) { 647 const SyncStatusCallback& callback) {
648 base::PostTaskAndReplyWithResult( 648 base::PostTaskAndReplyWithResult(
649 file_task_runner_, FROM_HERE, 649 file_task_runner_.get(),
650 base::Bind(&leveldb::DB::Write, base::Unretained(db_.get()), 650 FROM_HERE,
651 leveldb::WriteOptions(), base::Owned(batch.release())), 651 base::Bind(&leveldb::DB::Write,
652 base::Unretained(db_.get()),
653 leveldb::WriteOptions(),
654 base::Owned(batch.release())),
652 base::Bind(&DriveMetadataStore::UpdateDBStatusAndInvokeCallback, 655 base::Bind(&DriveMetadataStore::UpdateDBStatusAndInvokeCallback,
653 AsWeakPtr(), callback)); 656 AsWeakPtr(),
657 callback));
654 } 658 }
655 659
656 void DriveMetadataStore::UpdateDBStatus(SyncStatusCode status) { 660 void DriveMetadataStore::UpdateDBStatus(SyncStatusCode status) {
657 DCHECK(CalledOnValidThread()); 661 DCHECK(CalledOnValidThread());
658 if (db_status_ != SYNC_STATUS_OK && 662 if (db_status_ != SYNC_STATUS_OK &&
659 db_status_ != SYNC_DATABASE_ERROR_NOT_FOUND) { 663 db_status_ != SYNC_DATABASE_ERROR_NOT_FOUND) {
660 // TODO(tzik): Handle database corruption. http://crbug.com/153709 664 // TODO(tzik): Handle database corruption. http://crbug.com/153709
661 db_status_ = status; 665 db_status_ = status;
662 util::Log(logging::LOG_WARNING, 666 util::Log(logging::LOG_WARNING,
663 FROM_HERE, 667 FROM_HERE,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 details << "resource_id=" << metadata.resource_id() << "\n" 788 details << "resource_id=" << metadata.resource_id() << "\n"
785 << "md5_checksum=" << metadata.md5_checksum() << "\n" 789 << "md5_checksum=" << metadata.md5_checksum() << "\n"
786 << "to_be_fetched=" << metadata.to_be_fetched() << "\n"; 790 << "to_be_fetched=" << metadata.to_be_fetched() << "\n";
787 FileMetadata file_metadata(title, type, details.str()); 791 FileMetadata file_metadata(title, type, details.str());
788 (*output_map)[origin][itr->first] = file_metadata; 792 (*output_map)[origin][itr->first] = file_metadata;
789 } 793 }
790 } 794 }
791 } 795 }
792 796
793 } // namespace sync_file_system 797 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698