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

Side by Side Diff: components/sync/engine/attachments/on_disk_attachment_store.h

Issue 2915453002: Deprecate NonThreadSafe in components/sync in favor of SequenceChecker. (Closed)
Patch Set: fix comment Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_SYNC_ENGINE_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ 5 #ifndef COMPONENTS_SYNC_ENGINE_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_
6 #define COMPONENTS_SYNC_ENGINE_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ 6 #define COMPONENTS_SYNC_ENGINE_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/sequence_checker.h"
15 #include "components/sync/engine/attachments/attachment_store_backend.h" 15 #include "components/sync/engine/attachments/attachment_store_backend.h"
16 #include "components/sync/model/attachments/attachment.h" 16 #include "components/sync/model/attachments/attachment.h"
17 #include "components/sync/model/attachments/attachment_id.h" 17 #include "components/sync/model/attachments/attachment_id.h"
18 #include "components/sync/model/attachments/attachment_store.h" 18 #include "components/sync/model/attachments/attachment_store.h"
19 19
20 namespace attachment_store_pb { 20 namespace attachment_store_pb {
21 class RecordMetadata; 21 class RecordMetadata;
22 } // namespace attachment_store_pb 22 } // namespace attachment_store_pb
23 23
24 namespace base { 24 namespace base {
25 class SequencedTaskRunner; 25 class SequencedTaskRunner;
26 } // namespace base 26 } // namespace base
27 27
28 namespace leveldb { 28 namespace leveldb {
29 class DB; 29 class DB;
30 } // namespace leveldb 30 } // namespace leveldb
31 31
32 namespace syncer { 32 namespace syncer {
33 33
34 // On-disk implementation of AttachmentStore. Stores attachments in leveldb 34 // On-disk implementation of AttachmentStore. Stores attachments in leveldb
35 // database in |path| directory. 35 // database in |path| directory.
36 class OnDiskAttachmentStore : public AttachmentStoreBackend, 36 class OnDiskAttachmentStore : public AttachmentStoreBackend {
37 public base::NonThreadSafe {
38 public: 37 public:
39 // Constructs attachment store. 38 // Constructs attachment store.
40 OnDiskAttachmentStore( 39 OnDiskAttachmentStore(
41 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner, 40 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner,
42 const base::FilePath& path); 41 const base::FilePath& path);
43 ~OnDiskAttachmentStore() override; 42 ~OnDiskAttachmentStore() override;
44 43
45 // AttachmentStoreBackend implementation. 44 // AttachmentStoreBackend implementation.
46 void Init(const AttachmentStore::InitCallback& callback) override; 45 void Init(const AttachmentStore::InitCallback& callback) override;
47 void Read(AttachmentStore::Component component, 46 void Read(AttachmentStore::Component component,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 const AttachmentId& attachment_id); 91 const AttachmentId& attachment_id);
93 static std::string MakeMetadataKeyFromAttachmentId( 92 static std::string MakeMetadataKeyFromAttachmentId(
94 const AttachmentId& attachment_id); 93 const AttachmentId& attachment_id);
95 static AttachmentMetadata MakeAttachmentMetadata( 94 static AttachmentMetadata MakeAttachmentMetadata(
96 const AttachmentId& attachment_id, 95 const AttachmentId& attachment_id,
97 const attachment_store_pb::RecordMetadata& record_metadata); 96 const attachment_store_pb::RecordMetadata& record_metadata);
98 97
99 const base::FilePath path_; 98 const base::FilePath path_;
100 std::unique_ptr<leveldb::DB> db_; 99 std::unique_ptr<leveldb::DB> db_;
101 100
101 SEQUENCE_CHECKER(sequence_checker_);
102
102 DISALLOW_COPY_AND_ASSIGN(OnDiskAttachmentStore); 103 DISALLOW_COPY_AND_ASSIGN(OnDiskAttachmentStore);
103 }; 104 };
104 105
105 } // namespace syncer 106 } // namespace syncer
106 107
107 #endif // COMPONENTS_SYNC_ENGINE_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ 108 #endif // COMPONENTS_SYNC_ENGINE_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698