summaryrefslogtreecommitdiffstats
path: root/sync/sessions
Commit message (Collapse)AuthorAgeFilesLines
* Sync commit errors should temporarily re-enablegangwu2015-02-117-18/+54
| | | | | | | | | | | | | | | | | | | trigger pre-commit getupdates Add a boolean variable in class DataTypeTracker, so every time when a data type got conflict response from server during commit, will set that boolean variable to true, then next time sync, GetUpdate will check the boolean to see if need to GetUpdate to resolve conflict locally. BUG=324893 Committed: https://crrev.com/21f43c5af27e24c34565df26bb51fcc704c97597 Cr-Commit-Position: refs/heads/master@{#315339} Review URL: https://codereview.chromium.org/905853002 Cr-Commit-Position: refs/heads/master@{#315828}
* Revert of Sync commit errors should temporarily re-enable trigger pre-commit ↵rch2015-02-097-54/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getupdates (patchset #2 id:20001 of https://codereview.chromium.org/905853002/) Reason for revert: Looks like this broke the build Undefined symbols for architecture armv7: "syncer::sessions::test_util::SimulateDownloadUpdatesFailed(syncer::EnumSet<syncer::ModelType, (syncer::ModelType)2, (syncer::ModelType)33>, syncer::sessions::NudgeTracker const&, syncer::sessions::SyncSession*)", referenced from: syncer::BackoffTriggersSyncSchedulerTest_FailDownloadOnceThenSucceed_Test::TestBody() in sync_scheduler_unittest.o syncer::BackoffTriggersSyncSchedulerTest_FailDownloadTwice_Test::TestBody() in sync_scheduler_unittest.o syncer::SyncSchedulerTest_FailedRetry_Test::TestBody() in sync_scheduler_unittest.o Original issue's description: > Sync commit errors should temporarily re-enable > trigger pre-commit getupdates > > Add a boolean variable in class DataTypeTracker, so every > time when a data type got conflict response from server > during commit, will set that boolean variable to true, then > next time sync, GetUpdate will check the boolean to see if > need to GetUpdate to resolve conflict locally. > > BUG=324893 > > Committed: https://crrev.com/21f43c5af27e24c34565df26bb51fcc704c97597 > Cr-Commit-Position: refs/heads/master@{#315339} TBR=zea@chromium.org,stanisc@chromium.org,maniscalco@chromium.org,pvalenzuela@chromium.org,gangwu@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=324893 Review URL: https://codereview.chromium.org/891123003 Cr-Commit-Position: refs/heads/master@{#315346}
* Sync commit errors should temporarily re-enablegangwu2015-02-097-18/+54
| | | | | | | | | | | | | | | | trigger pre-commit getupdates Add a boolean variable in class DataTypeTracker, so every time when a data type got conflict response from server during commit, will set that boolean variable to true, then next time sync, GetUpdate will check the boolean to see if need to GetUpdate to resolve conflict locally. BUG=324893 Review URL: https://codereview.chromium.org/905853002 Cr-Commit-Position: refs/heads/master@{#315339}
* sync: Remove unused private fieldshashimoto2015-01-092-9/+0
| | | | | | | | | | To avoid having a lot of -Wunused-private-field warnings when using "=delete" to implement DISALLOW_COPY_AND_ASSIGN. BUG=447445 Review URL: https://codereview.chromium.org/824893004 Cr-Commit-Position: refs/heads/master@{#310766}
* Standardize usage of virtual/override/final specifiers in sync/.dcheng2014-12-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Google C++ style guide states: Explicitly annotate overrides of virtual functions or virtual destructors with an override or (less frequently) final specifier. Older (pre-C++11) code will use the virtual keyword as an inferior alternative annotation. For clarity, use exactly one of override, final, or virtual when declaring an override. To better conform to these guidelines, the following constructs have been rewritten: - if a base class has a virtual destructor, then: virtual ~Foo(); -> ~Foo() override; - virtual void Foo() override; -> void Foo() override; - virtual void Foo() override final; -> void Foo() final; This patch was automatically generated. The clang plugin can generate fixit hints, which are suggested edits when it is 100% sure it knows how to fix a problem. The hints from the clang plugin were applied to the source tree using the tool in https://codereview.chromium.org/598073004. Several formatting edits by clang-format were manually reverted, due to mangling of some of the more complicate IPC macros. BUG=417463 Review URL: https://codereview.chromium.org/792343004 Cr-Commit-Position: refs/heads/master@{#309474}
* ObserverList::HasObserver now takes a const pointer.mgiuca2014-11-102-2/+2
| | | | | | | | | | | | | Updated all clients that wrap HasObserver and expose it to also take a const pointer. This change avoids further propagation of non-constness (which was previously required when using HasObserver methods). BUG=429588 TBR=michaeln@chromium.org,nyquist@chromium.org,pkotwicz@chromium.org,satorux@chromium.org,sky@chromium.org,zea@chromium.org Review URL: https://codereview.chromium.org/697953002 Cr-Commit-Position: refs/heads/master@{#303428}
* Standardize usage of virtual/override/final in sync/dcheng2014-10-212-24/+21
| | | | | | | | | | | | This patch was automatically generated by applying clang fixit hints generated by the plugin to the source tree. BUG=417463 TBR=maniscalco@chromium.org Review URL: https://codereview.chromium.org/642023004 Cr-Commit-Position: refs/heads/master@{#300499}
* Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>.dcheng2014-10-161-8/+4
| | | | | | | | BUG=423621 Review URL: https://codereview.chromium.org/657783002 Cr-Commit-Position: refs/heads/master@{#299978}
* replace OVERRIDE and FINAL with override and final in sync/mostynb2014-10-063-14/+14
| | | | | | | | BUG=417463 Review URL: https://codereview.chromium.org/629733002 Cr-Commit-Position: refs/heads/master@{#298300}
* [Sync] Add support for server controlled nudge delayszea@chromium.org2014-08-227-16/+208
| | | | | | | | | | | | | | | Server nudge delays override the local ones, but must be longer than the default nudge delay. If set to 0, will reset the nudge to the default. To accomplish this the delay logic was refactored and moved into the sync scheduler, which is now aware of all delays for all types and sync cycles. BUG=401600 Review URL: https://codereview.chromium.org/488843002 Cr-Commit-Position: refs/heads/master@{#291512} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291512 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Finish non-blocking type encryption supportrlarocque@chromium.org2014-08-162-7/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Undoes some previous work towards encryption support. That approach suffered from some subtle deadlock issues that could not be easily worked around. The new approach involves less sharing and less locks. Gives the ModelTypeSyncWorker its own copy of the Cryptographer. By passing around copies, it no longer needs to worry about acquiring locks in order to access the Directory's cryptographer. This required a rewrite of some changes to the way the ModelTypeSyncWorker detects the current encryption state. Most notably, its Cryptographer is NULL if encryption is not enabled for its model type. Makes the ModelTypeSyncRegistry responsible for observing changes emitted by the SyncEncryptionHandler and forwarding them to the ModelTypeSyncWorkers. It should receive callbacks from the SyncEncryptionHandler during startup, so it does not need to cache or query any new data. Removes the CryptographerProviders. Since the ModelTypeSyncWorker no longer need to access the directory's cryptographer, it's no longer necessary. BUG=351005 Review URL: https://codereview.chromium.org/452283003 Cr-Commit-Position: refs/heads/master@{#290067} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290067 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Attempt to fix sync scheduler test flakinessrlarocque@chromium.org2014-08-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Increases the delay duration in several sync scheduler unit tests. According to [1], the timer resolution on Windows may be under 1ms. We suspect the low timer resolution compbined with very short delays could cause problems in some unit tests. This will make the tests slower, but hopefully it will make them more reliable, too. Changes a timestmap comparison in nudge_tracker.cc from < to <=. We suspect that a lower timer resolution might allow two Time::Now() calls that should be separated by a >1ms gap of time might still return the same value in both calls. If this did happen, it could be the cause of misbehaving unit tests. It is believed that these issues only affect tests. The delay lengths used in the real world should be much longer than 1ms. The timer resolution should not be an issue for delays of that length. [1] http://www.chromium.org/developers/design-documents/threading BUG=402212 Review URL: https://codereview.chromium.org/463563005 Cr-Commit-Position: refs/heads/master@{#289731} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289731 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add non-blocking type encryption (retry)rlarocque@chromium.org2014-08-063-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes some memory leak issues that were present in the first instance of this CL. Original description follows: Introduces the framework for dealing with sync encryption in non-blocking types. Unlike directory sync types, non-blocking type encryption only encrypts data before it is sent to the server. Encrypting the data on-disk is a separate problem. Adds code to the ModelTypeSyncWorker so it can access the directory's cryptographer (through a CryptographerProvider interface) and use it to encrypt entities before it sends them to the server. If the cryptographer is unable to encrypt with the desired key, the worker will not commit until the cryptographer returns to a good state. Adds the concept of a "desired encryption key" to the data type state. When the cryptographer key to be used to encrypt a type changes, this will be reflected in the data type state. The ModelTypeSyncProxy is responsible for ensuring that all items which have not yet been encrypted with this desired key are enqueued for commit. Makes the ModelTypeSyncWorker, EntityTracker, and ModelTypeSyncProxy collaborate on the management of undecryptable (inapplicable) updates. The EntityTracker keeps track of their version numbers and content, and prevents the committing of new items to the server until the inapplicable update has been dealt with. The ModelTypeSyncProxy is responsible for saving inapplicable updates across restarts. This CL alone is not enough to enable encryption support for non-blocking types. It requires additional code to hook up the ModelTypeSyncWorkers to receive cryptographer events. This will be added in a future commit. In the meantime, this CL includes plenty of unit tests to verify the functionality that's being added. BUG=351005 Review URL: https://codereview.chromium.org/442053002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287849 0039d316-1c4b-4281-b951-d872f2087c98
* Revert of sync: Add non-blocking type encryption support ↵thestig@chromium.org2014-08-053-28/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/423193002/) Reason for revert: Both LSAN and Valgrind complains about leaks in the tests. Original issue's description: > sync: Add non-blocking type encryption support > > Introduces the framework for dealing with sync encryption in > non-blocking types. Unlike directory sync types, non-blocking type > encryption only encrypts data before it is sent to the server. > Encrypting the data on-disk is a separate problem. > > Adds code to the ModelTypeSyncWorker so it can access the directory's > cryptographer (through a CryptographerProvider interface) and use it to > encrypt entities before it sends them to the server. If the > cryptographer is unable to encrypt with the desired key, the worker will > not commit until the cryptographer returns to a good state. > > Adds the concept of a "desired encryption key" to the data type state. > When the cryptographer key to be used to encrypt a type changes, this > will be reflected in the data type state. The ModelTypeSyncProxy is > responsible for ensuring that all items which have not yet been > encrypted with this desired key are enqueued for commit. > > Makes the ModelTypeSyncWorker, EntityTracker, and ModelTypeSyncProxy > collaborate on the management of undecryptable (inapplicable) updates. > The EntityTracker keeps track of their version numbers and content, and > prevents the committing of new items to the server until the > inapplicable update has been dealt with. The ModelTypeSyncProxy is > responsible for saving inapplicable updates across restarts. > > This CL alone is not enough to enable encryption support for > non-blocking types. It requires additional code to hook up the > ModelTypeSyncWorkers to receive cryptographer events. This will be > added in a future commit. In the meantime, this CL includes plenty > of unit tests to verify the functionality that's being added. > > BUG=351005 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=287428 TBR=zea@chromium.org,stanisc@chromium.org,rlarocque@chromium.org NOTREECHECKS=true NOTRY=true BUG=351005 Review URL: https://codereview.chromium.org/442623002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287433 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add non-blocking type encryption supportrlarocque@chromium.org2014-08-053-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces the framework for dealing with sync encryption in non-blocking types. Unlike directory sync types, non-blocking type encryption only encrypts data before it is sent to the server. Encrypting the data on-disk is a separate problem. Adds code to the ModelTypeSyncWorker so it can access the directory's cryptographer (through a CryptographerProvider interface) and use it to encrypt entities before it sends them to the server. If the cryptographer is unable to encrypt with the desired key, the worker will not commit until the cryptographer returns to a good state. Adds the concept of a "desired encryption key" to the data type state. When the cryptographer key to be used to encrypt a type changes, this will be reflected in the data type state. The ModelTypeSyncProxy is responsible for ensuring that all items which have not yet been encrypted with this desired key are enqueued for commit. Makes the ModelTypeSyncWorker, EntityTracker, and ModelTypeSyncProxy collaborate on the management of undecryptable (inapplicable) updates. The EntityTracker keeps track of their version numbers and content, and prevents the committing of new items to the server until the inapplicable update has been dealt with. The ModelTypeSyncProxy is responsible for saving inapplicable updates across restarts. This CL alone is not enough to enable encryption support for non-blocking types. It requires additional code to hook up the ModelTypeSyncWorkers to receive cryptographer events. This will be added in a future commit. In the meantime, this CL includes plenty of unit tests to verify the functionality that's being added. BUG=351005 Review URL: https://codereview.chromium.org/423193002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287428 0039d316-1c4b-4281-b951-d872f2087c98
* Move non_blocking_sync_common.h to internal_apirlarocque@chromium.org2014-07-281-1/+1
| | | | | | | | | | | | | | | | | | This CL belongs to a series that implements encryption for non-blocking types. It's been split off because it contains a lot of trivial changes that would make reviewing the meaningful changes more difficult. The move is required because the next CL will add an 'UpdateResponseList' parameter to SyncContextProxy::ConnectTypeToSync(). The UpdateResponseList is a typedef, and therefore difficult to forward-declare in the same way as the InitialDataTypeContext. R=zea BUG=351005 Review URL: https://codereview.chromium.org/428643003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285988 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Support non-blocking initial sync in protorlarocque@chromium.org2014-07-185-2/+75
| | | | | | | | | | | | | | | | | | | | | Adds support for non-blocking initial sync to the sync protocol. This allows some types to request an initial sync without having the scheduler enter configure mode. The protocol changes are necessary to keep the server informed that the request is due to an initial sync request. The remainder of the changes in this CL were required to plumb information about the cause of the sync cycle through the SyncScheduler. This CL also includes some new tests. At the moment, there are no types in use that support this feature. This CL will not affect behavior in any way. BUG=351005 Review URL: https://codereview.chromium.org/387983004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284159 0039d316-1c4b-4281-b951-d872f2087c98
* Remove most remaining sync/notifier dependenciesrlarocque@chromium.org2014-07-104-7/+1
| | | | | | | | | | | | | | | Removes most remaining dependencies from core sync/ files on sync/notifier/. There are some internal_api/public files that still reference sync/notifier. These will be dealt with after sync/notifer/ has been moved to components/invalidation/. BUG=259559 Review URL: https://codereview.chromium.org/377413003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282458 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Support nudges from non-blocking sync typesrlarocque@chromium.org2014-07-103-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | Implements support for receiving nudges from the non-blocking sync engine. When a non-blocking sync type requests a commit, it will also send a request to the sync scheduler asking it to schedule a sync cycle for some time in the future. Adds some of the code required to support refresh requests, but does not include an interface to allow clients of the non-blocking sync API to access it. Adds basic support for the initial download nudge. When a non-blocking type starts syncing for the first time, it sends a request to the scheduler asking it to download any data available on the server. This allows it to complete initial sync quickly and without putting the scheduler into configure mode. For now, this looks like a refresh request in the sync protocol. This will be changed in a future CL. BUG=351005 Review URL: https://codereview.chromium.org/375023002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282439 0039d316-1c4b-4281-b951-d872f2087c98
* Replace MessageLoopProxy with ThreadTaskRunnerHandle in src/sync/.maniscalco@chromium.org2014-07-092-5/+9
| | | | | | | | | | MessageLoopProxy is deprecated. BUG=391045 Review URL: https://codereview.chromium.org/375403002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282129 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Inject sync/'s dependency on invalidationsrlarocque@chromium.org2014-07-085-306/+225
| | | | | | | | | | | | | | | | | | | | | | | | | Defines an InvalidationInterface class and uses it to break any direct dependencies from sync code on syncer::Invalidation. Despite its name, syncer::Invalidation should belong solely to the invalidations component, which code in the sync/ directory should not depend on. Changes the interface in the sync engine from copying syncer::Invalidation to managing scoped_ptr<InvalidationInterface>. This change in memory management was required to support the use of an abstract interface. Removes the DroppedInvaldiationTracker. This class was previously only used by sync. The small benefit provided by this class is outweighed by the amount of glue code it would take to maintain it. Changes tests to conform to the new interface. Adds some test-only implementations of InvalidationInterface and some associated classes. BUG=259559 Review URL: https://codereview.chromium.org/322333004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281884 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Inheritance refactor for non-blocking syncrlarocque@chromium.org2014-06-273-45/+56
| | | | | | | | | | | | | | | | | | | | | | Implements several previously discussed changes to the inheritance hierarchy for non-blocking sync classes. Changes SyncContext from a wrapper around ModelTypeRegistry to an interface class that ModelTypeRegistry implemnts. Makes ModelTypeSyncWorkerImpl implement the ModelTypeSyncWorker interface, even though it is never referenced via this interface. Makes the same change to ModelTypeSyncProxyImpl and the ModelTypeSyncProxy interface. These refactoring required that some methods be renamed to be consistent with the interface. This completes the refactoring that was started in r279618. BUG=351005 Review URL: https://codereview.chromium.org/351073005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280417 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Mass rename of non-blocking sync classesrlarocque@chromium.org2014-06-253-92/+90
| | | | | | | | | | | | | | | | | | | | | | | | | Renames many of the classes involved in non-blocking sync: - Renames SyncCore, SyncCoreProxy to SyncContext and SyncContextProxy. - Renames NonBlockingTypeProcessor and NonBlockingTypeProcessorInterface to ModelTypeSyncProxyImpl and ModelTypeSyncProxy, respectively. - Renames NonBlockingTypeProcessorCore and NonBlockingTypeProcessorCoreInterface to ModelTypeSyncWorkerImpl and ModelTypeSyncWorker, respectively. - Renames ModelThreadSyncEntity to ModelTypeEntity. - Renames SyncThreadSyncEntity to EntityTracker. Renames any Mock, Test, Wrapper, or Impl classes associated with the above, too. This is only the first part of the planned refactoring. The second part, which involves some changes to the inheritance hierarchy, will be implemented in a future CL. BUG=351005 Review URL: https://codereview.chromium.org/351523003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279618 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Implement NonBlockingTypeProcessorCorerlarocque@chromium.org2014-06-051-4/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces the second half of the non-blocking sync engine. For now, most of the classes invovled are never instantiated outside of tests. Adds NonBlockingTypeProcessorCore, the sync thread component of non-blocking sync. It coordinates between the sync server and the NonBlockingTypeProcessor that lives on the model thread. The SyncThreadSyncEntity exists to help it handle keep track of the in-flight sync entities. The NonBlockingTypeProcessorCore interacts with the sync thread components by implementing both the UpdateHandler and CommitContributor interfaces. This allows it to take part in commit and update operations that are managed by the syncer. As part of its implementation of the CommitContributor interface, the NonBlockingTypeProcessorCore introduces a NonBlockingTypeProcessorCommitContribution class to manage its contribution to a commit request and associated it with the response. This CL includes a large amount of test framework code to help test the NonBlockingTypeProcessorCore. Makes the SyncEntityToValue function in proto_value_conversions.h public to enable more informative debug messages. BUG=351005 Review URL: https://codereview.chromium.org/299963002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275187 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Populate entity counts in about:sync tabrlarocque@chromium.org2014-06-031-1/+22
| | | | | | | | | | | | | | | | | | | Populates the count of entities per type in about:sync. Includes C++ code to count and emit the set of deleted and non-deleted counts, though for space reasons only the non-deleted count is displayed on the about:sync page. This calculation is somewhat expensive. It could be made cheaper by having an index in the Directory to keep track of which entities belong to which type, but that doesn't exist at the moment. For now, we just avoid calculating these counts unless the about:sync page is open. BUG=349301 Review URL: https://codereview.chromium.org/302283007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274563 0039d316-1c4b-4281-b951-d872f2087c98
* Implement sync in the NonBlockingTypeProcessorrlarocque@chromium.org2014-05-223-19/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces the NonBlockingTypeProcessor's sync logic. When combined with the NonBlockingTypeProcessorCore's sync logic (which will be introduced in a follow-up commit), this will be an alternative to the existing sync engine implemented with DirectoryUpdateHandler and DirectoryCommitContributor. Adds non_blocking_sync_common.h, which defines structs to be used to pass messages between the processor and processor core. Adds DataTypeState as a parameter to the processor to processor core connection methods. Eventually this will be used to initialize the processor core with state that the processor loaded from disk. Adds a lot of unit tests and unit test framework intrastructure. The NonBlockingTypeProcessor and NonBlockingTypeProcessorCore's communications with each other will be very racy. These tests are intended to help manage the complexity this will cause by allowing us to test all the possible race conditions individually. BUG=351005 Review URL: https://codereview.chromium.org/280983002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272329 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Populate debug counters for directory typesrlarocque@chromium.org2014-05-152-3/+9
| | | | | | | | | | | | | | | | | | | | Modifies the directory update handlers and commit contributors to make use of the debug info emitters. Previously, the debug info emitters were available but unused. This change makes it so the counters are updated and their observers notified at appropriate times. Updates some tests to rely on these counters rather than the StatusController. Eventually, these counters will replace most existing uses of StatusController. The code does not currently contain any non-test observers, so these newly updated values are currently not reported anywhere. BUG=349301 Review URL: https://codereview.chromium.org/271613006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270590 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Move NonBlockingTypeProcessor to sync/enginerlarocque@chromium.org2014-05-132-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Moves NonBlockingTypeProcessor from sync/internal_api to sync/engine. It's become increasingly clear to me that the NonBlockingTypeProcessor will be too big to expose outside of sync. When it comes time to export its functionality, we'll need to define a wrapper class with a simpler interface. This means that there's no benefit to keeping it in internal_api. There is a benefit to moving this to sync/engine. In this location, it should be able to collaborate more closely with its sibling, the NonBlockingTypeProcessorCore. We intend to start adding lots of code to this class soon. It's a good idea to get this move out of the way first, so we can have a better git history in the end. BUG=351005 Review URL: https://codereview.chromium.org/280693003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270025 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Implement disabling of non blocking typesrlarocque@chromium.org2014-05-121-18/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds logic to have the model-thread NonBlockingDataTypeProcessor send a message to the sync-thread SyncCore when it receives notifcation from the ui-thread NonBlockingDataTypeController that it should stop syncing. This message will allow the sync thread to stop requeting updates and commits on behalf of the now-disabled type. Fixes the handling of a race in the NonBlockingDataTypeProcessor. The race is as follows: 1. NBDTP receives a request to enable sync from the UI thread, and sends a connection request to the sync thread via SyncCoreProxy. 2. NBDTP receives a request to disable sync from the UI thread. It updates its internal state accordingly. 3. NBDTP receives the connection OK response from the sync thread, which was genrated in response to its request in step 1. Previously, the processor would wrongly set itself to the enable state in step 3. The fix is to use a new WeakPtrFactory and invalidate the pointers it has issued in step 2 in order to prevent the response seen in step 3 from being run. Adds some more tests for this scenario and more. The test framework had to be made a bit more complicated in order to handle these tests, but I think the extra complexity is worth it. I don't know of any other way to reliably defend against these race cases. BUG=351005 Review URL: https://codereview.chromium.org/272323002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269916 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Plumb per-type counter observers to UIrlarocque@chromium.org2014-05-072-0/+35
| | | | | | | | | | | | | | | | | Implements the plumbing to get events from the DirectoryTypeDebugInfoEmitters in the ModelTypeRegistry, through the SyncManager, SyncBackendHostCore, and SyncBackendHost to the ProfileSyncService. At the moment, there are no observers register and no events are emitted. Future patches will include logic to update the counters and to expose their values on the about:sync page. BUG=328606 Review URL: https://codereview.chromium.org/269543020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268747 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Expose DirectoryDebugInfoEmitters in enginerlarocque@chromium.org2014-05-022-15/+37
| | | | | | | | | | | | | | | | | | | | | | Changes the lifetime of DirectoryTypeDebugInfoEmitters, DirectoryCommitContributors, and DirectoryUpdateHandlers. Under the old lifetime management design, we had no state that lived beyond a configure cycle. This would be bad, since we want the debug info counter values to remain after the initial configure is done. The refactoring ensures that the DirectoryTypeDebugInfoEmitters will live as long as their data type is enabled. As a side effect, the commit contributors and update handlers get to live that long, too. Plumbs the DirectoryTypeDebugInfoEmitters through the commit contributor and update handler classes. This prepares them for updating counters and emitting events from sync/engine/ code, although this functionality won't be implemented until the next patch in the series. BUG=328606 Review URL: https://codereview.chromium.org/260613002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267740 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Introduce classes for per-type countersrlarocque@chromium.org2014-04-294-3/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces the classes required to support per-type debug information. This system will eventually replace much of the StatusController and ModelNeutralState. Adds three counter objects. There is one for counters incremented during a GetUpdates, one for counters incremented during a commit, and one for "status" indicators like the total number of sync entities. Adds the DirectoryTypeDebugInfoEmitter, which will manage these counters. There will be one instance of this object per enabled directory-style sync ModelType. It owns the counters that will be updated by the CommitContributors and UpdateHandlers. It also collaborates with the ModelTypeRegistry to allow these CommitContributors and UpdateHandlers to notify observers of updated counter state. Adds the TypeDebugInfoObserver, the interface for classes that listen for counter updates. At the moment, this code won't actually do much. The counters are never incrememnted, no observers register for counter change events, and no such events are generated. Those pieces will be added in future commits. BUG=328606 Review URL: https://codereview.chromium.org/254473008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266991 0039d316-1c4b-4281-b951-d872f2087c98
* Remove changes remaining counter from about:syncrlarocque@chromium.org2014-04-284-17/+0
| | | | | | | | | | | | | | | | | The label "changes remaining" is not quite correct. It's actually set to either zero or one, depending on whether or not the current sync cycle should result in more downloads. If there is an issue with infinite download looping, we should be able to detect and debug it based on the protocol logs, among other things. The protocol logs indicate when a GetUpdates response had a non-zero "changes remaining" value. BUG=349301 Review URL: https://codereview.chromium.org/256413007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266594 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Re-implement getAllNodes WebUI functionrlarocque@chromium.org2014-04-072-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the existing implementation of getAllNodes. This was the last function based on the old "makeSyncFunction" and "JsMessageHandler" interface, so its removal leaves behind quite a bit of dead code. This CL removes some of it. The rest will be removed in a future CL. Replaces it with some infrastructure intended to be more compatible with the future of sync, where each type is more independent. Requests to getAllNodes are routed through a DirectoryTypeDebugInfoEmitter in the ModelTypeRegistry. A NonBlockingTypeDebugInfoEmitter will be implemented in a future CL. The new system also intended to support "streaming" results. Rather than waiting for all types to return their nodes, the system could be modified to allow some types to get back to the JavaScript layer sooner than others so it can display results earlier. However, we do not currently take advantage of this functionality. The return type of getAllNodes is now an array of per-type objects, rather than one big list of nodes. This, too, should help us implement streaming support in the future. For now, most of the JavaScript callbacks will convert the data back to the old format before operating on it. BUG=328606 Review URL: https://codereview.chromium.org/224563004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262193 0039d316-1c4b-4281-b951-d872f2087c98
* Add non-blocking sync code to ProfileSyncServicerlarocque@chromium.org2014-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Adds support for non-blocking sync to the ProfileSyncService and related classes. This continues the work of r258390 and r259921. Like those patches, it is not expected to have any impact on behavior. Introduces ProfileSyncService::RegisterNonBlockingType(). This function will act as an alternative to RegisterDataTypeController(). Adds some support for these non-blocking types. Adds a special case to the code that generates the 'type status' table on the about:sync page. Instantiates and copies a SyncCoreProxy object to the ProfileSyncService as backend initialization completes. This will be an important part of non-blocking data type initialization, once that functionality is supported. BUG=351005 Review URL: https://codereview.chromium.org/217183003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261590 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove TrafficRecorderrlarocque@chromium.org2014-04-022-10/+0
| | | | | | | | | | | | The new protocol events framework handles all the use cases of the TrafficRecorder, and more. The traffic recorder implementation and about:sync tab are now redundant. BUG=357821 Review URL: https://codereview.chromium.org/217633003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261032 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add NonBlockingTypeProcesssor and SyncCorerlarocque@chromium.org2014-03-274-13/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces the model-thread sibling of the NonBlockingTypeProcessorCore that was added in r258390. Also adds SyncCore and SyncCoreProxy, the classes that will be used to connect the two. The SyncCore lives on the sync thread and carries out requests sent to it by the SyncCoreProxy. The SyncCoreProxy is a thread-safe wrapper around the SyncCore that can be easily copied and whose methods can be called from any thread. The NonBlockingTypeProcessor is instantiated on the same thread as the data to be synced. It connects to a NonBlockingTypeProcessorCore on the sync thread by sending a request through a SyncCoreProxy. Keeping data in sync will be a collaborative effort involving both the NonBlockingTypeProcessor and NonBlockingTypeProcesssorCore, though none of this functionality has been implemented yet. As of this CL, none these classes are instantiated outside of tests. This CL should have no effect on current sync behavior. BUG=351005 Review URL: https://codereview.chromium.org/208893004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259921 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Expose ProtocolEvents on ProfileSyncServicerlarocque@chromium.org2014-03-212-0/+9
| | | | | | | | | | | | | | | | | Adds code to the sync engine to have it generate protocol events when it contacts the server. These events are then sent through the SyncSession, SyncManager, SyncBackendHostCore, SyncBackendHost, and finally to the ProfileSyncService. Objects on the UI thread can register with the ProfileSyncService as observers of these events, though this CL does not introduce any of these listeners. BUG=349301 Review URL: https://codereview.chromium.org/203463005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258685 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add NonBlockingSyncTypeProcessorCore (again)rlarocque@chromium.org2014-03-205-24/+170
| | | | | | | | | | | | | | | | | | | | | | | | This is a re-land of r258035, which was mistakenly reverted with r258266. Original CL description follows. Adds the class for handling sync updates and commits on the sync thread. The current implementation is mostly a bunch of stubs. In the future, this will be hooked up to a NonBlockingSyncTypeProcessor that lives on the model type's thread. These two classes will collaborate to implement the non-blocking sync system. This CL also adds some code to the ModelTypeRegistry and SyncSessionContext to prepare for managing these NonBlockingSyncTypeProcessor objects. This new code is used only in tests. TBR=zea@chromium.org BUG=351005 Review URL: https://codereview.chromium.org/206693002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258390 0039d316-1c4b-4281-b951-d872f2087c98
* Revert of sync: Add NonBlockingSyncTypeProcessorCore ↵pneubeck@chromium.org2014-03-205-170/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/192953008/) Reason for revert: Best guess that this broke SyncFileSystemApiTest.WriteFileThenGetUsage SyncFileSystemApiTest.GetFileStatuses MediaGalleriesPlatformAppBrowserTest.MediaGalleriesCopyTo on XP Tests(1). Original issue's description: > sync: Add NonBlockingSyncTypeProcessorCore > > Adds the class for handling sync updates and commits on the sync thread. > The current implementation is mostly a bunch of stubs. > > In the future, this will be hooked up to a NonBlockingSyncTypeProcessor > that lives on the model type's thread. These two classes will > collaborate to implement the non-blocking sync system. > > This CL also adds some code to the ModelTypeRegistry and > SyncSessionContext to prepare for managing these > NonBlockingSyncTypeProcessor objects. This new code is used only in > tests. > > BUG=351005 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=258035 TBR=zea@chromium.org,rlarocque@chromium.org NOTREECHECKS=true NOTRY=true BUG=351005 Review URL: https://codereview.chromium.org/204913004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258266 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add NonBlockingSyncTypeProcessorCorerlarocque@chromium.org2014-03-195-24/+170
| | | | | | | | | | | | | | | | | | | | Adds the class for handling sync updates and commits on the sync thread. The current implementation is mostly a bunch of stubs. In the future, this will be hooked up to a NonBlockingSyncTypeProcessor that lives on the model type's thread. These two classes will collaborate to implement the non-blocking sync system. This CL also adds some code to the ModelTypeRegistry and SyncSessionContext to prepare for managing these NonBlockingSyncTypeProcessor objects. This new code is used only in tests. BUG=351005 Review URL: https://codereview.chromium.org/192953008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258035 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add definitions for ProtocolEventsrlarocque@chromium.org2014-03-182-0/+42
| | | | | | | | | | | | | | | This is a part of a much larger change list. The eventual goal is to have these ProtocolEvents emitted all the way to the UI thread, where they can be displayed on about:sync. This CL just defines the objects without using them. BUG=349301 R=tim@chromium.org Review URL: https://codereview.chromium.org/187083003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257700 0039d316-1c4b-4281-b951-d872f2087c98
* Reland "Add base::TimeDelta::Max()" again.gavinp@chromium.org2014-03-051-4/+2
| | | | | | | | | | | | | Webkit layout tests found more media logs serializing infinite durations to JSON. R=scherkus@chromium.org TBR=ajwong@chromium.org,jar@chromium.org,jamesr@chomium.org,acolwell@chromium.org,nick@chromium.org BUG=None Review URL: https://codereview.chromium.org/186683002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255128 0039d316-1c4b-4281-b951-d872f2087c98
* Revert of Reland "Add base::TimeDelta::Max()" ↵apavlov@chromium.org2014-03-041-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/183763011/) Reason for revert: http/tests/media/video-cookie.html is asserting on debug bots Original issue's description: > Reland "Add base::TimeDelta::Max()" > > Media was exposing max timedeltas to JSON, which wasn't working with > infinity. > > R=scherkus@chromium.org > TBR=ajwong@chromium.org,jar@chromium.org,jamesr@chomium.org,acolwell@chromium.org,nick@chromium.org > BUG=None > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=254717 TBR=ajwong@chromium.org,jar@chromium.org,scherkus@chromium.org,jamesr@chomium.org,acolwell@chromium.org,nick@chromium.org,gavinp@chromium.org NOTREECHECKS=true NOTRY=true BUG=None Review URL: https://codereview.chromium.org/179813009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254743 0039d316-1c4b-4281-b951-d872f2087c98
* Reland "Add base::TimeDelta::Max()"gavinp@chromium.org2014-03-041-4/+2
| | | | | | | | | | | | | Media was exposing max timedeltas to JSON, which wasn't working with infinity. R=scherkus@chromium.org TBR=ajwong@chromium.org,jar@chromium.org,jamesr@chomium.org,acolwell@chromium.org,nick@chromium.org BUG=None Review URL: https://codereview.chromium.org/183763011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254717 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Merge GU retry logic into normal GUrlarocque@chromium.org2014-03-047-53/+81
| | | | | | | | | | | | | | | | | | | | | | | | | Moves the implementation of the GU retry get updates into the normal GU cycle. This should have no impact on behvaior. The point of this refactoring is to eliminate an instance of the GetUpdateDelegate. I hope to build on that interface in the future, and removing one of its four implementations should make that work 25% easier. This CL should retain all the same quirks as the old retry implemenation. The timer management is the same. It also sends up a special RETRY value for GetUpdatesOrigin when the only reason for performing an update is a scheduled retry, which was the behavior of the old code. This CL also refactors the NudgeTracker's mangement of the updates_source_. The old, stateful, implementation was getting out of hand. The new implementation should be easier to maintain, especially as we start to support 'partially successful' sync cycles. BUG=339984 Review URL: https://codereview.chromium.org/171813013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254653 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 253502 "Add base::TimeDelta::Max()."waffles@chromium.org2014-02-271-2/+4
| | | | | | | | | | | | | | | | | | | | > Add base::TimeDelta::Max(). > > TimeDelta::Max() is a maximum timedelta, larger than any timedelta you > can compare it to. The results of adding it to a time, or another time > delta are undefined. > > R=ajwong@chromium.org,mkwst@chromium.org,jar@chromium.org > TBR=jamesr@chomium.org,acolwell@chromium.org,nick@chromium.org > BUG=None > > Review URL: https://codereview.chromium.org/163413004 TBR=gavinp@chromium.org Review URL: https://codereview.chromium.org/179763006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253643 0039d316-1c4b-4281-b951-d872f2087c98
* Add base::TimeDelta::Max().gavinp@chromium.org2014-02-261-4/+2
| | | | | | | | | | | | | | TimeDelta::Max() is a maximum timedelta, larger than any timedelta you can compare it to. The results of adding it to a time, or another time delta are undefined. R=ajwong@chromium.org,mkwst@chromium.org,jar@chromium.org TBR=jamesr@chomium.org,acolwell@chromium.org,nick@chromium.org BUG=None Review URL: https://codereview.chromium.org/163413004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253502 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add interfaces for per-type syncrlarocque@chromium.org2014-02-192-11/+10
| | | | | | | | | | | | | | | | | | | | | | Puts the DirectoryCommitContributor and DirectoryUpdateHandler classes behind interfaces. These classes were always intended to form the basis of an abstract interface. Now we can start to introduce alternate implementations of them. This CL includes one such alternate implementation. It adds the MockUpdateHandler and uses it to remove some unnecessary boilerplate from the download unit tests. This CL also resolves an old TODO. It renames the SyncDirectory* classes to Directory*, since the 'Sync' part of the name is redundant. This should have no effect on program behavior. BUG=278484 Review URL: https://codereview.chromium.org/161253002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251969 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Move migration signal out of snapshotrlarocque@chromium.org2014-02-123-7/+3
| | | | | | | | | | | | | | | | | | | A sync data migration request is signalled by the server during a normal GetUpdates or Commit request. The signal is then forwarded to the UI thread, which actually performs the migration. Traditionally, the signal has been sent through the SyncSessionSnapshot, which is delivered to the UI thread at the end of the current sync cycle. This CL introduces new code to pass the signal through the SyncSession::Delegate and SyncManagerObserverInterfaces. This CL should not change the syncer's behavior. BUG=339984 Review URL: https://codereview.chromium.org/158953004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250849 0039d316-1c4b-4281-b951-d872f2087c98