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

Side by Side Diff: sync/api/attachments/attachment_id.cc

Issue 982883002: [Sync] Add size and crc32c to AttachmentId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with master. 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
« no previous file with comments | « sync/api/attachments/attachment_id.h ('k') | sync/api/attachments/attachment_id_unittest.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 #include "sync/api/attachments/attachment_id.h" 5 #include "sync/api/attachments/attachment_id.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "sync/internal_api/public/base/attachment_id_proto.h" 8 #include "sync/internal_api/public/base/attachment_id_proto.h"
9 #include "sync/protocol/sync.pb.h" 9 #include "sync/protocol/sync.pb.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 bool AttachmentId::operator!=(const AttachmentId& other) const { 46 bool AttachmentId::operator!=(const AttachmentId& other) const {
47 return !operator==(other); 47 return !operator==(other);
48 } 48 }
49 49
50 bool AttachmentId::operator<(const AttachmentId& other) const { 50 bool AttachmentId::operator<(const AttachmentId& other) const {
51 return proto_.Get().unique_id() < other.proto_.Get().unique_id(); 51 return proto_.Get().unique_id() < other.proto_.Get().unique_id();
52 } 52 }
53 53
54 // Static. 54 // Static.
55 AttachmentId AttachmentId::Create() { 55 AttachmentId AttachmentId::Create(size_t size, uint32_t crc32c) {
56 sync_pb::AttachmentIdProto proto = CreateAttachmentIdProto(); 56 sync_pb::AttachmentIdProto proto = CreateAttachmentIdProto(size, crc32c);
57 return AttachmentId(&proto); 57 return AttachmentId(&proto);
58 } 58 }
59 59
60 // Static. 60 // Static.
61 AttachmentId AttachmentId::CreateFromProto( 61 AttachmentId AttachmentId::CreateFromProto(
62 const sync_pb::AttachmentIdProto& proto) { 62 const sync_pb::AttachmentIdProto& proto) {
63 sync_pb::AttachmentIdProto copy_of_proto(proto); 63 sync_pb::AttachmentIdProto copy_of_proto(proto);
64 return AttachmentId(&copy_of_proto); 64 return AttachmentId(&copy_of_proto);
65 } 65 }
66 66
67 const sync_pb::AttachmentIdProto& AttachmentId::GetProto() const { 67 const sync_pb::AttachmentIdProto& AttachmentId::GetProto() const {
68 return proto_.Get(); 68 return proto_.Get();
69 } 69 }
70 70
71 AttachmentId::AttachmentId(sync_pb::AttachmentIdProto* proto) 71 AttachmentId::AttachmentId(sync_pb::AttachmentIdProto* proto)
72 : proto_(proto) {} 72 : proto_(proto) {}
73 73
74 size_t AttachmentId::GetSize() const {
75 return proto_.Get().size_bytes();
76 }
77
78 uint32_t AttachmentId::GetCrc32c() const {
79 return proto_.Get().crc32c();
80 }
81
74 } // namespace syncer 82 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/api/attachments/attachment_id.h ('k') | sync/api/attachments/attachment_id_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698