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

Unified Diff: chrome/browser/sync/api/sync_data.h

Issue 7904021: [Sync] Rework SharedValue<T> into Immutable<T> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename vars Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/api/sync_data.h
diff --git a/chrome/browser/sync/api/sync_data.h b/chrome/browser/sync/api/sync_data.h
index 7656de89d3f6750d4a2429e381b584834dfbc750..4b1302dec5e98f0af3f0c59377d3ac7d074f0e91 100644
--- a/chrome/browser/sync/api/sync_data.h
+++ b/chrome/browser/sync/api/sync_data.h
@@ -10,13 +10,13 @@
#include <vector>
#include "base/memory/ref_counted.h"
Nicolas Zea 2011/09/15 23:39:46 can we get rid of this now?
akalin 2011/09/16 00:59:59 Done.
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/sync/syncable/model_type.h"
+#include "chrome/browser/sync/util/immutable.h"
namespace sync_pb {
class EntitySpecifics;
class SyncEntity;
-}
+} // namespace sync_pb
typedef syncable::ModelType SyncDataType;
@@ -77,30 +77,37 @@ class SyncData {
// TODO(zea): Query methods for other sync properties: parent, successor, etc.
private:
- // A reference counted immutable SyncEntity.
- class SharedSyncEntity : public
- base::RefCountedThreadSafe<SharedSyncEntity> {
- public:
- // Takes ownership of |sync_entity|'s contents.
- explicit SharedSyncEntity(sync_pb::SyncEntity* sync_entity);
+ // Necessary since we forward-declare sync_pb::SyncEntity; see
+ // comments in immutable.h.
+ struct ImmutableSyncEntityTraits {
+ typedef sync_pb::SyncEntity* Container;
- // Returns immutable reference to local sync entity.
- const sync_pb::SyncEntity& sync_entity() const;
+ static void CreateAndDefaultInitialize(Container* container);
- private:
- friend class base::RefCountedThreadSafe<SharedSyncEntity>;
+ static void Destroy(Container* container);
- // Private due to ref counting.
- ~SharedSyncEntity();
+ static const sync_pb::SyncEntity& Unwrap(const Container& container);
- scoped_ptr<sync_pb::SyncEntity> sync_entity_;
+ static sync_pb::SyncEntity* UnwrapMutable(Container* container);
+
+ static void Swap(sync_pb::SyncEntity* t1, sync_pb::SyncEntity* t2);
};
- // The actual shared sync entity being held.
- scoped_refptr<SharedSyncEntity> shared_entity_;
+ typedef browser_sync::Immutable<
+ sync_pb::SyncEntity, ImmutableSyncEntityTraits>
+ ImmutableSyncEntity;
+
+ // Clears |entity|.
+ SyncData(sync_pb::SyncEntity* entity, bool is_local);
+
+ // Whether this SyncData holds valid data.
+ bool is_valid_;
// Whether this data originated locally or from the syncer (remote data).
bool is_local_;
+
+ // The actual shared sync entity being held.
+ ImmutableSyncEntity immutable_entity_;
};
#endif // CHROME_BROWSER_SYNC_API_SYNC_DATA_H_

Powered by Google App Engine
This is Rietveld 408576698