summaryrefslogtreecommitdiffstats
path: root/sync/engine
Commit message (Collapse)AuthorAgeFilesLines
* sync: Remove use of ALLOW_THIS_IN_INITIALIZER_LIST.scherkus@chromium.org2013-04-272-3/+3
| | | | | | | | | | It's no longer providing value as the MSVC warning is disabled during compilation. Refer to bug for details. BUG=234765 Review URL: https://chromiumcodereview.appspot.com/14335008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196892 0039d316-1c4b-4281-b951-d872f2087c98
* Sync: Turn DCHECK into a warning.dubroy@chromium.org2013-04-181-2/+2
| | | | | | | | | | | | This DCHECK is frequently encountered when full history sync is enabled, and since the case appears to be properly handled, it shouldn't be a DCHECK anyways. BUG=229901 Review URL: https://codereview.chromium.org/14229002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194856 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Finish the SyncScheduler refactorrlarocque@chromium.org2013-04-188-1034/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change removes SyncSessionJob entirely. The first step towards this goal was to refactor all functions that depended on SyncSessionJob. All these functions have either been inlined or modified to take different parameters instead. DoSyncSessionJob was split into two separate functions, one for configure jobs and one for nudge jobs, which removes the need for SyncSessionJob's "purpose" member. The SyncScheduler's pending_configure_job_ has been replaced with a ConfigParams member, since that was the only part of the job still being referenced. The pending_nudge_job_ has been replaced with scheduled_nudge_time_ (which is similar to the old scheduled_start_ member of SyncSessionJob) and a new object called a NudgeTracker. The NudgeTracker inherits the SyncSessionJob's responsibilities with respect to coalescing nudge sources. The plan is to extend this class to support more sophisticated nudge coalescing in the future. For now it tries to emulate the old SyncSessionJob behaviour as closely as possible. Some of the refactoring does change behaviour. In particular, the decision-making logic has been updated to fix issues 179515 and 155296. BUG=175024,179515,155296 Review URL: https://chromiumcodereview.appspot.com/13743003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194766 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Prevent redundant sync title changeszea@chromium.org2013-04-151-0/+3
| | | | | | | | | | | | | Title truncation is now performed in the WriteNode, before we do the idempotency checks. By fixing this and an issue in the favicon cache that was leading to automatic rewrites we should significantly reduce the number of useless sync cycles. BUG=229658 Review URL: https://codereview.chromium.org/13953003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194243 0039d316-1c4b-4281-b951-d872f2087c98
* Add a space between string literals and PRIuSstuartmorgan@chromium.org2013-04-101-4/+4
| | | | | | | | | | | | | This is required to build on iOS (with the Xcode 4.6 toolchain) in C++11 mode, to avoid the error: "invalid suffix on literal; C++11 requires a space between literal and identifier" BUG=226494 Review URL: https://chromiumcodereview.appspot.com/13721002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193361 0039d316-1c4b-4281-b951-d872f2087c98
* Rewrite std::string("") to std::string(), Linux edition.dcheng@chromium.org2013-04-092-8/+10
| | | | | | | | | | | | | | | | | | | This patch was generated by running the empty_string clang tool across the Chromium Linux compilation database. Implicitly or explicitly constructing std::string() with a "" argument is inefficient as the caller needs to emit extra instructions to pass an argument, and the constructor needlessly copies a byte into internal storage. Rewriting these instances to simply call the default constructor appears to save ~14-18 kilobytes on an optimized release build. BUG=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=193020 Review URL: https://codereview.chromium.org/13145003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193040 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Rewrite std::string("") to std::string(), Linux edition."dcheng@chromium.org2013-04-092-10/+8
| | | | | | | | | | | | | | This reverts commit e59558b78e8c6a1b0bd916a724724b638c3c91b6. Revert "Fix build after r193020." This reverts commit 558a35897f6b3ffbcaefde927c1f150b815d140a. Revert "Really fix build after r193020." This reverts commit e3748a79b523a8d365d4a33ef986eebb4186fa78. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193030 0039d316-1c4b-4281-b951-d872f2087c98
* Rewrite std::string("") to std::string(), Linux edition.dcheng@chromium.org2013-04-092-8/+10
| | | | | | | | | | | | | | | | | This patch was generated by running the empty_string clang tool across the Chromium Linux compilation database. Implicitly or explicitly constructing std::string() with a "" argument is inefficient as the caller needs to emit extra instructions to pass an argument, and the constructor needlessly copies a byte into internal storage. Rewriting these instances to simply call the default constructor appears to save ~14-18 kilobytes on an optimized release build. BUG=none Review URL: https://codereview.chromium.org/13145003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193020 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Refactor job ownership in SyncSchedulerrlarocque@chromium.org2013-04-067-478/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change separates the tracking of what work needs to be done from the decision of when to do it. Prior to this change, SyncSessionJobs were owned either by Closures posted to the sync thread's message loop, or held temporarily in unscheduled_nudge_storage_, a member of the SyncScheduler. Following this change, there can be only two jobs in existence, and they will be referenced only by the scoped_ptr members of SyncScheduler named pending_nudge_job_ and pending_configure_job_. This change, along with some previous changes to the way we schedule tasks, makes it possible to simplify the job "saving" logic. Jobs with purpose == NUDGE are saved by assigning them to pending_nudge_job_ or coalescing them with the existing pending_nudge_job_. Jobs with purpose == CONFIGURE are never coalesced, and can be saved in the pending_configure_job_ member. These changes allow us to make SyncSessionJob::Clone() obsolete. The logic in ScheduleNudgeImpl() has been updated to take advantage of the fact that the pending job is much easier to find now. It should now be much better at coalescing its sources. In other words, there will be less scenarios where it can drop notification hints. However, there are still some cases in DecideOnJob() that may induce it to drop hints unnecessarily. The scheduling logic has been modified, too. We've removed support for the nudge while in an exponential backoff interval. This makes it possible to track the next wakeup time using a single timer, since the wakeup event will be one of: - The end of a throttled interval - An end-of-backoff-interval retry - A scheduled nudge and these scenarios are now mutually exclusive. BUG=175024 Review URL: https://chromiumcodereview.appspot.com/13422003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192666 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Bookmark unique position end-to-end supportrlarocque@chromium.org2013-04-0215-665/+317
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change rewrites the bookmark positioning system to use absolute, arbitrary-precision, unique positions from end-to-end. First, it introduces the concept of a UNIQUE_BOOKMARK_TAG. This has a similar format to the UNIQUE_CLIENT_TAG, though bookmarks have never supported unique tags previously. For new items, it is initialized based on the bookmark's originator client item ID (ie. the "c-" style ID) and the originator's cache_guid. These values should be globally unique. Many previously created items that exist in the database do not have this information available. Non-committed items will still have this information, and will have their tags set correctly. Previously committed items will have server style IDs and no hint as to what the originator_cache_guid is. In that common case, we will initialize the tag with a "fake" one based solely on the server ID. This has the advantage of being something that all existing clients will agree on, even it if new clients and updated items/the server will disagree with them. To bring everyone back into sync, whenever they receive an update clients will access the included originator_cache_guid and originator_client_item_id fields and reset the UNIQUE_BOOKMARK_TAG field according to the values they find there. Over time, clients should converge towards the same tag values. Next, this change adds the UNIQUE_POSITION and SERVER_UNIQUE_POSITION fields to each entry. See the UniquePosition class documentation for more information on their behaviour. New items should have their local position updated when they are first inserted into the list, which should happen shortly after they are initialized. Existing items will have these fields populated from the SERVER_ORDINAL_IN_PARENT field and the genrated UNIQUE_BOOKMARK_TAG. Unfortunately, all outstanding local changes will be lost during the migration. With the addition of UNIQUE_POSITION fields comes the removal of the PREV_ID and NEXT_ID fields. This required significant refactoring of the Directory so it could continue to support the PutPredecessor(), GetPredecessorId(), GetSuccessorId() and GetFirstChildId() functions. A new class, ParentChildIndex, has been introduced to contain some of the complexity introduced by the new system. See that class' documentation for more information. Communication with the server has also been affected by this change. The client will now set the unique_position field on every update. It will also set the legacy server_position_in_parent field with a value derrived from a truncation of its local UNIQUE_POSITION. This replaces the existing server position in parent calculation through interpolation. The receipt of updates has been changed as well. If the client receives an update with a unique_position, it will apply it. If the update was written by an older client, it will contain only the server_position_in_parent. In that case, the client will use that position and the unique tag derrived from the update to construct a unique position that approximates the server_position_in_parent value. This will work well if the clients have not exceeded the available precision in an int64. Otherwise, some spurious re-positioning may occur. Finally, all these changes required some updates to the tests. Some arbitrary position assertions had to be updated, since the arbitrary ordering has changed. Some test helpers have been updated to no longer automatically place bookmarks at the end of the list; that logic has been moved to the tests themselves. BUG=145412, 126505, 147715, 101852, 107744, 112203, 123429, 177521, 20011 Review URL: https://chromiumcodereview.appspot.com/11885024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191767 0039d316-1c4b-4281-b951-d872f2087c98
* Move MessageLoop to base namespace.brettw@chromium.org2013-03-312-3/+1
| | | | | | | | | | This adds a "using" to the header to avoid having to update everything at once. However, all forward declares and the locations that use the forward declares need to be updated (since they don't see the using in message_loop.h). BUG= Review URL: https://codereview.chromium.org/13243003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191566 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove session member from SyncSessionJobrlarocque@chromium.org2013-03-298-213/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change removes the SyncSession member of SyncSessionJob. The session had two very important responsibilities: 1. Tracking the source and notification hints for the current job. 2. Indicating whether or not a job had been abandoned. We now track the source of a job directly in SyncSessionJob. The debug_info_sources_list has been removed entirely. The investigation that triggered its addition has been put on hold for now and it is unliekly we will need this information in the future. Tracking abandoned jobs is a bit more difficult. The scheduler used to keep track of SyncSessions very carefully, since only a valid session would allow a job to actually proceed. This patch introduces a new approach for limiting the number of pending jobs. The scheduler now maintains a single scoped_ptr to a CancelableClosure. All scheduled tasks will be wrapped in a CancelableClosure that will be owned by this scoped_ptr. If a new task pre-empts an existing task, it will overwrite the scoped_ptr, which will prevent the old task from running. Therefore, only one task may be pending at any given time. This should help prevent issues like crbug.com/139723, though it also introduces new failure modes. BUG=175024 Review URL: https://chromiumcodereview.appspot.com/12942005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191458 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Handle POLL jobs in separate a code pathrlarocque@chromium.org2013-03-203-109/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | This is part of the effort to remove the amount of state we track in SyncSessionJob. We eventually want to remove SyncSessionJob's 'purpose' member. Splitting the handling of poll, configure, and nudge jobs into separate functions is a necessary step towards that goal. We're not ready to remove 'purpose' yet, but we can start by separating all the logic that deals with POLL jobs. It will be easier to refactor job decision-making, scheduling, saving, etc. if those functions don't need to support poll jobs. This change is almost, but not quite, a no-op. The only notable change is that the poll timer timeout no longer posts a task. Instead, it will run the poll job directly. A side-effect of this change was that ScheduleNextSync() was only called from one location (ScheduleNudgeImpl()), so its was merged into its only call site. BUG=175024 Review URL: https://chromiumcodereview.appspot.com/12538015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189398 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove SyncSessionJob destruction observerrlarocque@chromium.org2013-03-184-47/+9
| | | | | | | | | | | | This code was used to track down crbug.com/165561. It hasn't detected any crashes since M26 was branched. It's safe to remove it now. BUG=165561 Review URL: https://chromiumcodereview.appspot.com/12603010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188778 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Fix history implicit typeszea@chromium.org2013-03-161-0/+2
| | | | | | | | | | | | | Fixes two issues related to history delete directives. 1. Types should not be enabled by default 2. Proxy tabs information was not being sent to the server. BUG=170162 Review URL: https://chromiumcodereview.appspot.com/12875004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188521 0039d316-1c4b-4281-b951-d872f2087c98
* C++0x fix: add spaces between literals and identifiers.glider@chromium.org2013-03-151-1/+1
| | | | | | | Patch by Stuart Morgan (stuartmorgan@chromium.org) Review URL: https://codereview.chromium.org/12788006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188397 0039d316-1c4b-4281-b951-d872f2087c98
* Send client channel info to server in user-agent string.pavely@chromium.org2013-03-152-16/+0
| | | | | | | | | | | Remove unused function from ServerConnectionManager BUG=181298 Review URL: https://chromiumcodereview.appspot.com/12413021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188267 0039d316-1c4b-4281-b951-d872f2087c98
* Remove some members from SyncSessionrlarocque@chromium.org2013-03-1510-214/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is part of the effort to shrink the size of the SyncSession and SyncSessionJob. One of the members to be removed was the write transaction. This was stored in the session in order to share it among various functions that prepare a commit message. The same goal can be accomplished by passing the transaction in to the constructors of the SyncerCommands. There was one complication in this change. The new constructor meant that it was impossible to instantiate a BuildCommitCommand without a transaction, which made it somewhat harder to unit test. Making some of its methods static made it unnecessary to instantiate a BuildCommitCommand object in the test. In addition to giving us better control of the scope of the transaction, this change allows BuildCommitCommand and GetCommitIdsCommand to use a BaseTransaction rather than a WriteTransaction. The other member removed from SyncSession is the ExtensionsActivityMonitor's records. This member was used to buffer the ExtensionsActivityMonitor's records which were pending for commit and to re-add them to the monitor if the commit failed. Since it is only used within the context of a commit, it is safer and simpler to declare it on the stack in BuildAndPostCommitsImpl(). The change should have no noticeable impact on behaviour, though it does move some of the interactions with the ExtensionsActivityMonitor from the UI thread to the sync thread. This should be safe; the monitor's internal data structures are protected with a lock. The move also allows us to remove some of the code from StatusController that was used to trigger the UI-thread-specific processing. BUG=175024 Review URL: https://chromiumcodereview.appspot.com/12314103 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188266 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Fix scheduler crash on duplicate canariesrlarocque@chromium.org2013-03-152-0/+31
| | | | | | | | | | | | | | | | | | | | | | | It is possible that one canary could pre-empt another before it runs. This is a problem in configure mode, because we have no checking for abandoned configure jobs. The job would run and cause a crash. Just dropping a job in this manner is somewhat risky. Normally the job would be responsible for setting up appropriate follow-up tasks by, for example, restarting the WaitInterval or extending backoff. Dropping the job neglects these responsibilities, which means we could end up with a "stuck" scheduler. I'm mostly sure that won't happen because, in the crbug.com/190085 case, there will be another canary arriving soon that should un-stick the scheduler, but it's possible that I have missed an edge case. In any case, the new behaviour is probably better than the old, which was to crash the program. BUG=190085 Review URL: https://chromiumcodereview.appspot.com/12432020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188254 0039d316-1c4b-4281-b951-d872f2087c98
* Remove canary member from SyncSessionJobrlarocque@chromium.org2013-03-056-56/+44
| | | | | | | | | | | | | This commit removes the 'canary' flag from the SyncSessionJob. This makes the code a bit simpler, and makes it slightly more difficult to create bugs that would schedule too many canary jobs. BUG=175024 Review URL: https://chromiumcodereview.appspot.com/12317104 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186263 0039d316-1c4b-4281-b951-d872f2087c98
* Remove connection_code_ from SyncSchedulerImpl.pavely@chromium.org2013-03-055-59/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | Removed connection_code_ from SyncSchedulerImpl since it essentially mirrors ServerConnectionManager::server_status_. One behavior changed as result of this change: Previously if SyncSchedulerImpl::OnConnectionStatusChange was called when connection_code_ is CONNECTION_UNAVAILABLE it would reset connection_code_ to SERVER_CONNECTION_OK and consecutive calls to SyncSchedulerImpl::OnConnectionStatusChange would not post canary job until current one is finished and updates server_status_. With this change it is no longer true. Also moved notification about auth error from SyncManagerImpl::OnInvalidatorStateChange to common code path. It no longer makes assumption about error code that connection manager is going to set in OnInvalidationCredentialsRejected. Also removed few references to get_time. BUG=177535 Review URL: https://chromiumcodereview.appspot.com/12390070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186092 0039d316-1c4b-4281-b951-d872f2087c98
* Remove SyncSessionJob's location memberrlarocque@chromium.org2013-03-026-67/+22
| | | | | | | | | | | | | | | | Surprisingly, this has no noticeable impact. Not even our debug logs are affected. The only location where the value was accessed was in ScheduleSyncSessionJob, and we can achieve the same effect by passing the location to that function directly. The only change is that the poll jobs are now reported as being scheduled from a location two lines later than previously. BUG=175024 Review URL: https://chromiumcodereview.appspot.com/12320027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185774 0039d316-1c4b-4281-b951-d872f2087c98
* Separate invalidator and sync client ID (part 1/2)rlarocque@chromium.org2013-03-027-7/+19
| | | | | | | | | | | | | | | | | | | | | This change implements support for setting the sync client ID and invalidator client ID separately. The two IDs are managed separately and both of them are sent up to the server. This change includes some additional changes to support the transition, such as a new field in the about:sync UI. At this point, the IDs are not different. Both are initialized from the same source: the sync database. The work to store and manage the invalidator's ID separate from sync was begun in r180907 and will be finished in a separate commit. We will not be able to complete that work until the server supports separate IDs. BUG=124142 Review URL: https://chromiumcodereview.appspot.com/12256033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185721 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Drop fully datatype throttled sync jobs rather than saving them.tim@chromium.org2013-03-012-2/+3
| | | | | | | | | | | | | | This avoids a bug where we loop infinitely with calls to RestartWaiting with a zero WaitInterval length, which happens in part because we don't honour ThrottledDatatypeTracker unthrottle times and rely on seperate exponential backoff treatment. BUG=177659 Review URL: https://chromiumcodereview.appspot.com/12386012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185528 0039d316-1c4b-4281-b951-d872f2087c98
* Backoff retry time on about:sync pagepavely@chromium.org2013-02-264-0/+25
| | | | | | | | | | | | | | When scheduler is in backoff or throttled, expose time when next retry is going to happen on about:sync page. The page is not refreshed when SyncScheduler's backoff state changes therefore user might see stale value and will have to refresh page manually. BUG=168402 Review URL: https://chromiumcodereview.appspot.com/12310112 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184720 0039d316-1c4b-4281-b951-d872f2087c98
* Remove SyncSessionJob::DidReachServer() flagrlarocque@chromium.org2013-02-261-8/+4
| | | | | | | | | | | | | | | This flag was added in r140885 to address issue 131414. The problem was that SyncSessionJobs that did not contact the server would succeed and attempt to reset the backoff interval. The commits r149052 and r143088 removed the job types that do not attempt to contact the server, so we no longer need to worry about them accidentally distrupting backoff. BUG=175024 Review URL: https://chromiumcodereview.appspot.com/12320104 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184566 0039d316-1c4b-4281-b951-d872f2087c98
* Add originator_* fields to mock connection testsrlarocque@chromium.org2013-02-211-262/+428
| | | | | | | | | | | | | | | | | | | | | | | The upcoming UniquePositions patch will rely on the originator_cache_guid and originator_client_item_id fields which are sent down on the GetUpdate response. This commit updates many of the tests that use the MockServerConnectionManager to provide mock values of those fields. Their values will be ignored for now, but committing this early will make the UniquePositions patch smaller. A few of the tests involved nodes that were bookmarks and also had non-NULL unique_client_tag values. Such items do not exist outside of tests, and much of the code doesn't know how to handle them properly. To avoid having to assign origiantor_client_item_ids and originator_cache_guid values to these items (which would make them even more unrealistic), the tests were modified to use preference nodes instead of bookmarks. BUG=145412 Review URL: https://chromiumcodereview.appspot.com/12326018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183732 0039d316-1c4b-4281-b951-d872f2087c98
* Remove routing_info and workers from SyncSessionrlarocque@chromium.org2013-02-1515-76/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For all outward appearances, the SyncSession's workers and routing info will always precisely mirror those found in the SyncSessionContext. It is equivalent, and much simpler, to grab the latest routing info from the context wherever it's needed. Any SyncSession that makes it to a sync cycle will either have been initialized with the SyncSessionContext's routing info and workers, or Coalesced (set union) and Rebased (set intersection) with the SyncSessionContext's routing info and workers to the point where it's effectively equivalent to copying the context's data. Much of the logic to implement this book-keeping has been simplified in this patch. Configure mode is an important exception. While configuring, we would attempt to keep all currently enabled types enabled in the SyncSessionContext, while passing a restricted amount of routing info the the SyncSession. It turns out that it's not necessary to allow the SyncSessionContext and SyncSession routing info diverge in this case; it's OK to set the context's routing info to the restricted routes. In addition to trimming the session's routing info and workers list, RebaseRoutingInfoWithLatest was also responsible for trimming the list of notification hints to match the set of currently enabled types. This is redundant because the code in DownloadUpdatesCommand performs the same filtering using the same routing info. RebaseRoutingInfoWithLatest had no remaining useful features, so it was removed entirely. The Coalesce function still exists in a reduced form to handle merge sources between sessions. Its name and signature have been changed to reflect its new responsibilities. Without its own copy of the workers and routing info, the SyncSessionContext can no longer easily calculate the set of enabled groups. Fortunately, that information is only accessed by a single test case. The relevant code was moved into this test case. BUG=175024 Review URL: https://chromiumcodereview.appspot.com/12225091 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182756 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add support for proxy typeszea@chromium.org2013-02-083-1/+5
| | | | | | | | | | | | | Proxy types are those that have no sync representation, and are used as placeholder to implicitly enable other types. They are never communicated to the server, and have no presence in the local sync directory. BUG=170162,139726 TBR=jam@chromium.org Review URL: https://chromiumcodereview.appspot.com/11958029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181534 0039d316-1c4b-4281-b951-d872f2087c98
* sync: fix sync / xmpp auth error notification plumbingtim@chromium.org2013-02-083-9/+32
| | | | | | | | | | | | | When forging a sync auth error from an xmpp auth error, we need to also set the ServerConnectionManager's server_status code to SYNC_AUTH_ERROR so that it realizes it needs to handle a credential update later on by trying to sync again. BUG=159628,127397,171975 Review URL: https://codereview.chromium.org/12208073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181413 0039d316-1c4b-4281-b951-d872f2087c98
* Linux/ChromeOS Chromium style checker cleanup, sync/ edition.rsleevi@chromium.org2013-02-071-2/+2
| | | | | | | | | | | Automated clean up of style checker errors that were missed due to the plugin not being executed on implementation files. BUG=115047 Review URL: https://chromiumcodereview.appspot.com/12209033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181373 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Fix memory leak in TrafficRecorderTest.ToValueTimestampTestmgist@chromium.org2013-02-051-1/+4
| | | | | | | | | | | | Manage result of TrafficRecorder.ToValue() with scoped_ptr() so memory is released when out of scope. BUG=174209 Review URL: https://chromiumcodereview.appspot.com/12221006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180753 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add timestamp to TrafficRecorder records (reland)mgist@chromium.org2013-02-043-5/+101
| | | | | | | | | | | | | | | Relanding after revert. Original codereview at https://chromiumcodereview.appspot.com/12088080. Fixed issue requiring GG_INT64_C wrapper for large ints in unit test cases. BUG=161922 Review URL: https://chromiumcodereview.appspot.com/12087139 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180489 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 180073koz@chromium.org2013-02-013-101/+5
| | | | | | | | | | | | | | | | | | | | | > [Sync] Add timestamp to TrafficRecorder records > > All client server traffic records have a timestamp field to > indicate creation time of each record. Timestamps are > dumped with the traffic serializations. > > BUG=161922 > > > Review URL: https://chromiumcodereview.appspot.com/12088080 This broke the compile for Linux Builder (dbg) http://build.chromium.org/p/chromium.linux/builders/Linux%20Builder%20%28dbg%29/builds/42048/steps/compile/logs/stdio TBR=mgist@chromium.org Review URL: https://codereview.chromium.org/12090113 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180081 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add timestamp to TrafficRecorder recordsmgist@chromium.org2013-02-013-5/+101
| | | | | | | | | | | | | All client server traffic records have a timestamp field to indicate creation time of each record. Timestamps are dumped with the traffic serializations. BUG=161922 Review URL: https://chromiumcodereview.appspot.com/12088080 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180073 0039d316-1c4b-4281-b951-d872f2087c98
* Added a funtion to translate net errors in a ServerConnectionCode in sync.clamy@chromium.org2013-01-302-0/+21
| | | | | | | | | | | | | | | | | | | Presently, only the ERR_ABORTED is being translated into a CONNECTION_UNAVAILABLE error. However, on certain Android devices, the error received when having no connectivity is ERR_NAME_NOT_RESOLVED. It is classified as an IO_ERROR. The rest of sync treats CONNECTION_UNAVAILABLE and IO_ERRORS differently, with having to wait 1s before retry in one case and 750 in the other case. This can cause sync startup to fail and not retry for more than 10mn, even when the network is back. This fix allows a better translation of net errors into ServerConnectionCodes, which allows for sync to start when the network is back in a more reliable way. BUG=169790 Review URL: https://chromiumcodereview.appspot.com/11953072 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179593 0039d316-1c4b-4281-b951-d872f2087c98
* sync: fix scheduler unthrottling when there is a valid nudge canarytim@chromium.org2013-01-262-8/+80
| | | | | | | | | BUG=165561, 154216 Review URL: https://chromiumcodereview.appspot.com/12033091 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179004 0039d316-1c4b-4281-b951-d872f2087c98
* Copy entries of broken (having unrecoverable error) data types to delete ↵haitaol@chromium.org2013-01-261-2/+46
| | | | | | | | | | | journals before purging. BUG=121928 Review URL: https://chromiumcodereview.appspot.com/11578017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179003 0039d316-1c4b-4281-b951-d872f2087c98
* sync: rearrange calls to avoid unnecessary CHECKing tim@chromium.org2013-01-221-2/+2
| | | | | | | | | BUG=165561 Review URL: https://chromiumcodereview.appspot.com/11929033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177979 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add support for denoting which sessions types are enabledzea@chromium.org2013-01-182-0/+17
| | | | | | | | | | | | | We do this by sending the set of enabled types (those in the routing info) at commit time via a new ClientConfigParams message. BUG=170162 R=tim@chromium.org Review URL: https://chromiumcodereview.appspot.com/11935002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177775 0039d316-1c4b-4281-b951-d872f2087c98
* sync: second attempt at 176732 that covers all pending_nudge_ assignments.tim@chromium.org2013-01-152-8/+15
| | | | | | | | BUG=165561 Review URL: https://codereview.chromium.org/11882048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177011 0039d316-1c4b-4281-b951-d872f2087c98
* sync: add a CHECK to shed light on bug 165561.tim@chromium.org2013-01-144-3/+35
| | | | | | | | | | | | If a SyncSessionJob is destroyed and the scheduler still references it, CHECK-fail. This the crash described in 165561 is happening on canary, this should help explain what's going on. BUG=165561 Review URL: https://codereview.chromium.org/11887013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176732 0039d316-1c4b-4281-b951-d872f2087c98
* reland: sync: Initialize entries with a model typerlarocque@chromium.org2013-01-123-201/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change modifies two important sync functions. The first is MutableEntry's CREATE constructor. It now requires that the ModelType of the entry to be specified when the entry is create. This doesn't quite eliminate the existence of nodes without a valid model type (the CREATE_NEW_UPDATE_ITEM can still make them), but it helps. This paves the way for the upcoming UniquePosition change. Part of that change is that bookmarks must be granted a unique tag on creation. To support this, we must know at creation time the type of a new entry, so we can take the appropriate bookmark-specific steps if necessary. The second function to get a new signature is WriteNode's InitByCreation(), which has been renamed to WriteNode::InitBookmarkByCreation(). The function can only be used to create bookmarks, so the new name describes its function more precisely. Updates to the call-sites of MutableEntry's constructor make up the majority of this change. This change also includes some minor updates to test functions that create entries to make them compatible with the stricter assertions or to make them more closely reflect real world behaviour. NOTE: The previous version of this patch misused DCHECK() so it did not function correctly in release mode. This has since been fixed. BUG=145412,126505 Review URL: https://chromiumcodereview.appspot.com/11861017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176575 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 176340joaodasilva@chromium.org2013-01-113-184/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > sync: Initialize entries with a valid model type > > This change modifies two important sync functions. > > The first is MutableEntry's CREATE constructor. It now requires that > the ModelType of the entry to be specified when the entry is create. > This doesn't quite eliminate the existence of nodes without a valid > model type (the CREATE_NEW_UPDATE_ITEM can still make them), but it > helps. > > This paves the way for the upcoming UniquePosition change. Part of that > change is that bookmarks must be granted a unique tag on creation. To > support this, we must know at creation time the type of a new entry, so > we can take the appropriate bookmark-specific steps if necessary. > > The second function to get a new signature is WriteNode's > InitByCreation(), which has been renamed to > WriteNode::InitBookmarkByCreation(). The function can only be used to > create bookmarks, so the new name describes its function more precisely. > > Updates to the call-sites of MutableEntry's constructor make up the > majority of this change. This change also includes some minor updates > to test functions that create entries to make them compatible with the > stricter assertions or to make them more closely reflect real world > behaviour. > > BUG=145412,126505 > > > Review URL: https://chromiumcodereview.appspot.com/11817010 TBR=rlarocque@chromium.org Review URL: https://codereview.chromium.org/11863011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176352 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Initialize entries with a valid model typerlarocque@chromium.org2013-01-113-201/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change modifies two important sync functions. The first is MutableEntry's CREATE constructor. It now requires that the ModelType of the entry to be specified when the entry is create. This doesn't quite eliminate the existence of nodes without a valid model type (the CREATE_NEW_UPDATE_ITEM can still make them), but it helps. This paves the way for the upcoming UniquePosition change. Part of that change is that bookmarks must be granted a unique tag on creation. To support this, we must know at creation time the type of a new entry, so we can take the appropriate bookmark-specific steps if necessary. The second function to get a new signature is WriteNode's InitByCreation(), which has been renamed to WriteNode::InitBookmarkByCreation(). The function can only be used to create bookmarks, so the new name describes its function more precisely. Updates to the call-sites of MutableEntry's constructor make up the majority of this change. This change also includes some minor updates to test functions that create entries to make them compatible with the stricter assertions or to make them more closely reflect real world behaviour. BUG=145412,126505 Review URL: https://chromiumcodereview.appspot.com/11817010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176340 0039d316-1c4b-4281-b951-d872f2087c98
* sync: speculative fix for bug 165561tim@chromium.org2013-01-101-0/+9
| | | | | | | | | | | | | | | | | The SyncManager will stop the scheduler as part of StopSyncingForShutdown, which happens well before things like the invalidator are torn down / told to stop interacting with the scheduler. As such, we can wind up scheduling nudges on a lame duck scheduler. Some of the stacks associated with 165561 clearly show browser shutdown happening on the UI thread and OnIncomingInvalidation happening on the sync thread, which will crash on a second invocation as pending_nudge will be set to a job that is dropped by ScheduleSyncSessionJob. BUG=165561 Review URL: https://chromiumcodereview.appspot.com/11827013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175945 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Start moving away from PREV_ID and NEXT_IDrlarocque@chromium.org2013-01-086-28/+25
| | | | | | | | | | | | | | | | | This change replaces serveral instances of Get(PREV_ID) and Get(NEXT_ID) with calls to the newly introduced GetPredecessorId() and GetSuccessorId(). This is done in anticipation of the change that will remove PREV_ID and NEXT_ID entirely. By making this change in advance, that patch will be smaller and easier to review. BUG=145412,126505 Review URL: https://chromiumcodereview.appspot.com/11637053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175599 0039d316-1c4b-4281-b951-d872f2087c98
* [sync] Componentize sync: Part 6: Add more SYNC_EXPORTs to files in src/sync/rsimha@chromium.org2013-01-0219-44/+67
| | | | | | | | | | | | | | | | | | | | | | | | | 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 targets depend on various sync targets as defined in sync.gyp. We'd like to move to a world where all chrome targets outside sync.gyp simply depend on the target sync.gyp:sync, which is built into its own component. This patch sets the stage for full componentization by adding SYNC_EXPORT_PRIVATE (and some SYNC_EXPORT) annotations to classes / methods within src/sync so that various chrome targets can reference them. It also makes a few assorted fixes like adding missing destructors, etc. These errors get flagged when component builds are enabled after componentizing sync. The final step of breaking off sync into its own component will be done in https://codereview.chromium.org/11412211. BUG=136928 Review URL: https://codereview.chromium.org/11624037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174801 0039d316-1c4b-4281-b951-d872f2087c98
* [sync] Componentize sync: Part 5: Eliminate filename collisions in sync.gyprsimha@chromium.org2012-12-1915-37/+37
| | | | | | | | | | | | In order to move src/sync into its own compoent, all the static_library targets in sync.gyp need to be converted to targets of type 'none' and rolled into one sync target of type component. This is currently blocked by duplicate .cc filenames in syncable and internal_api, which flags an error while running gyp. The offending files are {internal_api|syncable}/{base|read|write}_transaction.cc. This patch renames syncable/{base|read|write}_transaction.{h|cc} to syncable/syncable_{base|read|write}_transaction.{h|cc}. BUG=136928 Review URL: https://codereview.chromium.org/11638018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174032 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add support for keystore key rotation.zea@chromium.org2012-12-191-7/+8
| | | | | | | | | | | | | | | | | | | | Key rotation will trigger a full re-encryption of all sync data with the newest keystore key. Previous keys will be added to the keybag as well. We detect key rotation by checking whether we have multiple keystore keys and the nigori's keybag is not encrypted with the current keystore key. In that case, we no longer support backwards compatibility with non-keystore supporting versions, and re-encrypt using the newest keystore key. This change also fixes two latent issues: lack of encryption of the keystore bootstrap and not properly posting OnPassphraseAccepted when we resolve pending keys. BUG=163744 Review URL: https://chromiumcodereview.appspot.com/11434070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173830 0039d316-1c4b-4281-b951-d872f2087c98