summaryrefslogtreecommitdiffstats
path: root/sync/engine
Commit message (Collapse)AuthorAgeFilesLines
* Reland [Sync] Refactoring polling to be reliable.zea2015-05-157-449/+554
| | | | | | | | | | | | | | | | | | | | | | This is a reland of https://codereview.chromium.org/1132013004/ Polling is now an important component of sync health, as it can sometimes be the only time we'll query for certain datatypes. As such, the following has changed: - Polls that fail will be retried (with backoff). - As such, the logic to force a poll after an auth error isn't needed anymore - The last successful poll time will be persisted in the sync prefs. - On startup, schedule the first poll for last_poll_time + poll_interval (or Now(), whichever is latest). - Receiving a new poll interval from the server will update the poll timer - The poll timer is now a one shot timer, and only restarts on success - Some code cleanup to make the above more straightforward BUG=482154 Review URL: https://codereview.chromium.org/1144543004 Cr-Commit-Position: refs/heads/master@{#330024}
* Revert of [Sync] Refactoring polling to be reliable. (patchset #5 id:80001 ↵zea2015-05-137-550/+449
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of https://codereview.chromium.org/1132013004/) Reason for revert: Failing on valgrind bots Original issue's description: > [Sync] Refactoring polling to be reliable. > > Polling is now an important component of sync health, as it can sometimes be > the only time we'll query for certain datatypes. As such, the following > has changed: > - Polls that fail will be retried (with backoff). > - As such, the logic to force a poll after an auth error isn't needed anymore > - The last successful poll time will be persisted in the sync prefs. > - On startup, schedule the first poll for last_poll_time + poll_interval > (or Now(), whichever is latest). > - Receiving a new poll interval from the server will update the poll timer > - The poll timer is now a one shot timer, and only restarts on success > - Some code cleanup to make the above more straightforward > > BUG=482154 > > Committed: https://crrev.com/3777d8727d7b4caedfb72bfdcbe2fea1f1d1d594 > Cr-Commit-Position: refs/heads/master@{#329669} TBR=pavely@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=482154 Review URL: https://codereview.chromium.org/1144443004 Cr-Commit-Position: refs/heads/master@{#329683}
* [Sync] Refactoring polling to be reliable.zea2015-05-137-449/+550
| | | | | | | | | | | | | | | | | | | | Polling is now an important component of sync health, as it can sometimes be the only time we'll query for certain datatypes. As such, the following has changed: - Polls that fail will be retried (with backoff). - As such, the logic to force a poll after an auth error isn't needed anymore - The last successful poll time will be persisted in the sync prefs. - On startup, schedule the first poll for last_poll_time + poll_interval (or Now(), whichever is latest). - Receiving a new poll interval from the server will update the poll timer - The poll timer is now a one shot timer, and only restarts on success - Some code cleanup to make the above more straightforward BUG=482154 Review URL: https://codereview.chromium.org/1132013004 Cr-Commit-Position: refs/heads/master@{#329669}
* Convert some parts of sync/ to use of scoped_ptr instead of bare ptrsestade2015-05-072-3/+5
| | | | | | | | | | for base::Value handling. BUG=none Review URL: https://codereview.chromium.org/1126913002 Cr-Commit-Position: refs/heads/master@{#328830}
* [Sync] Delete syncable::Blob and associated dead codemaniscalco2015-04-174-89/+0
| | | | | | | | BUG=477706 Review URL: https://codereview.chromium.org/1095593002 Cr-Commit-Position: refs/heads/master@{#325682}
* [Sync] Fix undeletion during commit logiczea2015-04-024-11/+58
| | | | | | | | | | | | | | | | We were relying on the SYNCING bit to track whether a commit has begun or not. This will not work in all cases, as any modification actually unsets the SYNCING bit, thereby making it unreliable as a source for whether a sync cycle has started for an entity. To fix that, introduce a new DIRTY_SYNC bit that is only modified when a entry becomes dirty during a sync cycle. SYNCING can then better match it's name, and will stay true until the sync cycle ends. BUG=466098 TEST=repeatedly bookmark a page then remove the bookmark Review URL: https://codereview.chromium.org/1048933003 Cr-Commit-Position: refs/heads/master@{#323388}
* Sync: support implicit permanent folders in commits.stanisc2015-03-202-25/+40
| | | | | | | | | | | | | | | | | | | Traversal::AddUncommittedParentsAndTheirPredecessors walks the hierarchy to sort commits which is not necessary for any types except bookmarks. We've seen some crashes here when implicit permanent folders were turned on alpha server. I reproduced the crash by planting an empty parent ID in the database. The fix avoids traversing the hierarchy for committed items with unset parent IDs. Verified that this has stopped the crash locally and successfully committed the item. BUG=438313 Review URL: https://codereview.chromium.org/1023843002 Cr-Commit-Position: refs/heads/master@{#321472}
* [Sync] Add size and crc32c to AttachmentId.maniscalco2015-03-112-6/+8
| | | | | | | | | | | | | | | | | | | | | The purpose of this change is to ensure that if a client knows about an attachment (i.e. has an AttachmentId or AttachmentIdProto) it will know the attachment's size even if the attachment has never been available on the local device. The idea is that by storing size locally, we can simplify remote storage management. Move crc32c out of Attachment now that it's part of AttachmentId. BUG=464431 Committed: https://crrev.com/23ae3128db0d84a6b1ffa640568a5ec90cfc8808 Cr-Commit-Position: refs/heads/master@{#319794} Review URL: https://codereview.chromium.org/982883002 Cr-Commit-Position: refs/heads/master@{#320103}
* Revert of [Sync] Add size and crc32c to AttachmentId. (patchset #8 id:140001 ↵dgrogan2015-03-102-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of https://codereview.chromium.org/982883002/) Reason for revert: Broke build on iOS_Device http://build.chromium.org/p/chromium.mac/builders/iOS_Device/builds/26684/steps/compile/logs/stdio Undefined symbols for architecture armv7: "syncer::Attachment::CreateFromParts(syncer::AttachmentId const&, scoped_refptr<base::RefCountedMemory> const&, unsigned int)", referenced from: syncer::(anonymous namespace)::MockAttachmentStore::RespondToRead(std::__1::set<syncer::AttachmentId, std::__1::less<syncer::AttachmentId>, std::__1::allocator<syncer::AttachmentId> > const&) in attachment_service_impl_unittest.o syncer::(anonymous namespace)::MockAttachmentDownloader::RespondToDownload(syncer::AttachmentId const&, syncer::AttachmentDownloader::DownloadResult const&) in attachment_service_impl_unittest.o syncer::gtest_case_AttachmentStoreTest_::Write_NoOverwriteNoError<syncer::InMemoryAttachmentStoreFactory>::TestBody() in in_memory_attachment_store_unittest.o syncer::OnDiskAttachmentStoreSpecificTest_MismatchedCrc_Test::TestBody() in on_disk_attachment_store_unittest.o syncer::gtest_case_AttachmentStoreTest_::Write_NoOverwriteNoError<syncer::OnDiskAttachmentStoreFactory>::TestBody() in on_disk_attachment_store_unittest.o "syncer::CreateAttachmentIdProto()", referenced from: syncer::AddAttachment(sync_pb::AttachmentMetadata*, bool) in directory_commit_contribution_unittest.o syncer::DirectoryUpdateHandlerProcessUpdateTest_ProcessAndApplyUpdatesWithAttachments_Test::TestBody() in directory_update_handler_unittest.o syncer::DirectoryUpdateHandlerApplyUpdateTest_SimpleConflictDifferentAttachmentMetadata_Test::TestBody() in directory_update_handler_unittest.o syncer::DirectoryUpdateHandlerApplyUpdateTest_SimpleConflictSameAttachmentMetadataDifferentOrder_Test::TestBody() in directory_update_handler_unittest.o syncer::AttachmentIdProtoTest_UniqueIdFormat_Test::TestBody() in attachment_id_proto_unittest.o syncer::AttachmentIdProtoTest_CreateAttachmentMetadata_NonEmpty_Test::TestBody() in attachment_id_proto_unittest.o syncer::SyncManagerChangeProcessingTest_AttachmentMetadataOnlyChanges_Test::TestBody() in sync_manager_impl_unittest.o ... "syncer::AttachmentId::Create()", referenced from: syncer::(anonymous namespace)::SyncDataTest_CreateLocalDataWithAttachments_Test::TestBody() in sync_data_unittest.o syncer::AttachmentDownloaderImplTest_HappyCase_Test::TestBody() in attachment_downloader_impl_unittest.o syncer::AttachmentDownloaderImplTest_SameIdMultipleDownloads_Test::TestBody() in attachment_downloader_impl_unittest.o syncer::AttachmentDownloaderImplTest_RequestAccessTokenFails_Test::TestBody() in attachment_downloader_impl_unittest.o syncer::AttachmentDownloaderImplTest_URLFetcher_BadToken_Test::TestBody() in attachment_downloader_impl_unittest.o syncer::AttachmentDownloaderImplTest_URLFetcher_ServiceUnavailable_Test::TestBody() in attachment_downloader_impl_unittest.o syncer::AttachmentDownloaderImplTest_NoHash_Test::TestBody() in attachment_downloader_impl_unittest.o ... ld: symbol(s) not found for architecture armv7 clang:error: linker command failed with exit code 1 (use -v to see invocation) Original issue's description: > [Sync] Add size and crc32c to AttachmentId. > > The purpose of this change is to ensure that if a client knows about an > attachment (i.e. has an AttachmentId or AttachmentIdProto) it will know > the attachment's size even if the attachment has never been available on > the local device. > > The idea is that by storing size locally, we can simplify remote storage > management. > > Move crc32c out of Attachment now that it's part of AttachmentId. > > BUG=464431 > > Committed: https://crrev.com/23ae3128db0d84a6b1ffa640568a5ec90cfc8808 > Cr-Commit-Position: refs/heads/master@{#319794} TBR=pavely@chromium.org,maniscalco@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=464431 Review URL: https://codereview.chromium.org/995683002 Cr-Commit-Position: refs/heads/master@{#319807}
* Sync: Added extra validation to FindLocalIdToUpdate.stanisc2015-03-101-0/+48
| | | | | | | | | | | | This is an extra check in FindLocalIdToUpdate which should help to narrow down the cause of the crash in syncer::syncable::ChangeEntryIDAndUpdateChildren and gather more information on the state of the directory leading to the crash. BUG=362467 Review URL: https://codereview.chromium.org/986463004 Cr-Commit-Position: refs/heads/master@{#319802}
* [Sync] Add size and crc32c to AttachmentId.maniscalco2015-03-102-6/+8
| | | | | | | | | | | | | | | | | | The purpose of this change is to ensure that if a client knows about an attachment (i.e. has an AttachmentId or AttachmentIdProto) it will know the attachment's size even if the attachment has never been available on the local device. The idea is that by storing size locally, we can simplify remote storage management. Move crc32c out of Attachment now that it's part of AttachmentId. BUG=464431 Review URL: https://codereview.chromium.org/982883002 Cr-Commit-Position: refs/heads/master@{#319794}
* [Sync] Add support for GetUpdates Throttlinggangwu2015-02-278-28/+134
| | | | | | | | | | | During GetUpdates, if some data types got throttled, client should backoff those data types and keep going with other unthrottled data types. BUG=416992 Review URL: https://codereview.chromium.org/955693004 Cr-Commit-Position: refs/heads/master@{#318356}
* Migrate sync/ to base::RunLoop::RunUntilIdle()qi1988.yang2015-02-261-5/+5
| | | | | | | | | | | base::MessageLoop::RunUntilIdle() API is deprecated and the preferred way is using RunLoop now. BUG= 333557 Review URL: https://codereview.chromium.org/915373002 Cr-Commit-Position: refs/heads/master@{#318184}
* Sync: Small refactoring of Directory::CheckTreeInvariants.stanisc2015-02-242-2/+2
| | | | | | | | | | | | | | | | | | | | | The purpose of this change is to minimize chances of hitting crbug/456029. 1) Call ModelTypeToRootTag only when the root folder could potentially be created on the client i.e. model type is defined in client EntitySpecifics and it is one of supported model types. 2) Rename is_type_root_folder to is_client_creatable_type_root_folder to make it clear that the checks are specific to client created type root folders. 3) Narrow the scope of where is_client_creatable_type_root_folder has to be calculated. BUG=456029 Review URL: https://codereview.chromium.org/948113005 Cr-Commit-Position: refs/heads/master@{#317742}
* Sync commit errors should temporarily re-enablegangwu2015-02-117-31/+50
| | | | | | | | | | | | | | | | | | | 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-50/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-31/+50
| | | | | | | | | | | | | | | | 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}
* Remove dependency on server generated type root foldersstanisc2015-01-305-99/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change prepares the client to deal with implicit permanent folders in Sync server updates. That includes the following: - Expect type root folders to not come from the server on the initial sync. The client auto-creates type root folders for all types except Bookmarks and Nigori when progress marker changes from empty to non-empty. These folders are created as local nodes (with client IDs) that aren't expected to sync back to the server. - Expect empty parent IDs in updates for both new and existing items. - Because the client code updates first, the client must expect server to override locally created type root folders. To enable that the directory update code that matches update entities to local entities was updated to look at server unique tags in addition to client unique tags. Later when the server stops generating folders we should be able to remove that code. - Added some extra special cases in Directory::CheckTreeInvariants to deal with client side created type root folders. - Added / modified a few tests to cover cases with implicit parent IDs in updates. BUG=438313 Review URL: https://codereview.chromium.org/867793003 Cr-Commit-Position: refs/heads/master@{#313977}
* Mechanical rename of tracing includes for /syncprimiano2015-01-303-3/+3
| | | | | | | | | | | | This is just a mechanical rename of tracing includes. See crrev.com/837303004 and the related bug for motivations. BUG=451032 TBR=maniscalco@chromium.org Review URL: https://codereview.chromium.org/864223007 Cr-Commit-Position: refs/heads/master@{#313930}
* Correct a comment typogangwu2015-01-201-1/+1
| | | | | | | | | | | This change is for let me familiar with checkin process, so just correct an comment typo in process_updates_util.cc. BUG= Review URL: https://codereview.chromium.org/833323005 Cr-Commit-Position: refs/heads/master@{#312225}
* Enable Null Syncable ID which is different than Root ID.stanisc2014-12-236-37/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch prepares sync codebase for supporting datatypes with implicit permanent forlders by introducing an empty/unset syncable ID. There was a notion of Null ID before but it was equivalent to the root ID which caused some confusion in the code - a Null ID would sometimes be used where a "root" would be appropriate and vice versa. See the following code fragment for an example: // TODO(sync): We could use null here, but to ease conversion we use "r". // fix this, this is madness :) inline bool IsNull() const { return IsRoot(); } This change will be followed by one or two separate changes that will actually remove dependencies on PARENT_ID and SERVER_PARENT_ID and use a different way to organize nodes in the directory based on node's datatype rather than parent ID. This change impacts the following: 1) The default ID value in EntryKernel ID fields and elsewhere is Null ID and not Root ID as it used to be. 2) This means that some tests that depended on Root ID being set implicitly in PARENT_ID and SERVER_PARENT_ID now need to set these IDs explicitly. 3) Node's GetPredecessorId, GetSuccessorId, and GetFirstChildId methods now return a null ID rather than a root ID when there is no predecessor, successor, or children. 4) Small changed throughout the code to make sure that null IDs and root IDs are used accordingly (now that they are no longer equivalent). 5) Changed some validation methods to accept Null IDs to avoid large changes in the test code. BUG=438313 Review URL: https://codereview.chromium.org/805633004 Cr-Commit-Position: refs/heads/master@{#309495}
* Standardize usage of virtual/override/final specifiers in sync/.dcheng2014-12-2211-43/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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}
* [Sync] Enforce child-to-parent deletion order with more than max entrieszea2014-12-092-4/+45
| | | | | | | | | | | | | | | | If there are more deleted items than the max number of entries in a commit (90), we were mistakenly bailing out of our top-to-bottom traversal of the deleted entries upon hitting the max. This can lead to committing parents before children. Instead, we now do the full traversal, reverse, and then truncate the list, to ensure children are always deleted before parents. BUG=439442 Review URL: https://codereview.chromium.org/786553002 Cr-Commit-Position: refs/heads/master@{#307585}
* [Sync] Fix deletion while uncommitted logiczea2014-11-171-33/+234
| | | | | | | | | | | | | If a deletion happens while a commit is in flight, we should make sure that the deletion makes it to the server. Previously we were over-aggressively assuming that the entity was unknown by the server and therefore the deletion was unnecessary. BUG=426865 Review URL: https://codereview.chromium.org/729523003 Cr-Commit-Position: refs/heads/master@{#304462}
* 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