diff options
author | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-01 01:20:14 +0000 |
---|---|---|
committer | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-01 01:20:14 +0000 |
commit | 8644dfa1f63dfc3a0d01132cd1b1287dde4b29ce (patch) | |
tree | 6061b89e755dd9481ff7f4330b3b3878efc3d844 /sync/internal_api/public | |
parent | bb8558a3ce708090430615cb69f696c096ee8ac7 (diff) | |
download | chromium_src-8644dfa1f63dfc3a0d01132cd1b1287dde4b29ce.zip chromium_src-8644dfa1f63dfc3a0d01132cd1b1287dde4b29ce.tar.gz chromium_src-8644dfa1f63dfc3a0d01132cd1b1287dde4b29ce.tar.bz2 |
sync: Buffer Protocol Events for about:sync page
Allows the about:sync page to present the last six network events as
soon as it's opened.
Adds the ProtocolEventBuffer to the SyncManagerImpl. This class holds
on to a few protocol events and returns them on demand.
Modifies the interface to enable SyncBacknedHost protocol event
forwarding. By default, it does not forward any events. There are now
separate registration and unregistration functions. The registration
function will send the set of buffered notifications to the UI thread,
and also register it to receive incoming events in the future. It
continues to forward events until the number of registration calls is
matched by the number of un-registration calls.
Makes about:sync's registration to receive events explicit. This was
a long-time TODO. If we did not fix this issue, then the about:sync
page could receive the initial set of buffered invalidations before it
had its event listeners defined and registered.
Makes the about:sync page keep track of known events and avoid adding
duplicates to the list. Since the registration of a new event listener
causes events to be distributed to all listeners, we must add this logic
to ensure that opening one new about:sync tab will not cause previously
opened tabs to display duplicate events.
BUG=329373,349301
Review URL: https://codereview.chromium.org/212603007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260726 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/public')
8 files changed, 19 insertions, 6 deletions
diff --git a/sync/internal_api/public/events/commit_request_event.h b/sync/internal_api/public/events/commit_request_event.h index cf379a9..d79b69c 100644 --- a/sync/internal_api/public/events/commit_request_event.h +++ b/sync/internal_api/public/events/commit_request_event.h @@ -10,6 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/values.h" +#include "sync/base/sync_export.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/events/protocol_event.h" #include "sync/protocol/sync.pb.h" @@ -17,7 +18,7 @@ namespace syncer { // An event representing a commit request message sent to the server. -class CommitRequestEvent : public ProtocolEvent { +class SYNC_EXPORT_PRIVATE CommitRequestEvent : public ProtocolEvent { public: CommitRequestEvent( base::Time timestamp, diff --git a/sync/internal_api/public/events/commit_response_event.h b/sync/internal_api/public/events/commit_response_event.h index e1f1797..b2330fa 100644 --- a/sync/internal_api/public/events/commit_response_event.h +++ b/sync/internal_api/public/events/commit_response_event.h @@ -10,6 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/values.h" +#include "sync/base/sync_export.h" #include "sync/internal_api/public/events/protocol_event.h" #include "sync/internal_api/public/util/syncer_error.h" #include "sync/protocol/sync.pb.h" @@ -17,7 +18,7 @@ namespace syncer { // An event representing a commit response event from the server. -class CommitResponseEvent : public ProtocolEvent { +class SYNC_EXPORT_PRIVATE CommitResponseEvent : public ProtocolEvent { public: CommitResponseEvent( base::Time timestamp, diff --git a/sync/internal_api/public/events/configure_get_updates_request_event.h b/sync/internal_api/public/events/configure_get_updates_request_event.h index eb783ab..dcec982 100644 --- a/sync/internal_api/public/events/configure_get_updates_request_event.h +++ b/sync/internal_api/public/events/configure_get_updates_request_event.h @@ -8,13 +8,15 @@ #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/values.h" +#include "sync/base/sync_export.h" #include "sync/internal_api/public/events/protocol_event.h" #include "sync/protocol/sync.pb.h" namespace syncer { // An event representing a configure GetUpdates request to the server. -class ConfigureGetUpdatesRequestEvent : public ProtocolEvent { +class SYNC_EXPORT_PRIVATE ConfigureGetUpdatesRequestEvent + : public ProtocolEvent { public: ConfigureGetUpdatesRequestEvent( base::Time timestamp, diff --git a/sync/internal_api/public/events/get_updates_response_event.h b/sync/internal_api/public/events/get_updates_response_event.h index 1d31ccc..c47fe9b 100644 --- a/sync/internal_api/public/events/get_updates_response_event.h +++ b/sync/internal_api/public/events/get_updates_response_event.h @@ -8,6 +8,7 @@ #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/values.h" +#include "sync/base/sync_export.h" #include "sync/internal_api/public/events/protocol_event.h" #include "sync/internal_api/public/util/syncer_error.h" #include "sync/protocol/sync.pb.h" @@ -18,7 +19,7 @@ namespace syncer { // // Unlike the events for the request message, the response events are generic // and do not vary for each type of GetUpdate cycle. -class GetUpdatesResponseEvent : public ProtocolEvent { +class SYNC_EXPORT_PRIVATE GetUpdatesResponseEvent : public ProtocolEvent { public: GetUpdatesResponseEvent( base::Time timestamp, diff --git a/sync/internal_api/public/events/normal_get_updates_request_event.h b/sync/internal_api/public/events/normal_get_updates_request_event.h index 7d0b874..ac3877e 100644 --- a/sync/internal_api/public/events/normal_get_updates_request_event.h +++ b/sync/internal_api/public/events/normal_get_updates_request_event.h @@ -8,6 +8,7 @@ #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/values.h" +#include "sync/base/sync_export.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/events/protocol_event.h" #include "sync/protocol/sync.pb.h" @@ -19,7 +20,7 @@ class NudgeTracker; } // namespace sessions // An event representing a 'normal mode' GetUpdate request to the server. -class NormalGetUpdatesRequestEvent : public ProtocolEvent { +class SYNC_EXPORT_PRIVATE NormalGetUpdatesRequestEvent : public ProtocolEvent { public: NormalGetUpdatesRequestEvent( base::Time timestamp, diff --git a/sync/internal_api/public/events/poll_get_updates_request_event.h b/sync/internal_api/public/events/poll_get_updates_request_event.h index d4a679c..f039c1d 100644 --- a/sync/internal_api/public/events/poll_get_updates_request_event.h +++ b/sync/internal_api/public/events/poll_get_updates_request_event.h @@ -8,6 +8,7 @@ #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/values.h" +#include "sync/base/sync_export.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/events/protocol_event.h" #include "sync/protocol/sync.pb.h" @@ -19,7 +20,7 @@ class NudgeTracker; } // namespace sessions // An event representing a poll request sent to the server. -class PollGetUpdatesRequestEvent : public ProtocolEvent { +class SYNC_EXPORT_PRIVATE PollGetUpdatesRequestEvent : public ProtocolEvent { public: PollGetUpdatesRequestEvent( base::Time timestamp, diff --git a/sync/internal_api/public/sync_manager.h b/sync/internal_api/public/sync_manager.h index 38bad07..db1e188 100644 --- a/sync/internal_api/public/sync_manager.h +++ b/sync/internal_api/public/sync_manager.h @@ -12,6 +12,7 @@ #include "base/callback_forward.h" #include "base/files/file_path.h" #include "base/memory/ref_counted.h" +#include "base/memory/scoped_vector.h" #include "base/task_runner.h" #include "base/threading/thread_checker.h" #include "sync/base/sync_export.h" @@ -353,6 +354,9 @@ class SYNC_EXPORT SyncManager : public syncer::InvalidationHandler { // Ask the SyncManager to fetch updates for the given types. virtual void RefreshTypes(ModelTypeSet types) = 0; + + // Returns any buffered protocol events. Does not clear the buffer. + virtual ScopedVector<syncer::ProtocolEvent> GetBufferedProtocolEvents() = 0; }; } // namespace syncer diff --git a/sync/internal_api/public/test/fake_sync_manager.h b/sync/internal_api/public/test/fake_sync_manager.h index 81b7160..655caef 100644 --- a/sync/internal_api/public/test/fake_sync_manager.h +++ b/sync/internal_api/public/test/fake_sync_manager.h @@ -124,6 +124,8 @@ class FakeSyncManager : public SyncManager { virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; virtual bool HasUnsyncedItems() OVERRIDE; virtual SyncEncryptionHandler* GetEncryptionHandler() OVERRIDE; + virtual ScopedVector<syncer::ProtocolEvent> + GetBufferedProtocolEvents() OVERRIDE; virtual void RefreshTypes(ModelTypeSet types) OVERRIDE; private: |