summaryrefslogtreecommitdiffstats
path: root/components/sync_driver/generic_change_processor.cc
diff options
context:
space:
mode:
authorErik Arvidsson <arv@chromium.org>2014-09-05 13:10:48 -0400
committerErik Arvidsson <arv@chromium.org>2014-09-05 17:12:34 +0000
commite4c008c95e47155ad924d04f697cdf7272049a7d (patch)
tree8afd17f0de1b139e44611a048b75c4d470063864 /components/sync_driver/generic_change_processor.cc
parent8816ae54afab2da619a7ee23a50b90869b4b2a90 (diff)
downloadchromium_src-e4c008c95e47155ad924d04f697cdf7272049a7d.zip
chromium_src-e4c008c95e47155ad924d04f697cdf7272049a7d.tar.gz
chromium_src-e4c008c95e47155ad924d04f697cdf7272049a7d.tar.bz2
Revert "Replace AttachmentStore's StoreAttachments with UploadAttachments."
This reverts commit 5dde06853d1d5020796184c5fc749b9730ce8f07. Broke a bunch of builds: FAILED: /mnt/data/b/build/goma/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/sync/internal_api/attachments/sync_core.attachment_service_proxy.o.d -DSYNC_IMPLEMENTATION -DCHROMIUM_BUILD -DENABLE_NOTIFICATIONS -DENABLE_EGLIMAGE=1 -DENABLE_BACKGROUND=1 -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 -DENABLE_MDNS=1 -DENABLE_PEPPER_CDMS -DENABLE_PLUGINS=1 -DENABLE_PRINTING=1 -DENABLE_FULL_PRINTING=1 -DENABLE_SPELLCHECK=1 -DUSE_UDEV -DTOOLKIT_VIEWS=1 -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_ASH=1 -DUSE_AURA=1 -DUSE_CAIRO=1 -DUSE_CLIPBOARD_AURAX11=1 -DUSE_DEFAULT_RENDER_THEME=1 -DUSE_GLIB=1 -DUSE_NSS=1 -DUSE_X11=1 -DUSE_XI2_MT=2 -DDISABLE_NACL -DENABLE_EXTENSIONS=1 -DENABLE_CONFIGURATION_POLICY -DENABLE_TASK_MANAGER=1 -DENABLE_THEMES=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_MANAGED_USERS=1 -DENABLE_SERVICE_DISCOVERY=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_REMOTING=1 -DENABLE_GOOGLE_NOW=1 -DENABLE_ONE_CLICK_SIGNIN -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DPROTOBUF_USE_DLLS -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -I../.. -Igen -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I../../net/third_party/nss/ssl -I/usr/include/nss -I/usr/include/nspr -I../../third_party/zlib -Igen/protoc_out -I../../third_party/protobuf/src -I../../third_party/protobuf -fno-strict-aliasing -fstack-protector --param=ssp-buffer-size=4 -m64 -funwind-tables -fPIC -pipe -pthread -fcolor-diagnostics -Wall -Wsign-compare -Wendif-labels -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-char-subscripts -Wno-covered-switch-default -Wno-deprecated-register -Wno-unused-function -fvisibility=hidden -Xclang -load -Xclang ../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Wheader-hygiene -Wstring-conversion -fno-ident -fdata-sections -ffunction-sections -O2 -g2 -Wexit-time-destructors -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -Wno-reserved-user-defined-literal -fno-rtti -fno-exceptions -c ../../sync/internal_api/attachments/attachment_service_proxy.cc -o obj/sync/internal_api/attachments/sync_core.attachment_service_proxy.o ../../sync/internal_api/attachments/attachment_service_proxy.cc:96:3: error: invalid argument type 'scoped_refptr<base::SequencedTaskRunner>' to unary expression DCHECK(wrapped_task_runner_); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../base/logging.h:622:51: note: expanded from macro 'DCHECK' LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON && !(condition)) \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ ../../base/logging.h:355:5: note: expanded from macro 'LAZY_STREAM' !(condition) ? (void) 0 : ::logging::LogMessageVoidify() & (stream) ^ 1 error generated. ninja: build stopped: subcommand failed. BUG=none TBR=maniscalco Review URL: https://codereview.chromium.org/546873003 Cr-Commit-Position: refs/heads/master@{#293542}
Diffstat (limited to 'components/sync_driver/generic_change_processor.cc')
-rw-r--r--components/sync_driver/generic_change_processor.cc65
1 files changed, 21 insertions, 44 deletions
diff --git a/components/sync_driver/generic_change_processor.cc b/components/sync_driver/generic_change_processor.cc
index ddf6b67..c44ce72 100644
--- a/components/sync_driver/generic_change_processor.cc
+++ b/components/sync_driver/generic_change_processor.cc
@@ -85,11 +85,6 @@ syncer::SyncData BuildRemoteSyncData(
attachment_service_proxy);
}
-const syncer::AttachmentId& AttachmentToAttachmentId(
- const syncer::Attachment& attachment) {
- return attachment.GetId();
-}
-
} // namespace
GenericChangeProcessor::GenericChangeProcessor(
@@ -107,8 +102,7 @@ GenericChangeProcessor::GenericChangeProcessor(
attachment_service_weak_ptr_factory_(attachment_service_.get()),
attachment_service_proxy_(
base::MessageLoopProxy::current(),
- attachment_service_weak_ptr_factory_.GetWeakPtr()),
- weak_ptr_factory_(this) {
+ attachment_service_weak_ptr_factory_.GetWeakPtr()) {
DCHECK(CalledOnValidThread());
DCHECK(attachment_service_);
}
@@ -393,6 +387,25 @@ syncer::SyncError AttemptDelete(const syncer::SyncChange& change,
return syncer::SyncError();
}
+// A callback invoked on completion of AttachmentService::StoreAttachment.
+void IgnoreStoreResult(const syncer::AttachmentService::StoreResult&) {
+ // TODO(maniscalco): Here is where we're going to update the in-directory
+ // entry to indicate that the attachments have been successfully stored on
+ // disk. Why do we care? Because we might crash after persisting the
+ // directory to disk, but before we have persisted its attachments, leaving us
+ // with danging attachment ids. Having a flag that indicates we've stored the
+ // entry will allow us to detect and filter entries with dangling attachment
+ // ids (bug 368353).
+}
+
+void StoreAttachments(syncer::AttachmentService* attachment_service,
+ const syncer::AttachmentList& attachments) {
+ DCHECK(attachment_service);
+ syncer::AttachmentService::StoreCallback ignore_store_result =
+ base::Bind(&IgnoreStoreResult);
+ attachment_service->StoreAttachments(attachments, ignore_store_result);
+}
+
} // namespace
syncer::SyncError GenericChangeProcessor::ProcessSyncChanges(
@@ -452,7 +465,7 @@ syncer::SyncError GenericChangeProcessor::ProcessSyncChanges(
}
if (!new_attachments.empty()) {
- StoreAndUploadAttachments(new_attachments);
+ StoreAttachments(attachment_service_.get(), new_attachments);
}
return syncer::SyncError();
@@ -698,40 +711,4 @@ syncer::UserShare* GenericChangeProcessor::share_handle() const {
return share_handle_;
}
-void GenericChangeProcessor::StoreAndUploadAttachments(
- const syncer::AttachmentList& attachments) {
- DCHECK(CalledOnValidThread());
- attachment_service_->GetStore()->Write(
- attachments,
- base::Bind(&GenericChangeProcessor::WriteAttachmentsDone,
- weak_ptr_factory_.GetWeakPtr(),
- attachments));
-}
-
-void GenericChangeProcessor::WriteAttachmentsDone(
- const syncer::AttachmentList& attachments,
- const syncer::AttachmentStore::Result& result) {
- DCHECK(CalledOnValidThread());
- if (result != syncer::AttachmentStore::SUCCESS) {
- // TODO(maniscalco): Deal with case where an error occurred (bug 361251).
- return;
- }
-
- // TODO(maniscalco): Here is where we're going to update the in-directory
- // entry to indicate that the attachments have been successfully stored on
- // disk. Why do we care? Because we might crash after persisting the
- // directory to disk, but before we have persisted its attachments, leaving us
- // with danging attachment ids. Having a flag that indicates we've stored the
- // entry will allow us to detect and filter entries with dangling attachment
- // ids (bug 368353).
-
- // Begin uploading the attachments now that they are safe on disk.
- syncer::AttachmentIdSet attachment_ids;
- std::transform(attachments.begin(),
- attachments.end(),
- std::inserter(attachment_ids, attachment_ids.end()),
- AttachmentToAttachmentId);
- attachment_service_->UploadAttachments(attachment_ids);
-}
-
} // namespace sync_driver