summaryrefslogtreecommitdiffstats
path: root/sync
Commit message (Collapse)AuthorAgeFilesLines
* sync: Move data_encryption_win.h into syncer namespace.tfarina@chromium.org2012-11-253-24/+18
| | | | | | | | | R=akalin@chromium.org TBR=dhollowa@chromium.org # for autofill Review URL: https://chromiumcodereview.appspot.com/11421047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169392 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Retry soon when server returns conflictrlarocque@chromium.org2012-11-215-17/+25
| | | | | | | | | | | | | | | | | | | | | | | When the server gives us a conflict response, we ought to fetch updates in order to figure out what the server is complaining about, resolve any conflicts locally, then re-commit. The current syncer, although not intentionally built to handle this scenario, does the right thing. It considers the server's return code to be indicative of a transient error, so it backs off then retries later. The retry sync cycle will fetch updates, resolve conflicts, and recommit, which is exactly what we want. Unfortunately, the backoff can take five minutes. This commit reduces the time spent unnecessarily backing off. It's not the cleanest solution, but its implementation is easy and safe. BUG=157955 Review URL: https://chromiumcodereview.appspot.com/11411041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169158 0039d316-1c4b-4281-b951-d872f2087c98
* Remove unregistered IDs from the invalidation state map cache.dcheng@chromium.org2012-11-216-3/+50
| | | | | | | | | BUG=161754 Review URL: https://chromiumcodereview.appspot.com/11316079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169113 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add debug info proto conversionzea@chromium.org2012-11-215-3/+99
| | | | | | | | | | | | This allows us to see the debug info we send up to the server as part of the traffic recorder's events. BUG=158576 Review URL: https://chromiumcodereview.appspot.com/11348144 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169103 0039d316-1c4b-4281-b951-d872f2087c98
* [base] Move AutoReset to base namespace.dbeam@chromium.org2012-11-211-2/+2
| | | | | | | | | | | NOTRY=true R=darin@chromium.org BUG=None Review URL: https://chromiumcodereview.appspot.com/11308132 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168978 0039d316-1c4b-4281-b951-d872f2087c98
* Sync: Add DeviceInfo's ChangeProcessorrlarocque@chromium.org2012-11-2116-32/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the long-awaited change to enable DeviceInfo tracking. Long ago (r161496) we committed code to support the DeviceInfo type, but we had to leave this code disabled until the server was ready to support the new type. That support has now been added. This change includes a very special kind of ChangeProcessor named SyncedDeviceTracker. It is the only ChangeProcessor that is owned by the sync thread. The SyncBackendHost creates and initializes it during backend intialization and deletes it before the UserShare it references is destroyed. As part of its initialization, the SyncedDeviceTracker will update the DeviceInfo entry for the current device. The SyncedDeviceTracker could support sending notifications to any interested listeners when new or update DeviceInfo information arrives, but this functionality has not been implemented yet. Also included are: - Tests for the SyncedDeviceTracker - A MockTransactionObserver to support these tests - A cache_guid() accessor on the SyncManager, used to initialize the SyncedDeviceTracker - Remove support for default constructing a DeviceInfo object BUG=122825 Review URL: https://chromiumcodereview.appspot.com/11360259 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168972 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Have MergeDataAndStartSyncing return a SyncMergeResultzea@chromium.org2012-11-175-10/+13
| | | | | | | | | | | | This will allow us to track merge statistics for datatypes. For now none of the datatypes fill the SyncMergeResult with anything other than an error. BUG=158576 TBR=stevet@chromium.org Review URL: https://chromiumcodereview.appspot.com/11365241 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168446 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Re-enable experiments datatypezea@chromium.org2012-11-172-6/+3
| | | | | | | | | | | It was disabled while a server bug was fixed. The fix has now rolled out. BUG=None Review URL: https://chromiumcodereview.appspot.com/11412057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168431 0039d316-1c4b-4281-b951-d872f2087c98
* Move scoped_temp_dir from base to base/filesbrettw@chromium.org2012-11-164-13/+13
| | | | | | | | | | Also add to base namespace. BUG= Review URL: https://codereview.chromium.org/11359217 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168281 0039d316-1c4b-4281-b951-d872f2087c98
* Added directory entry counters to about:syncvishwath@google.com2012-11-1510-10/+91
| | | | | | | | | | | | | | Added counters that show the following information on a per ModelType basis - Total Entries Live Entries The information is propagated via TakeSnapshot(). BUG=151669 Review URL: https://chromiumcodereview.appspot.com/10993030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168001 0039d316-1c4b-4281-b951-d872f2087c98
* Remove various DoNothing functions in favor of base::DoNothingakalin@chromium.org2012-11-152-11/+4
| | | | | | | | | BUG= TBR=yoz@chromium.org,rkc@chromium.org,sergeyu@chromium.org Review URL: https://chromiumcodereview.appspot.com/11361269 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167876 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Track sync merge results during bookmark associationzea@chromium.org2012-11-154-1/+110
| | | | | | | | | | | | | | | | This also introduces a new GetTotalNodeCount method in BaseNode, which will be useful when adding merge results for other types. In general, bookmark model association never modifies a sync bookmark, never deletes local or sync bookmarks, and always modifies any pre-existing local bookmark that has a corresponding sync bookmark. BUG=158576 Review URL: https://chromiumcodereview.appspot.com/11377090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167831 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add support for remotely enabling keystore encryptionzea@chromium.org2012-11-152-5/+23
| | | | | | | | | | | | | We hook up logic to the keystore_encryption experiment to enable the keystore encryption logic. Once the experiment is received, on the next client restart sync will start using the keystore encryption logic. BUG=129665 Review URL: https://chromiumcodereview.appspot.com/11266045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167829 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Update calls from RunAllPending() to RunUntilIdle().tfarina@chromium.org2012-11-1413-21/+21
| | | | | | | | | | | | RunAllPending() is deprecated and we should switch to RunUntilIdle(). BUG=131220 TBR=akalin@chromium.org Review URL: https://chromiumcodereview.appspot.com/11275305 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167651 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Update ChipBag protozea@chromium.org2012-11-141-2/+17
| | | | | | | | | | | Add an optional bytes server_chips field to represent the opaque server data. BUG=None Review URL: https://chromiumcodereview.appspot.com/11361234 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167586 0039d316-1c4b-4281-b951-d872f2087c98
* [sync] Componentize sync: Part 1: Clean up sync.gyp and update chrome / test ↵rsimha@chromium.org2012-11-141-126/+160
| | | | | | | | | | | | | | | | | | | | | | | | dependencies One of the long term goals of the sync team is to pull sync code out of chrome.dll and into its own component. As of today, several chrome tests depend on various sync targets as defined in sync.gyp. This is the first in a series of CLs to achieve the above goal. This patch does the following: - Renames / reorganizes several of the targets in sync.gyp - Updates the declarations in various chrome gyp files by depending on the smallest sync target possible to reflect the actual dependency. - Takes a step closer toward the ideal IWYU guideline. TBR=erikwright@chromium.org BUG=136928 TEST=all chrome targets build on all platforms; all tests pass. Review URL: https://chromiumcodereview.appspot.com/11348052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167558 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Disable experiments datatype temporarilyzea@chromium.org2012-11-142-3/+6
| | | | | | | | | | | A server bug currently means enabling this datatype results in unrecoverable errors. Disable it temporarily. BUG=None Review URL: https://codereview.chromium.org/11366231 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167530 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add datatype controller support for tracking association statszea@chromium.org2012-11-144-1/+231
| | | | | | | | | | | | | | | | | | | | | | SyncMergeResult is a new class that allows datatypes and sync itself to record association information for later use by the debug info listener. We introduce the class and add some plumbing at the DTC level to pass these on to the model association manager (and from there to the debug listener). Similarly, to track syncer changes, we pass a SyncMergeResult weak pointer to the SharedChangeProcessor, which while it's valid will increment the deltas as changes arrive (in a future patch). The weak pointer is invalidated at the end of association by the DTC. To simplify the DTC plumbing of merge results, StartFailed has been merged into StartDone. Additionally, removed some old logging code attempting to identify which datatype was being Stopped that isn't necessary anymore. BUG=158576 Review URL: https://chromiumcodereview.appspot.com/11401002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167528 0039d316-1c4b-4281-b951-d872f2087c98
* Bring up minimal sync and sync unittest targets on iOS.blundell@chromium.org2012-11-134-2/+65
| | | | | | | | | | | | The sync implementation is not yet complete (e.g., there is not yet an invalidator_factory implementation on iOS), but enough of the structure is in place to allow for the sync target to build and a reduced set of unittests to run successfully. Review URL: https://chromiumcodereview.appspot.com/11360194 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167485 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add application logic for non-nigori control types (reland)zea@chromium.org2012-11-138-58/+205
| | | | | | | | | | | | Relanding after revert. Original codereview at https://chromiumcodereview.appspot.com/11271009/. BUG=122825 TBR=rlarcoque@chromium.org, akalin@chromium.org Review URL: https://codereview.chromium.org/11361242 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167466 0039d316-1c4b-4281-b951-d872f2087c98
* Reland 167337 - Move url_request_test_util into net namespacejochen@chromium.org2012-11-135-15/+16
| | | | | | | | | | | | | | | This file contains some rather generic names like "TestDelegate". Move it to the net namespace to avoid collisions BUG=none TBR=wtc@chromium.org,darin@chromium.org Original Review URL: https://codereview.chromium.org/11369179 Review URL: https://chromiumcodereview.appspot.com/11365227 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167413 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 167337 - Move url_request_test_util into net namespacejochen@chromium.org2012-11-135-16/+15
| | | | | | | | | | | | | | | This file contains some rather generic names like "TestDelegate". Move it to the net namespace to avoid collisions BUG=none TBR=darin@chromium.org Review URL: https://codereview.chromium.org/11369179 TBR=jochen@chromium.org Review URL: https://codereview.chromium.org/11410066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167356 0039d316-1c4b-4281-b951-d872f2087c98
* Move url_request_test_util into net namespacejochen@chromium.org2012-11-135-15/+16
| | | | | | | | | | | | This file contains some rather generic names like "TestDelegate". Move it to the net namespace to avoid collisions BUG=none TBR=darin@chromium.org Review URL: https://codereview.chromium.org/11369179 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167337 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 167280 - [Sync] Add application logic for non-nigori control types.zea@chromium.org2012-11-138-204/+58
| | | | | | | | | | | | | | | | | | | | | We introduce logic to apply non-nigori control types. First, we iterate over any new top level datatype entities, applying those. Then we go through the rest of the unapplied control datatype updates, applying those. Any conflict should be just a simple conflict, which we handle by ignoring the local changes. Also updates chromiumsync.py to support the new control types (and fixes the parent folder pattern that was in use). BUG=122825 Review URL: https://chromiumcodereview.appspot.com/11271009 TBR=zea@chromium.org Review URL: https://codereview.chromium.org/11359175 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167282 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add application logic for non-nigori control types.zea@chromium.org2012-11-138-58/+204
| | | | | | | | | | | | | | | | | | We introduce logic to apply non-nigori control types. First, we iterate over any new top level datatype entities, applying those. Then we go through the rest of the unapplied control datatype updates, applying those. Any conflict should be just a simple conflict, which we handle by ignoring the local changes. Also updates chromiumsync.py to support the new control types (and fixes the parent folder pattern that was in use). BUG=122825 Review URL: https://chromiumcodereview.appspot.com/11271009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167280 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Linux: change protobuf default option to allow building"nyquist@chromium.org2012-11-1224-0/+72
| | | | | | | | | | | | | | | | | This reverts commit baefae90f294a981c973bffbdd3eccabfe796b6a. The change broke Chrome for Android because non-vanilla protobuf-lite Java files were generated. Original review: https://codereview.chromium.org/11228038/ TBR=phajdan.jr BUG=160256 Review URL: https://codereview.chromium.org/11359146 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167242 0039d316-1c4b-4281-b951-d872f2087c98
* Populate versions on individual nodes in sync model and native bookmark model.haitaol@chromium.org2012-11-1017-73/+318
| | | | | | | | | | | | | | | | Update transaction versions of changed sync models and entries in syncable::WriteTransaction after change delegate calculates changes and returns handles of changed entries. For syncer changes, updated version is passed to change processor and set on native model and nodes. For sync API changes, model processor queries for new version and set on native model and nodes after write transaction closes. BUG=154858 Review URL: https://chromiumcodereview.appspot.com/11341048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167061 0039d316-1c4b-4281-b951-d872f2087c98
* Implement a class to manage backoff timers for local invalidation reminders.dcheng@chromium.org2012-11-095-0/+695
| | | | | | | | | BUG=124149 Review URL: https://chromiumcodereview.appspot.com/11298002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166854 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Introduce DataTypeDebugListener and add plumbing to the DataTypeManagerzea@chromium.org2012-11-0814-16/+213
| | | | | | | | | | | | | | | | The DataTypeDebugListener is an interface that allows glue components to pass sync debug info to the sync debug event listener, which lives in the sync internals on the sync thread. To do this we pass a WeakHandle at initialization time all the way through to the PSS, which then uses it to create the DataTypeManager. Follow up patches will plumb DTC results to the DataTypeDebugListener. BUG=158576 Review URL: https://chromiumcodereview.appspot.com/11365116 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166616 0039d316-1c4b-4281-b951-d872f2087c98
* Linux: change protobuf default option to allow buildingphajdan.jr@chromium.org2012-11-0724-72/+0
| | | | | | | | | | | | | | | | | | with unpatched system protobuf. This is a preparation for landing https://codereview.chromium.org/11231046/ and a solution chosen because our custom protobuf changes will not be accepted upstream. Setting defaults to optimize for lite runtime and retain unknown fields makes it possible to use the same .proto files with system protobuf. BUG=157155 TEST=none Review URL: https://codereview.chromium.org/11228038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166534 0039d316-1c4b-4281-b951-d872f2087c98
* Provide mutable members of UrlRequestContext via pure-virtual interface. ↵pauljensen@chromium.org2012-11-072-13/+10
| | | | | | | | | | Create a pure-virtual interface called HttpUserAgentSettings that provides access to the Accept-Language, Accept-Charset, and User-Agent HTTP headers. Each UrlRequestContext should have a HttpUserAgentSettings implementation attached via set_http_user_agent_settings(). BUG=146596 Review URL: https://chromiumcodereview.appspot.com/10918279 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166425 0039d316-1c4b-4281-b951-d872f2087c98
* sync: fix for bug 158313, which is a top crash on canary.tim@chromium.org2012-11-063-0/+43
| | | | | | | | | | | | | | | | If a nudge is scheduled after a connection change canary, an abandoned job may wind up in DoCanaryJob. Since the job knows by design if it's in this state, this patch adds a defensive check in DoCanaryJob to check (similar to the one in DoSyncSessionJob). We should be able to remove the CreateSyncSession code that actually tries to use the job before calling DoSyncSessionJob, though. BUG=158313 Review URL: https://chromiumcodereview.appspot.com/11366079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166215 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add datatype association stats to client debug info proto.zea@chromium.org2012-11-064-19/+52
| | | | | | | | | | | | We now track when datatypes associate, which datatypes associate, and what the association results are. BUG=158576 Review URL: https://chromiumcodereview.appspot.com/11359067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166152 0039d316-1c4b-4281-b951-d872f2087c98
* [sync] Upstream Android connection observer for sync.nyquist@chromium.org2012-11-052-20/+37
| | | | | | | | | | | | | Android has framework support for online state changes. This pings adds support in sync to receive such notifications. BUG=139259, 106034 TEST=Verify that online state change detection works on Android builds. Review URL: https://chromiumcodereview.appspot.com/10829050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165992 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Follow-up to conflict resolution refactorrlarocque@chromium.org2012-11-0135-427/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is part two of r164286. That commit refactored the way we handle conflict resolution. This commit takes advantage of those changes to delete lots of code. Because this change deletes session_state.cc, I decided to move the two remaining useful tests session_state_unittest.cc into their own files, sync_session_snapshot_unittest.cc and sync_source_info_unittest.cc. The tests were not modified in any way. None of these changes should have any effect on syncer behaviour: - We can remove the simple conflict counters and related code, since we now assert that all conflicts will be resolved by the end of a successful sync cycle. - We can remove the PerModelSafeGroupState because that struct no longer has any members. - The 'conflicts_resolved' indicators are no longer set, so we can remove them. - Without those indicators, it's no longer possible to have any SYNC_CYCLE_CONTINUATION sync cycles. We can remove a few counters associated with them, as well as the 'has_more_to_sync' flag in the snapshot. - Without SYNC_CYCLE_CONTINUATION cycles, there's no longer any need for code that loops around SyncShare() in SyncSchedulerImpl. The SyncSession::PrepareForAnotherSyncCycle() function is no longer used, either. - The ScopedConflictResolver installed on the session during a sync cycle is no longer used, so all the code related to it can be deleted. BUG=147681,111280,156238 Review URL: https://chromiumcodereview.appspot.com/11314008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165474 0039d316-1c4b-4281-b951-d872f2087c98
* sync: add kInitialBackoffImmediateRetry tim@chromium.org2012-11-015-11/+19
| | | | | | | | | | | | | | | | | | | | | | The primary impact this has is speeding up some integration tests by ~ 50%. In particular it lets us re-enable MigrationHell, which is currently disabled as it takes too long for sharding_supervisor. Rationale is discussed in the bug, I believe this is safe for the class of errors we target with the immediate delay, because we don't need backoff. (Note that when used with GetDelay, this still results in a 1s minimum backoff.) kInitialBackoffShortRetry is still used if the command line flag is passed (and in integration tests) to change the default initial backoff from 5 minutes to 1s (as it used to be). BUG=143641 Review URL: https://chromiumcodereview.appspot.com/11183073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165312 0039d316-1c4b-4281-b951-d872f2087c98
* sync: reland scheduler ownership refactoring, now with less crashtim@chromium.org2012-10-3023-567/+1126
| | | | | | | | | | | | | Prevent abandoned jobs from entering DoCanaryJob by stopping the timer in TakePendingJobForCurrentMode. Original review at https://codereview.chromium.org/10917234/ BUG=158313 Review URL: https://chromiumcodereview.appspot.com/11341030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164992 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 164565 - sync: make scheduling logic and job ownership more obvious.dharani@google.com2012-10-2923-1092/+567
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert Reason - see bug 158313 - inlines (and removes) SaveJob, to perform only the relevant "saving" bits where needed. As it turns out, most of it was only necessary for ShouldRunJob (which I'd like to rename, as it's destructive), and it's a lot easier to read what's happening and why. Note also removed TODO at SaveJob callsites. - inlines (and removes) InitOrCoalescePendingJob to perform only the relevant bits at each callsite. - pulls SyncSessionJob into a class, to handle basic responsibilities that need the job Purpose + session (like "Succeeded()" and "Finish") that were previously strewn about and partially copy/pasted in the scheduler. - meticulously transfers ownership (removes linked_ptr usage!) of jobs instead of making many implicit struct copies, as it resulted in non-obvious behavior. To do this, ownership is given to the scheduling mechanism (the MessageLoop for ScheduleSyncSessionJob, WaitInterval::timer for canary jobs), instead of jobs sitting around without knowing whether they're scheduled or not. There are a few cases where we can't actually "schedule" a job -- which wasn't even obvious from the old code, and other interesting revelations, like fact that we were actually pre-empt nudge canary jobs and "unscheduling" them in certain cases. - removes DoPendingJobIfPossible, since it is no longer needed for DoCanaryJob/Unthrottle cases, and make the behavior more explicit in the other cases (mode-switch and SCM error change), see TakePendingJobForCurrentMode. - removes the ability to create jobs as canary, since this wasn't needed and was adding complexity (see DoCanaryJob / GrantCanaryPrivilege). - removes retry_scheduled as it wasn't used anywhere - adds lots of comments. Also discovered that THROTTLED intervals seem to never fire a canary job with today's code (broken), config jobs are immune to per-data-type throttling, and the had_nudge allowance was defeated by extra IsBackingOff check in ScheduleNudgeImpl (see comment on review). BUG= Review URL: https://chromiumcodereview.appspot.com/10917234 TBR=tim@chromium.org Review URL: https://codereview.chromium.org/11347027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164780 0039d316-1c4b-4281-b951-d872f2087c98
* sync: make scheduling logic and job ownership more obvious. tim@chromium.org2012-10-2823-567/+1092
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - inlines (and removes) SaveJob, to perform only the relevant "saving" bits where needed. As it turns out, most of it was only necessary for ShouldRunJob (which I'd like to rename, as it's destructive), and it's a lot easier to read what's happening and why. Note also removed TODO at SaveJob callsites. - inlines (and removes) InitOrCoalescePendingJob to perform only the relevant bits at each callsite. - pulls SyncSessionJob into a class, to handle basic responsibilities that need the job Purpose + session (like "Succeeded()" and "Finish") that were previously strewn about and partially copy/pasted in the scheduler. - meticulously transfers ownership (removes linked_ptr usage!) of jobs instead of making many implicit struct copies, as it resulted in non-obvious behavior. To do this, ownership is given to the scheduling mechanism (the MessageLoop for ScheduleSyncSessionJob, WaitInterval::timer for canary jobs), instead of jobs sitting around without knowing whether they're scheduled or not. There are a few cases where we can't actually "schedule" a job -- which wasn't even obvious from the old code, and other interesting revelations, like fact that we were actually pre-empt nudge canary jobs and "unscheduling" them in certain cases. - removes DoPendingJobIfPossible, since it is no longer needed for DoCanaryJob/Unthrottle cases, and make the behavior more explicit in the other cases (mode-switch and SCM error change), see TakePendingJobForCurrentMode. - removes the ability to create jobs as canary, since this wasn't needed and was adding complexity (see DoCanaryJob / GrantCanaryPrivilege). - removes retry_scheduled as it wasn't used anywhere - adds lots of comments. Also discovered that THROTTLED intervals seem to never fire a canary job with today's code (broken), config jobs are immune to per-data-type throttling, and the had_nudge allowance was defeated by extra IsBackingOff check in ScheduleNudgeImpl (see comment on review). BUG= Review URL: https://chromiumcodereview.appspot.com/10917234 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164565 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Merge apply updates and resolve conflictsrlarocque@chromium.org2012-10-2622-458/+306
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The conflict resolution code was executed after the commit for reasons which no longer apply. Because we no longer have to worry about resolving hierarchy conflicts or nigori node conflicts, we have the opportunity to move conflict resolution closer to update application. One advantage of resolving conflicts early is that we no longer require an extra sync cycle to commit any 'local wins' conflict resolutions. This makes SYNC_CYCLE_CONTINUATION sync cycles obsolete. Another advantage is that update application and conflict resolution can be performed without releasing the sync lock, which eliminates several types of races that we used to have to worry about. It's probably more efficient, too. It allows us to guarantee that there are no simple conflicts remaining after the update application step is completed. The effects might not be very noticeable to end users, but it will be nice to remove some of the conflict tracking code. Finally, it removes the last use PerModelSafeGroupState. This will let us delete some unused code and hopefully simplify StatusController. This patch does not pursue these cleanups as agressively as it could. The idea here is to keep the complex logic changes in one small CL, and perform the cleanups in a larger, but simpler, follow-up CL. BUG=147681,11280,156238 Review URL: https://chromiumcodereview.appspot.com/11192071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164286 0039d316-1c4b-4281-b951-d872f2087c98
* Transaction version is used to detect out-of-sync between sync model and ↵haitaol@chromium.org2012-10-269-1/+75
| | | | | | | | | | | native model. The values in sync model and native model should be equal. If not, there're some changes that are applied in one but not the other. This change updates the transaction version of a model type in sync when changes to its native model are found. And implement native transaction version for bookmark model. BUG=154858 Review URL: https://chromiumcodereview.appspot.com/11028146 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164263 0039d316-1c4b-4281-b951-d872f2087c98
* sync: wrap conflict_utils in a namespacetim@chromium.org2012-10-254-6/+12
| | | | | | | | | | | This makes it easier to hunt down function definitions and matches file hierarchy as suggested by the style guide. BUG= Review URL: https://chromiumcodereview.appspot.com/11238043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163992 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add CANNOT_DO_WORK to SyncerErrorakalin@chromium.org2012-10-242-1/+3
| | | | | | | | | | Use it when ModelSafeWorkers cannot process tasks. BUG=109422 Review URL: https://codereview.chromium.org/11238048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163784 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Fix undelete conflict resolutionzea@chromium.org2012-10-232-30/+15
| | | | | | | | | | | | | | | | | | Previously we were recreating bookmarks when undeleting, and resetting the version of non-bookmarks. Neither of these are necessary. We now reuse the current version (so the server knows we are the most up to date versin) and no longer re-creae bookmarks (because we reuse the existing id, the write is treated as a modify, not a create). BUG=154884 TEST=with three signed in clients A, B, C, delete a bookmark on A. On B and C, before they recieve the notification, modify that same bookmark. Ensure no duplicates are created. Review URL: https://chromiumcodereview.appspot.com/11204002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163451 0039d316-1c4b-4281-b951-d872f2087c98
* Add experiment for history delete directives.albertb@chromium.org2012-10-221-0/+6
| | | | | | | | | | R=zea BUG=none Review URL: https://chromiumcodereview.appspot.com/11237006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163425 0039d316-1c4b-4281-b951-d872f2087c98
* [net] Change factory methods for HostResolver and HostCache to return a ↵szym@chromium.org2012-10-222-8/+2
| | | | | | | | | | | | scoped_ptr. Move HostResolver factory methods to host_resolver.cc. This also fixes a double-free in ShellURLRequestContextGetter. Review URL: https://chromiumcodereview.appspot.com/10831277 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163402 0039d316-1c4b-4281-b951-d872f2087c98
* Add the InvalidationState struct to bundle local state about invalidations.dcheng@chromium.org2012-10-1916-53/+56
| | | | | | | | | | | Currently this only has one member, but I anticipate adding several more as we add support for local acknowledgements. BUG=124149 Review URL: https://codereview.chromium.org/11229015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163077 0039d316-1c4b-4281-b951-d872f2087c98
* Remove all the "set noparent" directivesdpranke@chromium.org2012-10-191-1/+0
| | | | | | | | | | | | | Now that OWNERS supports per-file owners, we can limit the scope of the top-level wildcard to just DEPS, and make darin and ben owners for everything else and remove the broad use of "set noparent". R=ben@chromium.org, darin@chromium.org BUG=88315 Review URL: https://codereview.chromium.org/11191038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163069 0039d316-1c4b-4281-b951-d872f2087c98
* Initial support for the 'Experiments' data typerlarocque@chromium.org2012-10-1914-18/+127
| | | | | | | | | | | | | | | | | | | | | | This internal sync type will track flags that enable or disable experimental features. This commit includes the protobuf definitions and other infrastructure required to support the type. It also includes some support for one experimental flag that will be used to enable or disable encryption. The code to actually inspect the flag and take action on its value will be included in a later commit. The type is not actually enabled in this patch because the server does not yet support it. Once server support is available, a small follow-up commit will be required to enable the feature. BUG=122825 Review URL: https://chromiumcodereview.appspot.com/11144024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162874 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add comment pointing to detailed info for PageTransition enumsakalin@chromium.org2012-10-181-0/+4
| | | | | | | | | BUG= Review URL: https://chromiumcodereview.appspot.com/11184035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162629 0039d316-1c4b-4281-b951-d872f2087c98