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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc

Issue 134863003: [SyncFS] Refactor MetadataDatabase on dirty flag handling and sync-root creation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: testfix Created 6 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/metadata_database.h » ('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 "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" 5 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 12 matching lines...) Expand all
23 23
24 void PutServiceMetadataToBatch(const ServiceMetadata& service_metadata, 24 void PutServiceMetadataToBatch(const ServiceMetadata& service_metadata,
25 leveldb::WriteBatch* batch) { 25 leveldb::WriteBatch* batch) {
26 std::string value; 26 std::string value;
27 bool success = service_metadata.SerializeToString(&value); 27 bool success = service_metadata.SerializeToString(&value);
28 DCHECK(success); 28 DCHECK(success);
29 batch->Put(kServiceMetadataKey, value); 29 batch->Put(kServiceMetadataKey, value);
30 } 30 }
31 31
32 void PutFileToBatch(const FileMetadata& file, leveldb::WriteBatch* batch) { 32 void PutFileToBatch(const FileMetadata& file, leveldb::WriteBatch* batch) {
33 if (!batch)
34 return;
35
33 std::string value; 36 std::string value;
34 bool success = file.SerializeToString(&value); 37 bool success = file.SerializeToString(&value);
35 DCHECK(success); 38 DCHECK(success);
36 batch->Put(kFileMetadataKeyPrefix + file.file_id(), value); 39 batch->Put(kFileMetadataKeyPrefix + file.file_id(), value);
37 } 40 }
38 41
39 void PutTrackerToBatch(const FileTracker& tracker, leveldb::WriteBatch* batch) { 42 void PutTrackerToBatch(const FileTracker& tracker, leveldb::WriteBatch* batch) {
43 if (!batch)
44 return;
45
40 std::string value; 46 std::string value;
41 bool success = tracker.SerializeToString(&value); 47 bool success = tracker.SerializeToString(&value);
42 DCHECK(success); 48 DCHECK(success);
43 batch->Put(kFileTrackerKeyPrefix + base::Int64ToString(tracker.tracker_id()), 49 batch->Put(kFileTrackerKeyPrefix + base::Int64ToString(tracker.tracker_id()),
44 value); 50 value);
45 } 51 }
46 52
47 void PopulateFileDetailsByFileResource( 53 void PopulateFileDetailsByFileResource(
48 const google_apis::FileResource& file_resource, 54 const google_apis::FileResource& file_resource,
49 FileDetails* details) { 55 FileDetails* details) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 247
242 util::Log(logging::LOG_WARNING, 248 util::Log(logging::LOG_WARNING,
243 FROM_HERE, 249 FROM_HERE,
244 "Got unexpected error: %d", 250 "Got unexpected error: %d",
245 static_cast<int>(error)); 251 static_cast<int>(error));
246 return SYNC_STATUS_FAILED; 252 return SYNC_STATUS_FAILED;
247 } 253 }
248 254
249 } // namespace drive_backend 255 } // namespace drive_backend
250 } // namespace sync_file_system 256 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/metadata_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698