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

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

Issue 995683002: Revert of [Sync] Add size and crc32c to AttachmentId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 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 16 matching lines...) Expand all
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 Create(const scoped_refptr<base::RefCountedMemory>& data);
36 36
37 // Creates an attachment with the supplied id and data. 37 // Creates an attachment with the supplied id, data and crc32c.
38 // 38 //
39 // Used when you want to recreate a specific attachment. E.g. creating a local 39 // 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. 40 // copy of an attachment that already exists on the sync server.
41 static Attachment CreateFromParts( 41 static Attachment CreateFromParts(
42 const AttachmentId& id, 42 const AttachmentId& id,
43 const scoped_refptr<base::RefCountedMemory>& data); 43 const scoped_refptr<base::RefCountedMemory>& data,
44 uint32_t crc32c);
44 45
45 // Returns this attachment's id. 46 // Returns this attachment's id.
46 const AttachmentId& GetId() const; 47 const AttachmentId& GetId() const;
47 48
48 // Returns this attachment's data. 49 // Returns this attachment's data.
49 const scoped_refptr<base::RefCountedMemory>& GetData() const; 50 const scoped_refptr<base::RefCountedMemory>& GetData() const;
50 51
51 // Returns precomputed crc32c hash of data. In ideal case this hash is 52 // Returns precomputed crc32c hash of data. In ideal case this hash is
52 // computed when attachment is first created. It is then passed around through 53 // computed when attachment is first created. It is then passed around through
53 // local attachment store and attachment server. Crc is verified when 54 // local attachment store and attachment server. Crc is verified when
54 // attachment is downloaded from server or loaded from local storage. 55 // attachment is downloaded from server or loaded from local storage.
55 uint32_t GetCrc32c() const; 56 uint32_t GetCrc32c() const;
56 57
57 private: 58 private:
58 AttachmentId id_; 59 AttachmentId id_;
59 scoped_refptr<base::RefCountedMemory> data_; 60 scoped_refptr<base::RefCountedMemory> data_;
61 uint32_t crc32c_;
60 62
61 Attachment(const AttachmentId& id, 63 Attachment(const AttachmentId& id,
62 const scoped_refptr<base::RefCountedMemory>& data); 64 const scoped_refptr<base::RefCountedMemory>& data,
65 uint32_t crc32c);
63 }; 66 };
64 67
65 typedef std::vector<syncer::Attachment> AttachmentList; 68 typedef std::vector<syncer::Attachment> AttachmentList;
66 typedef std::map<AttachmentId, Attachment> AttachmentMap; 69 typedef std::map<AttachmentId, Attachment> AttachmentMap;
67 70
68 } // namespace syncer 71 } // namespace syncer
69 72
70 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_H_ 73 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_H_
OLDNEW
« no previous file with comments | « components/sync_driver/generic_change_processor_unittest.cc ('k') | sync/api/attachments/attachment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698