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

Side by Side Diff: components/sync/base/proto_value_ptr.h

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 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 | « components/sync/base/model_type.h ('k') | components/sync/core/activation_context.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_BASE_PROTO_VALUE_PTR_H_ 5 #ifndef COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_
6 #define COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_ 6 #define COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 10
11 namespace syncer { 11 namespace syncer_v2 {
12 struct EntityData; 12 struct EntityData;
13 class ProcessorEntityTracker; 13 class ProcessorEntityTracker;
14 } // namespace syncer 14 } // namespace syncer_v2
15 15
16 namespace syncer { 16 namespace syncer {
17 17
18 namespace syncable { 18 namespace syncable {
19 struct EntryKernel; 19 struct EntryKernel;
20 } // namespace syncable 20 } // namespace syncable
21 21
22 // Default traits struct for ProtoValuePtr - adapts a 22 // Default traits struct for ProtoValuePtr - adapts a
23 // ::google::protobuf::MessageLite derived type to be used with ProtoValuePtr. 23 // ::google::protobuf::MessageLite derived type to be used with ProtoValuePtr.
24 template <typename T> 24 template <typename T>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return wrapper_ ? wrapper_->value() : Traits::DefaultValue(); 84 return wrapper_ ? wrapper_->value() : Traits::DefaultValue();
85 } 85 }
86 86
87 const T* operator->() const { 87 const T* operator->() const {
88 const T& wrapped_instance = value(); 88 const T& wrapped_instance = value();
89 return &wrapped_instance; 89 return &wrapped_instance;
90 } 90 }
91 91
92 private: 92 private:
93 friend struct syncable::EntryKernel; 93 friend struct syncable::EntryKernel;
94 friend struct EntityData; 94 friend struct syncer_v2::EntityData;
95 friend class ProcessorEntityTracker; 95 friend class syncer_v2::ProcessorEntityTracker;
96 FRIEND_TEST_ALL_PREFIXES(ProtoValuePtrTest, ValueAssignment); 96 FRIEND_TEST_ALL_PREFIXES(ProtoValuePtrTest, ValueAssignment);
97 FRIEND_TEST_ALL_PREFIXES(ProtoValuePtrTest, ValueSwap); 97 FRIEND_TEST_ALL_PREFIXES(ProtoValuePtrTest, ValueSwap);
98 FRIEND_TEST_ALL_PREFIXES(ProtoValuePtrTest, SharingTest); 98 FRIEND_TEST_ALL_PREFIXES(ProtoValuePtrTest, SharingTest);
99 FRIEND_TEST_ALL_PREFIXES(ProtoValuePtrTest, ParsingTest); 99 FRIEND_TEST_ALL_PREFIXES(ProtoValuePtrTest, ParsingTest);
100 100
101 // set the value to copy of |new_value|. 101 // set the value to copy of |new_value|.
102 void set_value(const T& new_value) { 102 void set_value(const T& new_value) {
103 if (Traits::HasValue(new_value)) { 103 if (Traits::HasValue(new_value)) {
104 wrapper_ = new Wrapper(new_value); 104 wrapper_ = new Wrapper(new_value);
105 } else { 105 } else {
(...skipping 17 matching lines...) Expand all
123 void load(const void* blob, int length) { 123 void load(const void* blob, int length) {
124 wrapper_ = Wrapper::ParseFromBlob(blob, length); 124 wrapper_ = Wrapper::ParseFromBlob(blob, length);
125 } 125 }
126 126
127 scoped_refptr<Wrapper> wrapper_; 127 scoped_refptr<Wrapper> wrapper_;
128 }; 128 };
129 129
130 } // namespace syncer 130 } // namespace syncer
131 131
132 #endif // COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_ 132 #endif // COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_
OLDNEW
« no previous file with comments | « components/sync/base/model_type.h ('k') | components/sync/core/activation_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698