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

Unified Diff: chrome/browser/sync/glue/sync_backend_host_core.cc

Issue 212603007: sync: Buffer Protocol Events for about:sync page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/sync_backend_host_core.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host_core.cc b/chrome/browser/sync/glue/sync_backend_host_core.cc
index c433b0b3df96046427e6e0d2d94c0245df866300..c49171a5404e2cd338542e4baeccd17a86f193af 100644
--- a/chrome/browser/sync/glue/sync_backend_host_core.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_core.cc
@@ -104,6 +104,7 @@ SyncBackendHostCore::SyncBackendHostCore(
sync_loop_(NULL),
registrar_(NULL),
has_sync_setup_completed_(has_sync_setup_completed),
+ forward_protocol_events_(false),
weak_ptr_factory_(this) {
DCHECK(backend.get());
}
@@ -605,9 +606,30 @@ void SyncBackendHostCore::DoRetryConfiguration(
retry_callback);
}
-void SyncBackendHostCore::SetForwardProtocolEvents(bool enabled) {
+void SyncBackendHostCore::SendBufferedProtocolEventsAndEnableForwarding() {
DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
- forward_protocol_events_ = enabled;
+ forward_protocol_events_ = true;
+
+ if (sync_manager_) {
+ // Grab our own copy of the buffered events.
+ // The buffer is not modified by this operation.
+ std::vector<syncer::ProtocolEvent*> buffered_events;
+ sync_manager_->GetBufferedProtocolEvents().release(&buffered_events);
+
+ // Send them all over the fence to the host.
+ for (std::vector<syncer::ProtocolEvent*>::iterator it =
+ buffered_events.begin(); it != buffered_events.end(); ++it) {
+ // TODO(rlarocque): Make it explicit that host_ takes ownership.
+ host_.Call(
+ FROM_HERE,
+ &SyncBackendHostImpl::HandleProtocolEventOnFrontendLoop,
+ *it);
+ }
+ }
+}
+
+void SyncBackendHostCore::DisableProtocolEventForwarding() {
+ forward_protocol_events_ = false;
}
void SyncBackendHostCore::DeleteSyncDataFolder() {
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_core.h ('k') | chrome/browser/sync/glue/sync_backend_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698