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

Side by Side Diff: sync/api/attachments/attachment.h

Issue 710073003: Store attachment crc in AttachmentStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/BUILD.gn ('k') | sync/api/attachments/attachment.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 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 SYNC_API_ATTACHMENTS_ATTACHMENT_H_ 5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_H_
6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_H_ 6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 14 matching lines...) Expand all
25 // It is cheap to copy Attachments. Feel free to store and return by value. 25 // It is cheap to copy Attachments. Feel free to store and return by value.
26 class SYNC_EXPORT Attachment { 26 class SYNC_EXPORT Attachment {
27 public: 27 public:
28 ~Attachment(); 28 ~Attachment();
29 29
30 // Default copy and assignment are welcome. 30 // Default copy and assignment are welcome.
31 31
32 // Creates an attachment with a unique id and the supplied data. 32 // Creates an attachment with a unique id and the supplied data.
33 // 33 //
34 // Used when creating a brand new attachment. 34 // Used when creating a brand new attachment.
35 static Attachment Create(const scoped_refptr<base::RefCountedMemory>& data); 35 static Attachment CreateNew(
36 const scoped_refptr<base::RefCountedMemory>& data);
36 37
37 // Creates an attachment with the supplied id and data. 38 // Creates an attachment with the supplied id and data.
38 // 39 //
39 // Used when you want to recreate a specific attachment. E.g. creating a local 40 // Used when you want to recreate a specific attachment. E.g. creating a local
40 // copy of an attachment that already exists on the sync server. 41 // copy of an attachment that already exists on the sync server.
41 static Attachment CreateWithId( 42 static Attachment RestoreExisting(
pavely 2014/11/10 23:45:29 I wanted to generalize name since it is not create
maniscalco 2014/11/11 00:44:53 I see. WDYT about CreateFromParts? Restore in th
pavely 2014/11/11 22:27:14 The reason is Restore means something is broken, d
42 const AttachmentId& id, 43 const AttachmentId& id,
43 const scoped_refptr<base::RefCountedMemory>& data); 44 const scoped_refptr<base::RefCountedMemory>& data,
45 uint32_t crc32c);
44 46
45 // Returns this attachment's id. 47 // Returns this attachment's id.
46 const AttachmentId& GetId() const; 48 const AttachmentId& GetId() const;
47 49
48 // Returns this attachment's data. 50 // Returns this attachment's data.
49 const scoped_refptr<base::RefCountedMemory>& GetData() const; 51 const scoped_refptr<base::RefCountedMemory>& GetData() const;
50 52
53 uint32_t GetCrc32c() const;
54
51 private: 55 private:
52 AttachmentId id_; 56 AttachmentId id_;
53 scoped_refptr<base::RefCountedMemory> data_; 57 scoped_refptr<base::RefCountedMemory> data_;
58 uint32_t crc32c_;
54 59
55 Attachment(const AttachmentId& id, 60 Attachment(const AttachmentId& id,
56 const scoped_refptr<base::RefCountedMemory>& data); 61 const scoped_refptr<base::RefCountedMemory>& data,
62 uint32_t crc32c);
57 }; 63 };
58 64
59 typedef std::vector<syncer::Attachment> AttachmentList; 65 typedef std::vector<syncer::Attachment> AttachmentList;
60 typedef std::map<AttachmentId, Attachment> AttachmentMap; 66 typedef std::map<AttachmentId, Attachment> AttachmentMap;
61 67
62 } // namespace syncer 68 } // namespace syncer
63 69
64 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_H_ 70 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_H_
OLDNEW
« no previous file with comments | « sync/BUILD.gn ('k') | sync/api/attachments/attachment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698