summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/public
Commit message (Collapse)AuthorAgeFilesLines
* Remove changes remaining counter from about:syncrlarocque@chromium.org2014-04-287-22/+2
| | | | | | | | | | | | | | | | | The label "changes remaining" is not quite correct. It's actually set to either zero or one, depending on whether or not the current sync cycle should result in more downloads. If there is an issue with infinite download looping, we should be able to detect and debug it based on the protocol logs, among other things. The protocol logs indicate when a GetUpdates response had a non-zero "changes remaining" value. BUG=349301 Review URL: https://codereview.chromium.org/256413007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266594 0039d316-1c4b-4281-b951-d872f2087c98
* Introduce NonBlockingDataTypeControllerrlarocque@chromium.org2014-04-261-3/+26
| | | | | | | | | | | | | | | | | | | The NonBlockingDataTypeController tracks the sync state of a non-blocking data type and sends signals to its components from the UI thread. It is responsible for enabling and disabling sync for a data type according to user preference and the availbility of the sync backend. This CL also includes some changes to the NonBlockingDataTypeProcessor, which is currently just a stub of what will eventually become non-blocking sync's model thread component, so that it can be used in testing NonBlockingDataTypeController. BUG=351005 Review URL: https://codereview.chromium.org/249843002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266344 0039d316-1c4b-4281-b951-d872f2087c98
* Add an action for server to send down rollback command.haitaol@chromium.org2014-04-222-0/+2
| | | | | | | | BUG=362679 Review URL: https://codereview.chromium.org/238273008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265134 0039d316-1c4b-4281-b951-d872f2087c98
* Cleanup: Remove some std::wstring usage in sync.thestig@chromium.org2014-04-221-1/+1
| | | | | | | | BUG=23581 Review URL: https://codereview.chromium.org/235553007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265131 0039d316-1c4b-4281-b951-d872f2087c98
* Add sync manager classes for backup/rollback:haitaol@chromium.org2014-04-211-0/+3
| | | | | | | | | | | * SyncBackupManager runs before first-sync to save local data in backup DB. * SyncRollbackManager deletes local data that's not found in backup DB. BUG=362679 Review URL: https://codereview.chromium.org/235053006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265027 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove some fields from about:syncrlarocque@chromium.org2014-04-122-18/+0
| | | | | | | | | | | Removes some of the status indicators on about:sync that were made obsolete by the introduction of the protocol events log. BUG=349301 Review URL: https://codereview.chromium.org/235923004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263483 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add interface for SyncCoreProxyrlarocque@chromium.org2014-04-125-33/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | Defines an interface for SyncCoreProxy. This will be used for testing. The SyncCoreProxy is a natural boundary for tests. To its clients, it represents the sync thread and all of its functionality. By allowing it to be overloaded in tests, we can stub out all of the sync thread functionality so we can better test the parts that communicate with it. This required some fairly large changes. In order to allow it to be used as an interface, the SyncCoreProxy could no longer be stored on the stack and copied around everywhere. The objects that call its virtual functions must manage it as a pointer or reference, rather than a concrete object. For now, ownership is settled by having one or two elements on each thread hold a scoped_ptr to their own copy of it. The SyncCoreProxy is passed around as a pointer, and ownership is not transferred in these calls. Objects that want to keep their own private copy can make use of the Clone() method and store the resulting copy in a scoped_ptr. BUG=351005 Review URL: https://codereview.chromium.org/225863006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263448 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Notify the datatype of the current context on startupzea@chromium.org2014-04-111-1/+9
| | | | | | | | | | | | | | In order to support context triggered refreshes, the datatype must know what the current context is at startup to decide whether a refresh must be performed or not. We will now invoke UpdateDataTypeContext before MergeDataAndStartSyncing if a valid context exists. BUG=357368 R=rlarocque@chromium.org Review URL: https://codereview.chromium.org/233833003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263376 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add support for retrying a getupdates due to a context changezea@chromium.org2014-04-102-0/+4
| | | | | | | | | | | We detect a context conflict using the version value, and if detected force the getupdates to retry. BUG=360280 Review URL: https://codereview.chromium.org/232003005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263134 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add support for context changes that trigger refresheszea@chromium.org2014-04-091-2/+8
| | | | | | | | | | | | | | The ContextRefreshStatus controls whether a context change should force a refresh or not. A refresh just discards the progress marker token and marks all synced entities for the type has having version 1. This means all entities the server knows about are overwritten, while any locally created entities will remain in the same state (and be pushed to the server on the next commit). BUG=357368 Review URL: https://codereview.chromium.org/226473005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262567 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Re-implement getAllNodes WebUI functionrlarocque@chromium.org2014-04-072-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the existing implementation of getAllNodes. This was the last function based on the old "makeSyncFunction" and "JsMessageHandler" interface, so its removal leaves behind quite a bit of dead code. This CL removes some of it. The rest will be removed in a future CL. Replaces it with some infrastructure intended to be more compatible with the future of sync, where each type is more independent. Requests to getAllNodes are routed through a DirectoryTypeDebugInfoEmitter in the ModelTypeRegistry. A NonBlockingTypeDebugInfoEmitter will be implemented in a future CL. The new system also intended to support "streaming" results. Rather than waiting for all types to return their nodes, the system could be modified to allow some types to get back to the JavaScript layer sooner than others so it can display results earlier. However, we do not currently take advantage of this functionality. The return type of getAllNodes is now an array of per-type objects, rather than one big list of nodes. This, too, should help us implement streaming support in the future. For now, most of the JavaScript callbacks will convert the data back to the old format before operating on it. BUG=328606 Review URL: https://codereview.chromium.org/224563004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262193 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add plumbing of context from client to serverzea@chromium.org2014-04-041-0/+3
| | | | | | | | | | | | The datatype context is now written into the directory and plumbed up to the server on every GetUpdates or Commit request. GetUpdatesResponses also now overwrite the context if the version returned is the same or higher. BUG=345420 Review URL: https://codereview.chromium.org/215973007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261873 0039d316-1c4b-4281-b951-d872f2087c98
* Add non-blocking sync code to ProfileSyncServicerlarocque@chromium.org2014-04-042-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Adds support for non-blocking sync to the ProfileSyncService and related classes. This continues the work of r258390 and r259921. Like those patches, it is not expected to have any impact on behavior. Introduces ProfileSyncService::RegisterNonBlockingType(). This function will act as an alternative to RegisterDataTypeController(). Adds some support for these non-blocking types. Adds a special case to the code that generates the 'type status' table on the about:sync page. Instantiates and copies a SyncCoreProxy object to the ProfileSyncService as backend initialization completes. This will be an important part of non-blocking data type initialization, once that functionality is supported. BUG=351005 Review URL: https://codereview.chromium.org/217183003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261590 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove TrafficRecorderrlarocque@chromium.org2014-04-023-4/+0
| | | | | | | | | | | | The new protocol events framework handles all the use cases of the TrafficRecorder, and more. The traffic recorder implementation and about:sync tab are now redundant. BUG=357821 Review URL: https://codereview.chromium.org/217633003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261032 0039d316-1c4b-4281-b951-d872f2087c98
* Update sync API to support attachments.maniscalco@chromium.org2014-04-012-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | The purpose of this change is to start exposing attachment support in the sync API. At this point there is no real functionality added. SyncData and SyncChangeProcessor now know about attachments. GenericChangeProcessor's ctor now requires an AttachmentService. Add AttachmentService and FakeAttachmentService. Update Attachment::Create* methods to return by value. Make Attachment::CreateId public because it is useful in sync_data_unittest.cc. Make some ctors explicit. BUG=348624 Review URL: https://codereview.chromium.org/187303006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260778 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Buffer Protocol Events for about:sync pagerlarocque@chromium.org2014-04-018-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows the about:sync page to present the last six network events as soon as it's opened. Adds the ProtocolEventBuffer to the SyncManagerImpl. This class holds on to a few protocol events and returns them on demand. Modifies the interface to enable SyncBacknedHost protocol event forwarding. By default, it does not forward any events. There are now separate registration and unregistration functions. The registration function will send the set of buffered notifications to the UI thread, and also register it to receive incoming events in the future. It continues to forward events until the number of registration calls is matched by the number of un-registration calls. Makes about:sync's registration to receive events explicit. This was a long-time TODO. If we did not fix this issue, then the about:sync page could receive the initial set of buffered invalidations before it had its event listeners defined and registered. Makes the about:sync page keep track of known events and avoid adding duplicates to the list. Since the registration of a new event listener causes events to be distributed to all listeners, we must add this logic to ensure that opening one new about:sync tab will not cause previously opened tabs to display duplicate events. BUG=329373,349301 Review URL: https://codereview.chromium.org/212603007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260726 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add NonBlockingTypeProcesssor and SyncCorerlarocque@chromium.org2014-03-274-2/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces the model-thread sibling of the NonBlockingTypeProcessorCore that was added in r258390. Also adds SyncCore and SyncCoreProxy, the classes that will be used to connect the two. The SyncCore lives on the sync thread and carries out requests sent to it by the SyncCoreProxy. The SyncCoreProxy is a thread-safe wrapper around the SyncCore that can be easily copied and whose methods can be called from any thread. The NonBlockingTypeProcessor is instantiated on the same thread as the data to be synced. It connects to a NonBlockingTypeProcessorCore on the sync thread by sending a request through a SyncCoreProxy. Keeping data in sync will be a collaborative effort involving both the NonBlockingTypeProcessor and NonBlockingTypeProcesssorCore, though none of this functionality has been implemented yet. As of this CL, none these classes are instantiated outside of tests. This CL should have no effect on current sync behavior. BUG=351005 Review URL: https://codereview.chromium.org/208893004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259921 0039d316-1c4b-4281-b951-d872f2087c98
* Control invalidations network channel from syncer experimentpavely@chromium.org2014-03-211-2/+8
| | | | | | | | | | | | | | | | - Created new experiment protobuf. - ProfileSyncService writes value to prefs - TiclInvalidationService registers for changes to both gcm enabled and invalidations over GCM pref settings. When prefs change it decides which channel to use and restarts invalidator if needed. BUG=325020 R=zea@chromium.org Review URL: https://codereview.chromium.org/205333003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258689 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Expose ProtocolEvents on ProfileSyncServicerlarocque@chromium.org2014-03-217-0/+291
| | | | | | | | | | | | | | | | | Adds code to the sync engine to have it generate protocol events when it contacts the server. These events are then sent through the SyncSession, SyncManager, SyncBackendHostCore, SyncBackendHost, and finally to the ProfileSyncService. Objects on the UI thread can register with the ProfileSyncService as observers of these events, though this CL does not introduce any of these listeners. BUG=349301 Review URL: https://codereview.chromium.org/203463005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258685 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Remove/refactor unnecessary command line switcheszea@chromium.org2014-03-181-0/+5
| | | | | | | | | | | | | | | This consolidates all flags for disabling individual sync types into one, which we parse to decide which flags should be disabled. The parsing logic is added to model_type.cc (in the form of ModelTypeSetFromString). This patch also removes the obsolete history sync about:flag experiment. BUG=343274 TBR=sky@chromium.org Review URL: https://codereview.chromium.org/195893014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257794 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add definitions for ProtocolEventsrlarocque@chromium.org2014-03-181-0/+59
| | | | | | | | | | | | | | | This is a part of a much larger change list. The eventual goal is to have these ProtocolEvents emitted all the way to the UI thread, where they can be displayed on about:sync. This CL just defines the objects without using them. BUG=349301 R=tim@chromium.org Review URL: https://codereview.chromium.org/187083003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257700 0039d316-1c4b-4281-b951-d872f2087c98
* Removed redundant notifications info from about:sync-internalsmferreria@chromium.org2014-03-141-28/+0
| | | | | | | | | | | | | | | This patch removes the tab 'Notifications' from about:sync-internals. This tab used to be useful for debugging notifications as they arrived, but now that its functionality has been replaced and augmented in the new about:invalidations, with more general functionality and extended logging information, it is no longer necessary to have it here. BUG=351559 Review URL: https://codereview.chromium.org/196373004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257182 0039d316-1c4b-4281-b951-d872f2087c98
* [invalidations] Added table with registered objectsIdsmferreria@chromium.org2014-02-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | This patch is a follow-up to issue 147353011. The patch adds a display mechanism for the about:invalidations page that shows a table with every implementer of InvalidationHandler that has registered for at least one ObjectId for invalidations. The table also registers for every ObjectId how many invalidations were received of that kind, the last time one of those arrived and what was the payload it contained, in case there were any. There are minimal modifications to every file that implemented InvalidationHandler because there was a small change in the interface, in order to be able to return a string stating who is the owner of the InvalidationHandler without passing raw pointers around. BUG=263863 Review URL: https://codereview.chromium.org/159773006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252210 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Move migration signal out of snapshotrlarocque@chromium.org2014-02-122-4/+2
| | | | | | | | | | | | | | | | | | | A sync data migration request is signalled by the server during a normal GetUpdates or Commit request. The signal is then forwarded to the UI thread, which actually performs the migration. Traditionally, the signal has been sent through the SyncSessionSnapshot, which is delivered to the UI thread at the end of the current sync cycle. This CL introduces new code to pass the signal through the SyncSession::Delegate and SyncManagerObserverInterfaces. This CL should not change the syncer's behavior. BUG=339984 Review URL: https://codereview.chromium.org/158953004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250849 0039d316-1c4b-4281-b951-d872f2087c98
* Enhanced bookmarks: added support for sync based experimentyefim@chromium.org2014-02-121-3/+18
| | | | | | | | BUG=321393 Review URL: https://codereview.chromium.org/156103002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250792 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove dead code related to ClearUserDatarlarocque@chromium.org2014-02-121-6/+0
| | | | | | | | | | | | | | | | | Removes some code left over from the ClearUserData feature. These are mostly functions named 'OnStopSyncingPermanently'. Also renames ProfileSyncService::OnStopSyncingPermanently to StopSyncingPermanently. This makes it easier to distinguish from the now deprecated SyncManagerObserver callback. The new name is more appropriate name since this function is not really a callback or event handler anymore. BUG=342932 Review URL: https://codereview.chromium.org/153643006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250775 0039d316-1c4b-4281-b951-d872f2087c98
* Split up SyncEngineEventListener callbacksrlarocque@chromium.org2014-02-111-4/+1
| | | | | | | | | | | | | | | | | Splits up the SyncEngineEventListener calls into one callback per event type. This allow us to trim the 'event' objects so they only contain elements relevant to their event. Also removes some dead code related to STOP_SYNCING_PERMANENTLY, which is no longer in use. It may have been used for birthday errors in the past, but those are now handled with ActionableError. It was used for CLEAR_USER_DATA, but that feature is no longer supported. BUG=339984 Review URL: https://codereview.chromium.org/152013003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250384 0039d316-1c4b-4281-b951-d872f2087c98
* [Autofill, Sync] Deprecate the Autofill culling experiment.isherman@chromium.org2014-02-111-10/+2
| | | | | | | | | | | | | Culling has for a while now been enabled for all users, so might as well deprecate the experiment. BUG=none TEST=none R=zea@chromium.org Review URL: https://codereview.chromium.org/157023004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250336 0039d316-1c4b-4281-b951-d872f2087c98
* [GCM] Add experiment and startup logic for partial rolloutzea@chromium.org2014-02-081-2/+14
| | | | | | | | | | | | | The experiment controls whether the GCMProfileService should be suppressed or force created at sync startup time. If no experiment is present, the default is for Canary/Dev clients to be able to enable the GCMProfileService lazily, and other clients to be unable to create it at all. BUG=284553 Review URL: https://codereview.chromium.org/152633006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249871 0039d316-1c4b-4281-b951-d872f2087c98
* Fix CancelationSignalTest.Cancelrlarocque@chromium.org2014-02-051-40/+51
| | | | | | | | | | | | | | | | | | The old version of the test had a bug and was racy. If we hit a certain code path, we would never unregister the CancelationSignal's observer, which would result in a DCHECK. Because the code was racy, we didn't hit that code path very often. This CL includes two changes. First, it makes the test less racy. It ensures that we always hit the more interesting code path. It also fixes the bug so that hitting that code path no longer results in a DCHECK failure. BUG=340360 Review URL: https://codereview.chromium.org/144313016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249134 0039d316-1c4b-4281-b951-d872f2087c98
* Disable flaky CancelationSignalTest.Cancel on iOS and Mac.msw@chromium.org2014-02-031-1/+7
| | | | | | | | | | | | | | | | | | Recent flake: http://build.chromium.org/p/chromium.mac/builders/iOS%20Simulator%20%28dbg%29/builds/15075 Flakiness dashboard: http://chromium-build-logs.appspot.com/gtest_query?gtest_query=CancelationSignalTest.Cancel BUG=340360 TEST=none R=erg@chromium.org TBR=rlarocque@chromium.org NOTRY=true Review URL: https://codereview.chromium.org/148613010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248569 0039d316-1c4b-4281-b951-d872f2087c98
* Add ManagedUserSharedSettings as sync datatype if the ManagedUserSettings ↵akuegel@chromium.org2014-02-032-18/+0
| | | | | | | | | | | | sync datatype is enabled. Also remove some boilerplate code that is not needed. BUG=316168 Review URL: https://codereview.chromium.org/142473005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248470 0039d316-1c4b-4281-b951-d872f2087c98
* Create sync_driver component.blundell@chromium.org2014-01-311-4/+4
| | | | | | | | | | | | This CL creates the sync_driver component and moves files with no problematic dependencies from //chrome/browser/sync and //chrome/browser/sync/glue into it. This is a first step toward componentization of //chrome/browser/sync. BUG=339727 Review URL: https://codereview.chromium.org/133343007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248192 0039d316-1c4b-4281-b951-d872f2087c98
* New Sync datatype for Synced Notifications App Infopetewil@chromium.org2014-01-291-0/+2
| | | | | | | | | | This is the first checkin for creating a new sync datatype for the synced notifications app info. The new datatype will be used for synced notification metadata such as the name and icon of the service sending the synced notification. BUG=280266 Review URL: https://codereview.chromium.org/143973006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247551 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Introduce ModelTypeRegistry and helpersrlarocque@chromium.org2014-01-173-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Introduce the ModelTypeRegistry class and use it to manage the creation of UpdateHandlers and CommitContributors. The ModelTypeRegistry also gets some help from the newly introduced UpdaterList and CommitterList classes. This lets us move the verbose iteration logic out of the code that's focused on building and executing commits and updates, which should make those functions easier to read. It gives us more freedom to experiment with other ways to manage the lists of commit contributors and update handlers, should we choose to do so. It prevents us from leaking the set of enabled types through the per-type maps. This patch is one of the last in the stack related to building a per-type abstraction into the sync engine, and also one of the first steps towards implementing run-time enable and disable logic for the new-style sync types. BUG=278484 Review URL: https://codereview.chromium.org/93433006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245654 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove some WebUI debug functionsrlarocque@chromium.org2014-01-162-48/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL removes a number of functions from the sync debugging framework in order to prepare for some upcoming changes to sync debugging (due to 328606). This CL removes the following functions: - GetRootNodeDetails - GetNodeSummaries - GetNodeDetails - GetChildNodeIds It also adds the function 'getListOfKnownTypes' to help replace some old functionality required by the 'data' tab and to fix issue 329013. Rather than having that tab fetch a list of children of the root node, it now asks for a list of all known data types. This is a better solution, since it does not require sync to be fully initialized in order to properly populate the set of checkboxes. The most significant user of the removed functionality is the node browser. Its javascript code has been modified in order to transition it to relying on the getAllNodes function. Rather than fetching node data on demand by a series of asynchronous callbacks, the tab now fetches a list of all known sync nodes at once. This has the advantage of providing a more consistent (though more stale) snapshot. This CL adds a refresh button to the node browser tab in order to give users some control over its staleness. This change had some minor side-effects. The node browser now relies on items' string-based IDs rather than their metahandles when determining the nodes' hierarchy. We've also had to add a 'positionIndex' field to the output of getAllNodes to make it easier for the node browser to sort its entries. In part to make it easier to fetch this field, most of the code associated with getAllNodes has been moved into the syncable::Directory. In addition to all these changes, this CL adds some webui tests to help prevent regressions in about:sync functionality. For now, they only cover the node browser. More tests will be added in future CLs. BUG=110517,329013,328606 Review URL: https://codereview.chromium.org/134443004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245313 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Consistently refcount ModelSafeWorkersrlarocque@chromium.org2014-01-115-5/+5
| | | | | | | | | | | | | | | | Certain interfaces in sync had signatures that included vectors of raw pointers to ModelSafeWorkers. The use of raw pointers to refcounted objects looks a lot like a bug waiting to happen. This CL replaces any use of std::vector<ModelSafeWorker*> with std::vector<scoped_refptr<ModelSafeWorker> >. This is not expected to alter sync behavior in any significant way. BUG=332251 Review URL: https://codereview.chromium.org/130193002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244329 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the Value class names from the global namespace.avi@chromium.org2013-12-241-1/+1
| | | | | | | | | | BUG=88666 TEST=no change TBR=ben@chromium.org Review URL: https://codereview.chromium.org/116543010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242440 0039d316-1c4b-4281-b951-d872f2087c98
* Add Sync datatype for shared managed user settings.bauerb@chromium.org2013-12-191-0/+3
| | | | | | | | BUG=316168 Review URL: https://codereview.chromium.org/76333002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241779 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Use invalidation local acknowledgementsrlarocque@chromium.org2013-12-172-3/+17
| | | | | | | | | | | | | | | | | | | | | As of r237421, the invalidations system now supports a new and improved form of local acknowledgements. Any invalidations not explicitly dropped or acknowledged will be redelivered after a restart. This CL makes use of the new functionality in sync. It uses the DataTypeTrackers to track the status of pending invalidations and acknowledge or drop invalidations as appropriate. Also notable in this CL is that the 'server_dropped_hints' flag has now been uncommented in the sync protocol. We've known for a long time that we wanted to support such a flag, but haven't been able to implement it correctly until now. BUG=78462,233437 Review URL: https://codereview.chromium.org/102353005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241170 0039d316-1c4b-4281-b951-d872f2087c98
* Stop doing unnecessary UTF-8 to UTF-16 conversions in JSONWriter.rsesek@chromium.org2013-12-112-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The JSONReader only accepts UTF-8 input strings and converts \uXXXX sequences back into UTF-8. However, the JSONWriter converts all non-ASCII characters to UTF-16 escape sequences. This round-tripping is sub-optimal, as noted in a TODO from r54359. One reason for this may be that JsonDoubleQuote(), used by JSONWriter, does not handle UTF-8 bytes correctly, interpreting them as code points and writing them out as \u00XX sequences. If this were read back through a RFC-compliant JSON parser, the result would be an invalid encoding error. JsonDoubleQuote() does handle UTF-16 correctly, though. This rewrites the base/json/string_escape.h API and fixes the above UTF-8 issue by dividing callers up into three groups: 1. Those that pass valid UTF-8 to be escaped. Prior to this change, very few callers used this variant. Those that did were likely using ASCII, otherwise the output would be mangled due to the above issue. Now, valid UTF-8 will be passed through to the output unescaped. Invalid UTF-8 sequences are replaced with U+FFFD. 2. Those that pass valid UTF-16 to be escaped. This function now validates that the input is valid UTF-16, and then converts it to unescaped UTF-8 sequences for the output. 3. Those that pass arbitrary byte arrays as std::string and expect a non-RFC- compliant encoding of the binary data using \uXXXX escapes. This behavior is now in the EscapeBytesAsInvalidJSONString() function. It is only used by callers who want a "debug string" but do not expect to actually parse the output as valid JSON, since it is not. Additionally, this removes the JSONWriter::OPTIONS_DO_NOT_ESCAPE flag, since the writer can now handle UTF-8 appropriately. BUG=15466 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=239800 Reverted: https://src.chromium.org/viewvc/chrome?view=rev&revision=240082 R=asanka@chromium.org, bauerb@chromium.org, mark@chromium.org, thakis@chromium.org, zea@chromium.org Review URL: https://codereview.chromium.org/100823007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240190 0039d316-1c4b-4281-b951-d872f2087c98
* Add AppListSpecifics .proto definition and support codestevenjb@chromium.org2013-12-111-0/+2
| | | | | | | | | | | | This CL introduces the AppList sync type. As of patchset #7 this CL depends on https://codereview.chromium.org/106033003/ BUG=313376 Review URL: https://codereview.chromium.org/78773004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240162 0039d316-1c4b-4281-b951-d872f2087c98
* Revert of https://codereview.chromium.org/100823007/antrim@chromium.org2013-12-112-4/+5
| | | | | | | | | | | | Reason for revert: This patchset breaks at least displayment of Russian localized strings on Chromeos login screen. TBR=mark@chromium.org,jshin@chromium.org,thakis@chromium.org,asanka@chromium.org,zea@chromium.org,bauerb@chromium.org,rsesek@chromium.org NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/106793004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240082 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 239921 "Revert 239759 "The comment in base64.h implies th..."vadimt@chromium.org2013-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ***************** Reverting the revert. Congrats, the original CL wasn't the cause for the failure; sorry for the mess. ***************** > Revert 239759 "The comment in base64.h implies that base::Base64..." > > > The comment in base64.h implies that base::Base64Encode() can return false, but > > this cannot happen in practice. Fix the comment. > > > > The implementation of Base64Encode() attempts to check for the return value > > MODP_B64_ERROR as a failure, but modp_b64_encode() cannot return this > > value. Remove the check. > > > > Remove unneeded integer cast. > > > > Change the return type to void. > > > > BUG=323357 > > TEST=base_unittests, compile all > > TBR=jochen@chromium.org,miket@chromium.org,joi@chromium.org,akalin@chromium.org,sergeyu@chromium.org > > > > Review URL: https://codereview.chromium.org/86913002 > > TBR=ricea@chromium.org > > Review URL: https://codereview.chromium.org/101113004 TBR=vadimt@chromium.org Review URL: https://codereview.chromium.org/111883004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239944 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 239759 "The comment in base64.h implies that base::Base64..."vadimt@chromium.org2013-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | > The comment in base64.h implies that base::Base64Encode() can return false, but > this cannot happen in practice. Fix the comment. > > The implementation of Base64Encode() attempts to check for the return value > MODP_B64_ERROR as a failure, but modp_b64_encode() cannot return this > value. Remove the check. > > Remove unneeded integer cast. > > Change the return type to void. > > BUG=323357 > TEST=base_unittests, compile all > TBR=jochen@chromium.org,miket@chromium.org,joi@chromium.org,akalin@chromium.org,sergeyu@chromium.org > > Review URL: https://codereview.chromium.org/86913002 TBR=ricea@chromium.org Review URL: https://codereview.chromium.org/101113004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239921 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Refactor GetUpdates looprlarocque@chromium.org2013-12-103-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-up to r238532. I had wanted to implement this change with that CL, but decided it would be easier to split them up into independent changes. This refactoring pulls the GetUpdates looping logic out of the StatusController. It was implemented that way in a time when the only way to pass state between different parts of the sync cycle was through a shared SyncSession and its members. Now that this is no longer the case, we can keep the "should continue looping" logic more or less local to the code that performs the looping. The change allows us to remove the updates response message proto member out of the StatusController. That could save us a small amount of time, since copying protos can be somewhat expensive. More importantly, it reduces complexity, since we no longer need to worry about the effects of state stored in the StatusController. The StatusController is now used only to collect some counts for debugging. This has already uncovered a bug. There was a unit test that failed to reset its SyncSession in the same manner that it would have been reset in a non-test scenario. It depended on the state that was "leaked" from one sync cycle to the next via the unreset SyncSession in order to meet its test expectations. BUG=278484 Review URL: https://codereview.chromium.org/104653003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239905 0039d316-1c4b-4281-b951-d872f2087c98
* Stop doing unnecessary UTF-8 to UTF-16 conversions in JSONWriter.rsesek@chromium.org2013-12-102-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The JSONReader only accepts UTF-8 input strings and converts \uXXXX sequences back into UTF-8. However, the JSONWriter converts all non-ASCII characters to UTF-16 escape sequences. This round-tripping is sub-optimal, as noted in a TODO from r54359. One reason for this may be that JsonDoubleQuote(), used by JSONWriter, does not handle UTF-8 bytes correctly, interpreting them as code points and writing them out as \u00XX sequences. If this were read back through a RFC-compliant JSON parser, the result would be an invalid encoding error. JsonDoubleQuote() does handle UTF-16 correctly, though. This rewrites the base/json/string_escape.h API and fixes the above UTF-8 issue by dividing callers up into three groups: 1. Those that pass valid UTF-8 to be escaped. Prior to this change, very few callers used this variant. Those that did were likely using ASCII, otherwise the output would be mangled due to the above issue. Now, valid UTF-8 will be passed through to the output unescaped. Invalid UTF-8 sequences are replaced with U+FFFD. 2. Those that pass valid UTF-16 to be escaped. This function now validates that the input is valid UTF-16, and then converts it to unescaped UTF-8 sequences for the output. 3. Those that pass arbitrary byte arrays as std::string and expect a non-RFC- compliant encoding of the binary data using \uXXXX escapes. This behavior is now in the EscapeBytesAsInvalidJSONString() function. It is only used by callers who want a "debug string" but do not expect to actually parse the output as valid JSON, since it is not. Additionally, this removes the JSONWriter::OPTIONS_DO_NOT_ESCAPE flag, since the writer can now handle UTF-8 appropriately. BUG=15466 Review URL: https://codereview.chromium.org/100823007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239800 0039d316-1c4b-4281-b951-d872f2087c98
* The comment in base64.h implies that base::Base64Encode() can return false, butricea@chromium.org2013-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | this cannot happen in practice. Fix the comment. The implementation of Base64Encode() attempts to check for the return value MODP_B64_ERROR as a failure, but modp_b64_encode() cannot return this value. Remove the check. Remove unneeded integer cast. Change the return type to void. BUG=323357 TEST=base_unittests, compile all TBR=jochen@chromium.org,miket@chromium.org,joi@chromium.org,akalin@chromium.org,sergeyu@chromium.org Review URL: https://codereview.chromium.org/86913002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239759 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 239635 "Revert 239615 "Retry: Clean up TestProfileSyncSer..."scottmg@chromium.org2013-12-101-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Didn't help. > Revert 239615 "Retry: Clean up TestProfileSyncService tests" > > Failed on CrOS: > > http://build.chromium.org/p/chromium.chromiumos/builders/ChromiumOS%20%28x86%29/builds/18496/steps/BuildPackages/logs/stdio > > chromeos-chrome-33.0.1734.0_alpha-r1: sync/protocol/proto_value_conversions.cc:417:11: error: 'MetaInfo' in namespace 'sync_pb' does not name a type > chromeos-chrome-33.0.1734.0_alpha-r1: const sync_pb::MetaInfo& proto) { > chromeos-chrome-33.0.1734.0_alpha-r1: ^ > chromeos-chrome-33.0.1734.0_alpha-r1: sync/protocol/proto_value_conversions.cc:417:30: error: ISO C++ forbids declaration of 'proto' with no type [-fpermissive] > chromeos-chrome-33.0.1734.0_alpha-r1: const sync_pb::MetaInfo& proto) { > chromeos-chrome-33.0.1734.0_alpha-r1: ^ > chromeos-chrome-33.0.1734.0_alpha-r1: sync/protocol/proto_value_conversions.cc: In function 'base::DictionaryValue* syncer::MetaInfoToValue(const int&)': > chromeos-chrome-33.0.1734.0_alpha-r1: sync/protocol/proto_value_conversions.cc:419:13: error: request for member 'has_key' in 'proto', which is of non-class type 'const int' > chromeos-chrome-33.0.1734.0_alpha-r1: SET_STR(key); > chromeos-chrome-33.0.1734.0_alpha-r1: ^ > chromeos-chrome-33.0.1734.0_alpha-r1: sync/protocol/proto_value_conversions.cc:419:72: error: request for member 'key' in 'proto', which is of non-class type 'const int' > chromeos-chrome-33.0.1734.0_alpha-r1: SET_STR(key); > chromeos-chrome-33.0.1734.0_alpha-r1: ^ > chromeos-chrome-33.0.1734.0_alpha-r1: sync/protocol/proto_value_conversions.cc:420:13: error: request for member 'has_value' in 'proto', which is of non-class type 'const int' > chromeos-chrome-33.0.1734.0_alpha-r1: SET_STR(value); > chromeos-chrome-33.0.1734.0_alpha-r1: ^ > chromeos-chrome-33.0.1734.0_alpha-r1: sync/protocol/proto_value_conversions.cc:420:76: error: request for member 'value' in 'proto', which is of non-class type 'const int' > chromeos-chrome-33.0.1734.0_alpha-r1: SET_STR(value); > chromeos-chrome-33.0.1734.0_alpha-r1: ^ > chromeos-chrome-33.0.1734.0_alpha-r1: sync/protocol/proto_value_conversions.cc: In function 'base::DictionaryValue* syncer::BookmarkSpecificsToValue(const sync_pb::BookmarkSpecifics&)': > chromeos-chrome-33.0.1734.0_alpha-r1: sync/protocol/proto_value_conversions.cc:432:51: error: 'const class sync_pb::BookmarkSpecifics' has no member named 'meta_info' > chromeos-chrome-33.0.1734.0_alpha-r1: SET_REP(meta_info, &MetaInfoToValue); > chromeos-chrome-33.0.1734.0_alpha-r1: ^ > chromeos-chrome-33.0.1734.0_alpha-r1: make: *** [c/Release/obj.target/sync_core/sync/protocol/proto_value_conversions.o] Error 1 > chromeos-chrome-33.0.1734.0_alpha-r1: make: *** Waiting for unfinished jobs.... > chromeos-chrome-33.0.1734.0_alpha-r1: * ERROR: chromeos-base/chromeos-chrome-33.0.1734.0_alpha-r1 failed (compile phase): > chromeos-chrome-33.0.1734.0_alpha-r1: * emake failed > chromeos-chrome-33.0.1734.0_alpha-r1: * > > > Retry: Clean up TestProfileSyncService tests > > > > This is a retry of r238348, which was reverted in r238368. I believe > > the build failure that led to the revert, though related to my change, > > was a flake caused by stale object files on the build bot. > > > > This CL refactors many of the tests in profile_sync_service_unittest.cc. > > It continues the refactoring work begun in r233533, r235661, and > > r235854. > > > > The JsController tests have been deleted. There is not much point in > > testing the JsController here; it can be more easily tested on its own > > in sync_js_controller_uniittest.cc. The SyncJsController unit tests have > > been updated so they now cover the few cases that were formerly only > > exercised in the ProfileSyncService unit tests. > > > > It converts all remaining uncoverted tests from relying on the > > TestProfileSyncService to using a real ProfileSyncService with an > > injected backend. The injected backend makes it easier to create the > > scenarios we want to test. We can inject a specially crafted SBH rather > > than fiddling with "synchronous init" and "fail initial download" flags. > > > > Since the TestProfileSyncService no longer needs to support the wide > > variety of test scenarios required by the tests in > > profile_sync_service_unittest.cc, we can greatly simplify its > > implementation. Many of its parameters and associated code have been > > removed. > > > > BUG=140354,312994 > > > > Review URL: https://codereview.chromium.org/102513002 > > TBR=rlarocque@chromium.org > > Review URL: https://codereview.chromium.org/110993003 TBR=scottmg@chromium.org Review URL: https://codereview.chromium.org/111183003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239643 0039d316-1c4b-4281-b951-d872f2087c98
* Allow customization of HttpPostProviderFactory via ProfileSyncServicepvalenzuela@chromium.org2013-12-104-10/+97
| | | | | | | | | | | This change is being made so that Sync integration tests can eventually use an in-process, C++ fake server. BUG=323265 Review URL: https://codereview.chromium.org/73723006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239636 0039d316-1c4b-4281-b951-d872f2087c98