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

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

Issue 428063002: [SyncFS] Replace leveldb classes with LevelDBWrapper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 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 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" 14 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h"
15 #include "chrome/browser/sync_file_system/sync_status_code.h" 15 #include "chrome/browser/sync_file_system/sync_status_code.h"
16 #include "google_apis/drive/gdata_errorcode.h" 16 #include "google_apis/drive/gdata_errorcode.h"
17 #include "webkit/common/blob/scoped_file.h" 17 #include "webkit/common/blob/scoped_file.h"
18 18
19 namespace google_apis { 19 namespace google_apis {
20 class ChangeResource; 20 class ChangeResource;
21 class FileResource; 21 class FileResource;
22 class ResourceEntry; 22 class ResourceEntry;
23 } 23 }
24 24
25 namespace leveldb {
26 class DB;
27 class WriteBatch;
28 }
29
30 namespace sync_file_system { 25 namespace sync_file_system {
31 namespace drive_backend { 26 namespace drive_backend {
32 27
33 void PutVersionToBatch(int64 version, leveldb::WriteBatch* batch); 28 class LevelDBWrapper;
34 29
35 void PutServiceMetadataToBatch(const ServiceMetadata& service_metadata, 30 void PutVersionToDB(int64 version, LevelDBWrapper* db);
36 leveldb::WriteBatch* batch);
37 void PutFileMetadataToBatch(const FileMetadata& file,
38 leveldb::WriteBatch* batch);
39 void PutFileTrackerToBatch(const FileTracker& tracker,
40 leveldb::WriteBatch* batch);
41 31
42 void PutFileMetadataDeletionToBatch(const std::string& file_id, 32 void PutServiceMetadataToDB(const ServiceMetadata& service_metadata,
43 leveldb::WriteBatch* batch); 33 LevelDBWrapper* db);
44 void PutFileTrackerDeletionToBatch(int64 tracker_id, 34 void PutFileMetadataToDB(const FileMetadata& file, LevelDBWrapper* db);
45 leveldb::WriteBatch* batch); 35 void PutFileTrackerToDB(const FileTracker& tracker, LevelDBWrapper* db);
36
37 void PutFileMetadataDeletionToDB(const std::string& file_id,
38 LevelDBWrapper* db);
nhiroki 2014/08/01 09:43:38 nit: indent is broken.
peria 2014/08/04 03:13:42 Done.
tzik 2014/08/04 03:26:23 indent?
39 void PutFileTrackerDeletionToDB(int64 tracker_id, LevelDBWrapper* db);
46 40
47 bool HasFileAsParent(const FileDetails& details, const std::string& file_id); 41 bool HasFileAsParent(const FileDetails& details, const std::string& file_id);
48 42
49 bool IsAppRoot(const FileTracker& tracker); 43 bool IsAppRoot(const FileTracker& tracker);
50 44
51 std::string GetTrackerTitle(const FileTracker& tracker); 45 std::string GetTrackerTitle(const FileTracker& tracker);
52 46
53 SyncStatusCode GDataErrorCodeToSyncStatusCode( 47 SyncStatusCode GDataErrorCodeToSyncStatusCode(
54 google_apis::GDataErrorCode error); 48 google_apis::GDataErrorCode error);
55 49
56 // Returns true if |str| starts with |prefix|, and removes |prefix| from |str|. 50 // Returns true if |str| starts with |prefix|, and removes |prefix| from |str|.
57 // If |out| is not NULL, the result is stored in it. 51 // If |out| is not NULL, the result is stored in it.
58 bool RemovePrefix(const std::string& str, const std::string& prefix, 52 bool RemovePrefix(const std::string& str, const std::string& prefix,
59 std::string* out); 53 std::string* out);
60 54
61 scoped_ptr<ServiceMetadata> InitializeServiceMetadata(leveldb::DB* db); 55 scoped_ptr<ServiceMetadata> InitializeServiceMetadata(LevelDBWrapper* db);
62 56
63 template <typename Src, typename Dest> 57 template <typename Src, typename Dest>
64 void AppendContents(const Src& src, Dest* dest) { 58 void AppendContents(const Src& src, Dest* dest) {
65 dest->insert(dest->end(), src.begin(), src.end()); 59 dest->insert(dest->end(), src.begin(), src.end());
66 } 60 }
67 61
68 template <typename Container> 62 template <typename Container>
69 const typename Container::mapped_type& LookUpMap( 63 const typename Container::mapped_type& LookUpMap(
70 const Container& container, 64 const Container& container,
71 const typename Container::key_type& key, 65 const typename Container::key_type& key,
(...skipping 14 matching lines...) Expand all
86 base::Callback<R()> CreateComposedFunction( 80 base::Callback<R()> CreateComposedFunction(
87 const base::Callback<T()>& g, 81 const base::Callback<T()>& g,
88 const base::Callback<R(S)>& f) { 82 const base::Callback<R(S)>& f) {
89 return base::Bind(&ComposeFunction<R, S, T>, g, f); 83 return base::Bind(&ComposeFunction<R, S, T>, g, f);
90 } 84 }
91 85
92 } // namespace drive_backend 86 } // namespace drive_backend
93 } // namespace sync_file_system 87 } // namespace sync_file_system
94 88
95 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_ 89 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698