Index: sync/api/sync_data.cc |
diff --git a/sync/api/sync_data.cc b/sync/api/sync_data.cc |
index 5d849412273f74967c627fa2ce58781ee9201ca5..87b2b264d6053995e72555f22adb1a3e84802424 100644 |
--- a/sync/api/sync_data.cc |
+++ b/sync/api/sync_data.cc |
@@ -65,17 +65,20 @@ void SyncData::ImmutableSyncEntityTraits::Swap(sync_pb::SyncEntity* t1, |
SyncData::SyncData() : id_(kInvalidId), is_valid_(false) {} |
-SyncData::SyncData(int64 id, |
- sync_pb::SyncEntity* entity, |
- AttachmentList* attachments, |
- const base::Time& remote_modification_time, |
- const syncer::AttachmentServiceProxy& attachment_service) |
+SyncData::SyncData( |
+ int64 id, |
+ sync_pb::SyncEntity* entity, |
+ AttachmentList* attachments, |
+ const base::Time& remote_modification_time, |
+ const scoped_refptr<syncer::AttachmentServiceProxy>& attachment_service) |
: id_(id), |
remote_modification_time_(remote_modification_time), |
immutable_entity_(entity), |
attachments_(attachments), |
attachment_service_(attachment_service), |
- is_valid_(true) {} |
+ is_valid_(true) { |
+ DCHECK(attachment_service_); |
+} |
SyncData::~SyncData() {} |
@@ -117,11 +120,9 @@ SyncData SyncData::CreateLocalDataWithAttachments( |
// available to the AttachmentService once this SyncData gets passed into |
// GenericChangeProcesso::ProcessSyncChanges (bug 354530). |
AttachmentList copy_of_attachments(attachments); |
- return SyncData(kInvalidId, |
- &entity, |
- ©_of_attachments, |
- base::Time(), |
- AttachmentServiceProxy()); |
+ scoped_refptr<AttachmentServiceProxy> proxy(new AttachmentServiceProxy); |
+ return SyncData( |
+ kInvalidId, &entity, ©_of_attachments, base::Time(), proxy); |
} |
// Static. |
@@ -130,7 +131,7 @@ SyncData SyncData::CreateRemoteData( |
const sync_pb::EntitySpecifics& specifics, |
const base::Time& modification_time, |
const AttachmentIdList& attachment_ids, |
- const AttachmentServiceProxy& attachment_service) { |
+ const scoped_refptr<AttachmentServiceProxy>& attachment_service) { |
DCHECK_NE(id, kInvalidId); |
sync_pb::SyncEntity entity; |
entity.mutable_specifics()->CopyFrom(specifics); |
@@ -143,17 +144,6 @@ SyncData SyncData::CreateRemoteData( |
id, &entity, &attachments, modification_time, attachment_service); |
} |
-// Static. |
-SyncData SyncData::CreateRemoteData(int64 id, |
- const sync_pb::EntitySpecifics& specifics, |
- const base::Time& modification_time) { |
- return CreateRemoteData(id, |
- specifics, |
- modification_time, |
- AttachmentIdList(), |
- AttachmentServiceProxy()); |
-} |
- |
bool SyncData::IsValid() const { return is_valid_; } |
const sync_pb::EntitySpecifics& SyncData::GetSpecifics() const { |
@@ -242,13 +232,13 @@ int64 SyncDataRemote::GetId() const { |
void SyncDataRemote::GetOrDownloadAttachments( |
const AttachmentIdList& attachment_ids, |
const AttachmentService::GetOrDownloadCallback& callback) { |
- attachment_service_.GetOrDownloadAttachments(attachment_ids, callback); |
+ attachment_service_->GetOrDownloadAttachments(attachment_ids, callback); |
} |
void SyncDataRemote::DropAttachments( |
const AttachmentIdList& attachment_ids, |
const AttachmentService::DropCallback& callback) { |
- attachment_service_.DropAttachments(attachment_ids, callback); |
+ attachment_service_->DropAttachments(attachment_ids, callback); |
} |
} // namespace syncer |