summaryrefslogtreecommitdiffstats
path: root/sync/engine
Commit message (Collapse)AuthorAgeFilesLines
* Standardize usage of virtual/override/final in sync/dcheng2014-10-2112-121/+106
| | | | | | | | | | | | 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-163-8/+3
| | | | | | | | 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-0614-84/+84
| | | | | | | | BUG=417463 Review URL: https://codereview.chromium.org/629733002 Cr-Commit-Position: refs/heads/master@{#298300}
* [Sync] Clean up ProfileSyncService observer eventszea2014-09-301-1/+0
| | | | | | | | | | | Several spurious NotifyObserver calls have been removed, in addition to removing the configuration retry code (which was not doing anything anymore). BUG=418140 Review URL: https://codereview.chromium.org/612573005 Cr-Commit-Position: refs/heads/master@{#297345}
* Add test that checks function UpdateServerFieldsFromUpdate is workingreat2014-09-052-1/+80
| | | | | | | | | | | | | properly with invalid server's originator_cache_guid and originator_client_item_id. It checks UpdateBookmarkPositioning works fine. BUG= R=rlarocque@chromium.org Review URL: https://codereview.chromium.org/533113002 Cr-Commit-Position: refs/heads/master@{#293473}
* Remove implicit conversions from scoped_refptr to T* in sync/Daniel Cheng2014-08-261-9/+10
| | | | | | | | | | | | This patch was generated by running the rewrite_scoped_refptr clang tool on a Linux build. BUG=110610 R=rlarocque@chromium.org Review URL: https://codereview.chromium.org/503903002 Cr-Commit-Position: refs/heads/master@{#291804}
* [Sync] Add support for server controlled nudge delayszea@chromium.org2014-08-226-177/+161
| | | | | | | | | | | | | | | 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] Move reenable logic into DTMzea@chromium.org2014-08-212-0/+3
| | | | | | | | | | | | The DataTypeManager is now in charge of reenabling previously failed types. BUG=368834 R=maniscalco@chromium.org Review URL: https://codereview.chromium.org/439903002 Cr-Commit-Position: refs/heads/master@{#291198} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291198 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Finish non-blocking type encryption supportrlarocque@chromium.org2014-08-169-293/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-37/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Disable SyncSchedulerTest.ReceiveNewRetryDelay on Windows as its timing out.jam@chromium.org2014-08-131-1/+7
| | | | | | | | | | | | | See http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_swarming/builds/1240 http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_swarming/builds/1233 BUG=402212 TBR=rlarocque@chromium.org Review URL: https://codereview.chromium.org/467283002 Cr-Commit-Position: refs/heads/master@{#289298} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289298 0039d316-1c4b-4281-b951-d872f2087c98
* Disable SyncSchedulerTest.FailedRetry on Windows as its timing out.jam@chromium.org2014-08-131-1/+7
| | | | | | | | | | BUG=402212 TBR=rlarocque@chromium.org Review URL: https://codereview.chromium.org/468703002 Cr-Commit-Position: refs/heads/master@{#289126} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289126 0039d316-1c4b-4281-b951-d872f2087c98
* Disable SyncSchedulerTest.SuccessfulRetry only on Windows.jam@chromium.org2014-08-111-1/+6
| | | | | | | | | | BUG=402212 TBR=rlarocque@chromium.org Review URL: https://codereview.chromium.org/451113004 Cr-Commit-Position: refs/heads/master@{#288757} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288757 0039d316-1c4b-4281-b951-d872f2087c98
* Disable SyncSchedulerTest.SuccessfulRetry since it's timing out flakly.jam@chromium.org2014-08-111-1/+2
| | | | | | | | | | BUG=402212 TBR=rlarocque@chromium.org Review URL: https://codereview.chromium.org/465613002 Cr-Commit-Position: refs/heads/master@{#288753} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288753 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add non-blocking type encryption (retry)rlarocque@chromium.org2014-08-0612-70/+1155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0512-1149/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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-0512-70/+1149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2811-154/+9
| | | | | | | | | | | | | | | | | | 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: Introduce CryptographerProvider interfacerlarocque@chromium.org2014-07-264-0/+195
| | | | | | | | | | | | | | | | | | | | | | Creates a CryptographerProvider interface that can be used to expose the syncable::Directory's Cryptographer without exposing the directory itself. Since the directory's cryptographer is protected by a lock, this requires the creation of several helper classes to manage the acquistion of the lock. This CL includes the interface, an implementationthat exposes the directory's cryptographer (DirectoryCryptographerProvider) and a SimpleCryptographerProvider that wraps a non-owned Cryptographer for testing purposes. These interfaces will be used to implement and test encryption of non-blocking sync types. BUG=351005 Review URL: https://codereview.chromium.org/413833002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285777 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove support for hierarchy deletionsrlarocque@chromium.org2014-07-243-79/+168
| | | | | | | | | | | | | | Removes client-side support for implicitly deleting a folder and all of its contents by issuing a single folder delete to the server. Increments the protocol version to advertise to servers that this client handles folder deletions differently. BUG=373869 Review URL: https://codereview.chromium.org/331863010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285201 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Rely on directory to decide which types need to be purgedzea@chromium.org2014-07-191-0/+8
| | | | | | | | | | | | | Preivously we relied on the SyncBackendRegistrar's last configured types to decide which types have been recently disabled. Now we just purge all disabled types that exist in the directory, as recorded by their progress markers (which should never be deleted unless the type has been purged). BUG=386778 Review URL: https://codereview.chromium.org/398813005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284283 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Support non-blocking initial sync in protorlarocque@chromium.org2014-07-185-0/+57
| | | | | | | | | | | | | | | | | | | | | 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
* Update Commit and GetUpdatesResponse messages to include attachment ids.maniscalco@chromium.org2014-07-176-5/+324
| | | | | | | | | | | | | | | | | Private function HasAttachmentNotOnServer is now tested (albeit indirectly) by directory_commit_contribution_unittest.cc via DirectoryCommitContribution::Build. When displayed in about:sync, SyncEntity instances will now show any attachment ids they contain. This CL depends on issue 395913003. BUG=356266,394023 Review URL: https://codereview.chromium.org/393083004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283908 0039d316-1c4b-4281-b951-d872f2087c98
* Remove most remaining sync/notifier dependenciesrlarocque@chromium.org2014-07-103-4/+0
| | | | | | | | | | | | | | | 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-107-4/+93
| | | | | | | | | | | | | | | | | | | | | | | | | 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-091-1/+0
| | | | | | | | | | 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-20/+38
| | | | | | | | | | | | | | | | | | | | | | | | | 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-277-14/+17
| | | | | | | | | | | | | | | | | | | | | | 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: Stop supporting parent IDs for some typesrlarocque@chromium.org2014-06-262-1/+66
| | | | | | | | | | | | | | | | Makes non-bookmarks nodes no longer send up a parent ID for each of their commits. This is part of an update to the sync protocol that will eventually allow both the client and server to remove support for type root nodes. Note that the client still expects to receive type root nodes from the server. That expectation will be removed in a future CL. BUG=373869 Review URL: https://codereview.chromium.org/310993002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280148 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Mass rename of non-blocking sync classesrlarocque@chromium.org2014-06-2521-668/+637
| | | | | | | | | | | | | | | | | | | | | | | | | 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: Support disconnect in non-blocking syncrlarocque@chromium.org2014-06-235-1/+159
| | | | | | | | | | | | | | | Adds support for Disconnect() and Disable() operations to the non-blocking sync engine. Although these functions did exist prior to this CL, until now they did not take into account the effect of these operations on pending commit state. Also adds some tests for the new functionality. BUG=351005 Review URL: https://codereview.chromium.org/339393003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279182 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Refactor NonBlockingTypeProcessorCore testsrlarocque@chromium.org2014-06-182-435/+75
| | | | | | | | | | | | | | | | | | | Pulls MockNonBlockingTypeProcessor and SimpleMockServer classes out of the NonBlockingTypeProcessorCore's test harness. These two new mock classes are currently used in only one place, though it's probable that they'll be reused elsewhere sooner or later. Even if no code is reused, this change is worthwhile because it leads to better separation of responsibilities and improved documentation. This is one of serveral follow-ups to the commits that introduced NonBlockingTypeProcessor and NonBlockingTypeProcessorCore. BUG=351005 Review URL: https://codereview.chromium.org/330523002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278114 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Refactor NonBlockingTypeProcessor testsrlarocque@chromium.org2014-06-121-231/+26
| | | | | | | | | | | | | | | | | | | Moves some test support classes out of the NonBlockingTypeProcessor's unit test .cc files and into their own files. Rearranges some responsibilities between the test harness and the mock classes. Much of the functionality related to mocking out server behavior has been moved into the MockNonBlockingTypeProcessor. This makes it possible to share that code with other test harnesses. This is one of several follow-ups to the commits that introduced the NonBlockingTypeProcessor and NonBlockingTypeProcessorCore. BUG=351005 Review URL: https://codereview.chromium.org/318193002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276830 0039d316-1c4b-4281-b951-d872f2087c98
* Add integraton test for sync backup/rollback.haitaol@chromium.org2014-06-111-0/+1
| | | | | | | | BUG=362679 Review URL: https://codereview.chromium.org/310103004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276281 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Implement NonBlockingTypeProcessorCorerlarocque@chromium.org2014-06-0515-53/+2099
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Specialize functions that fetch type rootrlarocque@chromium.org2014-06-034-14/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Adds functions to look up the root node of a give type. This replaces most of the use cases for the functions that look up a node by unique server tag, so those functions have been renamed to indicate their near-deprecation. This is part of the effort to remove the client's dependence on the server for the creation of type root nodes. Although it's unlikely that we can make this work for existing types, new types should be prepared to work properly in the absence of tyep root nodes. The first step on that path is to abstract away the mechanism by which we look up the type roots. Renaming the old lookup by tag functions allows us to ensure that there no remaining cases where the code base looks up type roots by server tag. This CL also adds a few DCHECKs to ensure type roots are never looked up using the old lookup by server tag functions. BUG=373869 Review URL: https://codereview.chromium.org/302173004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274613 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Populate entity counts in about:sync tabrlarocque@chromium.org2014-06-032-0/+3
| | | | | | | | | | | | | | | | | | | 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-2212-14/+1409
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Enable typed tombstones commitsrlarocque@chromium.org2014-05-202-0/+107
| | | | | | | | | | | | | | | | | | | | | | | Modifies commit logic to include the model type of items in commit requests. The model type is implicitly specified by the presence of a sub-message in the EntitySpecifics field. Prior to this commit, only bookmarks would populate the sync entities on commit. The special case for bookmarks was introduced recently, in r265587. Unlike the bookmarks case, the non-bookmark items send up only enough specifics to identify the model type. The rest of the specifics are not set. This commit also adds some tests of the bookmark and non-bookmark deletion request behaviors. BUG=365752,373859 Review URL: https://codereview.chromium.org/298503002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271763 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Improve handling of bad UniquePos (retry)rlarocque@chromium.org2014-05-153-9/+139
| | | | | | | | | | | | | | | | | | | | | | | | | Retry: The first attempt had a memory leak. It seems that this leak existed before this CL, but no code exercised it. This updated CL includes a scoped deleter that should fix it. Original commits message was: Makes the client assign a valid position to incoming bookmarks if the server has not populated the required fields. This code should never be triggered unless there is a bug in the server. This risks reordering users' bookmarks, but that's probably preferable to a crash. This fallback code is still protected by a NOTREACHED(), as before. Detects bookmarks that do not have valid position information during database load. If these corrupted bookmarks are detected, the entire database is declared to be corrupt. Sync will then re-download all of the user's data, which should fix the problem. BUG=367247 Review URL: https://codereview.chromium.org/283143002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270837 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Populate debug counters for directory typesrlarocque@chromium.org2014-05-159-77/+262
| | | | | | | | | | | | | | | | | | | | 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
* Revert 270308 "sync: Improve handling of bad UniquePositions"raymes@google.com2014-05-143-139/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Reverting due to possible build breakage: http://build.chromium.org/p/chromium.memory/buildstatus?builder=Linux%20ASan%20LSan%20Tests%20%282%29&number=2633 > sync: Improve handling of bad UniquePositions > > Makes the client assign a valid position to incoming bookmarks if the > server has not populated the required fields. This code should never be > triggered unless there is a bug in the server. This risks reordering > users' bookmarks, but that's probably preferable to a crash. > > Detects bookmarks that do not have valid position information during > database load. If these corrupted bookmarks are detected, the entire > database is declared to be corrupt. Sync will then re-download > all of the user's data, which should fix the problem. > > BUG=367247 > > Review URL: https://codereview.chromium.org/278153002 TBR=rlarocque@chromium.org Review URL: https://codereview.chromium.org/270543005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270324 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Improve handling of bad UniquePositionsrlarocque@chromium.org2014-05-143-9/+139
| | | | | | | | | | | | | | | | | | Makes the client assign a valid position to incoming bookmarks if the server has not populated the required fields. This code should never be triggered unless there is a bug in the server. This risks reordering users' bookmarks, but that's probably preferable to a crash. Detects bookmarks that do not have valid position information during database load. If these corrupted bookmarks are detected, the entire database is declared to be corrupt. Sync will then re-download all of the user's data, which should fix the problem. BUG=367247 Review URL: https://codereview.chromium.org/278153002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270308 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Move NonBlockingTypeProcessor to sync/enginerlarocque@chromium.org2014-05-133-6/+181
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Keep track of which attachments are referenced by which sync entries.maniscalco@chromium.org2014-05-021-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Relanding https://codereview.chromium.org/247983002/ after fixing memory leak. PutAttachmentMetadata on MutableEntry now notifies the Directory when the attachments associated with an entry change. Give Directory::InitializeIndices a ScopedKernelLock to be consistent and make it easier to ensure we are locking when we need to. GenericChangeProcess passes new attachments to AttachmentService for storage and upload. Add an output parameter to GenericChangeProcessor's HandleActionAdd and HandleActionUpdate methods so they can keep track of potentially new attachments and pass them to AttachmentService for storage/upload. Convert AttachmentService's OnSyncDataAdd to StoreAttachments. Implement HasAttachmentNotOnServer. BUG=348625,353303,354530,356266 Review URL: https://codereview.chromium.org/264793007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267887 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Expose DirectoryDebugInfoEmitters in enginerlarocque@chromium.org2014-05-028-30/+84
| | | | | | | | | | | | | | | | | | | | | | 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
* Revert of Keep track of which attachments are referenced by which sync ↵maniscalco@chromium.org2014-05-011-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | entries. (https://codereview.chromium.org/247983002/) Reason for revert: Looks like this may have introduced a memory leak: http://build.chromium.org/p/chromium.memory.fyi/builders/Linux%20Tests%20%28valgrind%29%282%29/builds/37232 Reverting. Will investigate and reland when appropriate. Original issue's description: > Keep track of which attachments are referenced by which sync entries. > > PutAttachmentMetadata on MutableEntry now notifies the Directory when > the attachments associated with an entry change. > > Give Directory::InitializeIndices a ScopedKernelLock to be consistent > and make it easier to ensure we are locking when we need to. > > GenericChangeProcess passes new attachments to AttachmentService for > storage and upload. > > Add an output parameter to GenericChangeProcessor's HandleActionAdd and > HandleActionUpdate methods so they can keep track of potentially new > attachments and pass them to AttachmentService for storage/upload. > > Convert AttachmentService's OnSyncDataAdd to StoreAttachments. > > Implement HasAttachmentNotOnServer. > > BUG=348625,353303,354530,356266 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=267617 TBR=pavely@chromium.org,tim@chromium.org NOTREECHECKS=true NOTRY=true BUG=348625,353303,354530,356266 Review URL: https://codereview.chromium.org/265853004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267649 0039d316-1c4b-4281-b951-d872f2087c98
* Keep track of which attachments are referenced by which sync entries.maniscalco@chromium.org2014-05-011-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | PutAttachmentMetadata on MutableEntry now notifies the Directory when the attachments associated with an entry change. Give Directory::InitializeIndices a ScopedKernelLock to be consistent and make it easier to ensure we are locking when we need to. GenericChangeProcess passes new attachments to AttachmentService for storage and upload. Add an output parameter to GenericChangeProcessor's HandleActionAdd and HandleActionUpdate methods so they can keep track of potentially new attachments and pass them to AttachmentService for storage/upload. Convert AttachmentService's OnSyncDataAdd to StoreAttachments. Implement HasAttachmentNotOnServer. BUG=348625,353303,354530,356266 Review URL: https://codereview.chromium.org/247983002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267617 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Introduce classes for per-type countersrlarocque@chromium.org2014-04-292-60/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-282-9/+6
| | | | | | | | | | | | | | | | | 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