summaryrefslogtreecommitdiffstats
path: root/sync/test
Commit message (Collapse)AuthorAgeFilesLines
* sync: Gracefully handle early shutdownrlarocque@chromium.org2013-09-195-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new object to communicate cross-thread cancellation signals. This new object, the CancellationSignal, is protected by a lock. It allows the receiving thread to query whether or not a stop has been requested. It also allows the receiving thread to safely register a cross-thread callback to be invoked immediately when a stop is requested. We use two instances of this class to ensure we meet all the requirements for a safe and fast sync backend shutdown. The first instance is used with the HttpBridgeFactory to allow the UI thread to force it to drop all refereces to its RequestContextGetter immediately. This is an important part of our plan to ensure that all references to that object are released before ProfileSyncService::Shutdown() returns, which is necessary to avoid racy crashes at shutdown. (See crbug.com/236451) The second instance is used with the ServerConnectionManager and the Syncer. Once signalled, it ensures that any active connections are released (possibly decrementing another ref to the RequestContextGetter), that any blocking I/O is aborted, and that no more connections will be instantiated. It's important to prevent the creation of more connections because the HttpBridgeFactory might trigger a crash if we asked it to create another connection after it had been shut down. The syncer's interaction with the second cancelation signal is more passive. It does not execute any callbacks when the signal is sent. Instead, it queries the signal as it performs sync cycles, and will cut short any existing sync cycle if it notices the signal has been sent. Finally, this CL includes one important change to the initialization of the HttpBridgeFactory. In order to properly register with the cancellation signal while still allowing the creation of the user agent to occur on the sync thread, its initialization had to be split into two parts. This class now has an Init() method in addition to its constructor. BUG=236451 Review URL: https://chromiumcodereview.appspot.com/23717047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224014 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add getters and setters to Entry classesrlarocque@chromium.org2013-09-131-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the Entry and MutableEntry classes' Get(X) and Put(X, V) members with GetX() and PutX(V) style members. There are many good reasons for performing this refactor. The main reason to implement it now is that we'd like to have more fine-grained control over the visibility of the getters and setters for certain fields, and it's really hard to implement that control when several different fields use the same accessor functions. Once this refactor is complete, we can modify the inheritance hierarchy for Entry and MutableEntry to introduce a new, semi-MutableEntry that provides only the setters whose changes are not "visible" to the underlying model. We can also build on this work to simplify the implementation of MutableEntry. The interface changes are the most notable part of this CL, but there are a few smaller changes here too, including: - Some small formatting cleanups. - In cases where Put() functions had signatures that returned bool but never returned anything other than 'true', those return values have been changed to void. - Some dead code in syncer_proto_util.cc has been removed. BUG=284672 Review URL: https://chromiumcodereview.appspot.com/23484035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223111 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 222154 "sync: Gracefully handle very early shutdown"vitalybuka@chromium.org2013-09-104-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes tests very Flaky. http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=%40ToT%20Chromium&testType=sync_integration_tests&tests=TwoClientPasswordsSyncTest.SetPassphraseAndThenSetupSync Can reproduce on local build. > sync: Gracefully handle very early shutdown > > Introduce a new object to communicate cross-thread cancellation signals. > This new object, the CancellationSignal, is protected by a lock. It > allows the receiving thread to query whether or not a stop has been > requested. It also allows the receiving thread to safely register a > cross-thread callback to be invoked immediately when a stop is > requested. > > This class is used to reimplement the UI thread to sync thread early > shutdown signal. Previously, the UI thread would try to call in to > objects owned by the sync thread. This required a workaround if the > signal arrived very early, since we couldn't guarantee the sync thread > had actually created those objects until later. The CancellationSignal > is owned by the UI thread, so it is safe to call its RequestStop() at > any point during sync initialization. The sync thread will receive the > signal when it's ready. > > The new scheme has a few advantages over the old: > - Thread ownership is simpler. The SyncBackendHost::Core, SyncManager, > ServerConnectionManager, SyncScheduler and Syncer can now claim that > all their member functions run on the sync thread. > - We no longer need to implement special case logic for when a shutdown > is requested before the SyncManager has initialized. > - In a future CL, we can take advantage of the fact that we no longer > require the special case to reduce inter-thread communication during > sync startup. This will make startup simpler and, in some cases, > improve sync startup time by as much as a few hundred milliseconds. > - This will make it easier to address crbug.com/236451. > > BUG=236451 > > Review URL: https://chromiumcodereview.appspot.com/23189021 TBR=rlarocque@chromium.org Review URL: https://codereview.chromium.org/23658030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222205 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Gracefully handle very early shutdownrlarocque@chromium.org2013-09-104-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new object to communicate cross-thread cancellation signals. This new object, the CancellationSignal, is protected by a lock. It allows the receiving thread to query whether or not a stop has been requested. It also allows the receiving thread to safely register a cross-thread callback to be invoked immediately when a stop is requested. This class is used to reimplement the UI thread to sync thread early shutdown signal. Previously, the UI thread would try to call in to objects owned by the sync thread. This required a workaround if the signal arrived very early, since we couldn't guarantee the sync thread had actually created those objects until later. The CancellationSignal is owned by the UI thread, so it is safe to call its RequestStop() at any point during sync initialization. The sync thread will receive the signal when it's ready. The new scheme has a few advantages over the old: - Thread ownership is simpler. The SyncBackendHost::Core, SyncManager, ServerConnectionManager, SyncScheduler and Syncer can now claim that all their member functions run on the sync thread. - We no longer need to implement special case logic for when a shutdown is requested before the SyncManager has initialized. - In a future CL, we can take advantage of the fact that we no longer require the special case to reduce inter-thread communication during sync startup. This will make startup simpler and, in some cases, improve sync startup time by as much as a few hundred milliseconds. - This will make it easier to address crbug.com/236451. BUG=236451 Review URL: https://chromiumcodereview.appspot.com/23189021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222154 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove ModelTypeInvalidationMaprlarocque@chromium.org2013-09-033-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | Removes the definition and all uses of ModelTypeInvalidationMap. The ModelTypeInvalidationMap was useful only for sync-related invalidations. Its existence made sense when sync was the only client for invalidations. Now that we have many invalidations clients, it makes sense to replace it with the more generic ObjectIdInvalidationMap. The reason for doing this now is that the ObjectIdInvalidationMap will soon be modified to be incompatible with the current definition of ModelTypeInvalidationMap. In order to support trickles it will be modified to allow it to contain several invalidations per ObjectId. Although it would have been possible to maintain compatibility by making a corresponding modification to ModelTypeInvalidationMap, there's really no point in having two invalidation map types. In the long run, it makes more sense to deprecate ModelTypeInvalidationMap. BUG=233437 Review URL: https://chromiumcodereview.appspot.com/23238005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221025 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Improve testing of download functionsrlarocque@chromium.org2013-08-234-59/+57
| | | | | | | | | | | | | | | | | | | | | | | Refactor the download functions so the commit to the server can be separated from the building of the commit message. This allows us to test these functions in download_unittest.cc without needing to use the heavyweight MockConnectionManager. It also lets us improve our testing of AppendClientDebugInfoIfNeeded by using less mocks and more real code. An important side benefit of this change is that it makes progress towards the removal of ModelTypeInvalidationMap, which is a step towards implementing crbug.com/233437. Also included in this change is a new TRACE_EVENT. Though it's not really new, since it was removed (accidentally) in the Syncer refactor (r209867). It's not related to this change, but it's a one-liner and I happen to be modifying nearby code. BUG=233437 Review URL: https://chromiumcodereview.appspot.com/22849021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219209 0039d316-1c4b-4281-b951-d872f2087c98
* [Android] Remove all usage of com.google.common.collectyfriedman@chromium.org2013-08-201-6/+0
| | | | | | | | | | To minimize apk size, minimize dependencies on guava. This removes 7k method definitions from the dex file. BUG=272790 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/22978010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218579 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove SyncSourceInforlarocque@chromium.org2013-08-031-18/+2
| | | | | | | | | | | | | | | | | | The SyncSourceInfo was a struct that contained a GetUpdatesSource and a ModelTypeInvalidationMap. Both of these types are in the process of being deprecated. The SyncSourceInfo itself was used only for debugging (about:sync), tests (mostly sync_scheduler_unittest.cc) and maintaining compatibility with some old function signatures. Removing the SyncSourceInfo allow us to remove dependencies on ModelTypeInvalidationMap, which is a step towards enabling invalidation "trickles" support. BUG=233437 Review URL: https://chromiumcodereview.appspot.com/19982002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215446 0039d316-1c4b-4281-b951-d872f2087c98
* Fix issue with null-value OAuth2 tokens for Android.nyquist@chromium.org2013-08-012-1/+7
| | | | | | | | | | | | | | | | | | | Currently, AndroidProfileOAuth2TokenServiceHelper crashes if the auth token returned from the account manager is null. This CL makes it possible to get null tokens back. A test is also added, and the test harness is improved to support adding null auth-tokens. This is try 2. Original CL reviewed in: https://chromiumcodereview.appspot.com/20692003 BUG=239491 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/21436002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215048 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 214841 "Fix issue with null-value OAuth2 tokens for Android."tbreisacher@chromium.org2013-07-312-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Broke check_deps on chromium.linux: http://build.chromium.org/p/chromium.linux/builders/Linux%20Builder/builds/12317/steps/check_deps/logs/stdio ERROR in src/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AndroidProfileOAuth2TokenServiceHelperTest.java Illegal include: "sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java" Because of no rule applying. Illegal include: "sync/test/android/javatests/src/org/chromium/sync/test/util/AccountHolder.java" Because of no rule applying. Illegal include: "sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java" Because of no rule applying. FAILED > Fix issue with null-value OAuth2 tokens for Android. > > Currently, AndroidProfileOAuth2TokenServiceHelper crashes if the auth > token returned from the account manager is null. This CL makes it > possible to get null tokens back. > > A test is also added, and the test harness is improved to support adding > null auth-tokens. > > BUG=239491 > NOTRY=true > > Review URL: https://chromiumcodereview.appspot.com/20692003 TBR=nyquist@chromium.org Review URL: https://codereview.chromium.org/21427002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214843 0039d316-1c4b-4281-b951-d872f2087c98
* Fix issue with null-value OAuth2 tokens for Android.nyquist@chromium.org2013-07-312-1/+7
| | | | | | | | | | | | | | | | Currently, AndroidProfileOAuth2TokenServiceHelper crashes if the auth token returned from the account manager is null. This CL makes it possible to get null tokens back. A test is also added, and the test harness is improved to support adding null auth-tokens. BUG=239491 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/20692003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214841 0039d316-1c4b-4281-b951-d872f2087c98
* Lock-free shutdown of profile sync service. Changes include:haitaol@chromium.org2013-07-316-75/+8
| | | | | | | | | | | | | | | | | | | | | | * Disconnect non-frontend processor/associator to stop accessing directory so that sync backend can be shut down without waiting. * Change non-frontend controller so that creation/destruction of processor/associator doesn't depend on valid controller. So scoped wait on stopping controller can be removed. * Move sync thread to PSS. It's created when starting first backend and destroyed on last browser thread. BUG=19757 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=210333 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=210955 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=213642 Review URL: https://chromiumcodereview.appspot.com/16770005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214500 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 213642 "Lock-free shutdown of profile sync service. Chang..."earthdok@chromium.org2013-07-256-8/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Reverting due to memory leaks. BUG=264325 > Lock-free shutdown of profile sync service. Changes include: > * Disconnect non-frontend processor/associator to stop accessing directory > so that sync backend can be shut down without waiting. > * Change non-frontend controller so that creation/destruction of > processor/associator doesn't depend on valid controller. So > scoped wait on stopping controller can be removed. > * Move sync thread to PSS. It's created when starting first backend and > destroyed on last browser thread. > > BUG=19757 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=210333 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=210955 > > Review URL: https://chromiumcodereview.appspot.com/16770005 TBR=haitaol@chromium.org Review URL: https://codereview.chromium.org/20374005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213671 0039d316-1c4b-4281-b951-d872f2087c98
* Lock-free shutdown of profile sync service. Changes include:haitaol@chromium.org2013-07-256-75/+8
| | | | | | | | | | | | | | | | | | | | * Disconnect non-frontend processor/associator to stop accessing directory so that sync backend can be shut down without waiting. * Change non-frontend controller so that creation/destruction of processor/associator doesn't depend on valid controller. So scoped wait on stopping controller can be removed. * Move sync thread to PSS. It's created when starting first backend and destroyed on last browser thread. BUG=19757 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=210333 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=210955 Review URL: https://chromiumcodereview.appspot.com/16770005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213642 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add pre-commit update avoidance mode + flagrlarocque@chromium.org2013-07-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL allows the syncer to avoid requesting updates from the server prior to a commit if the nudge tracker determines that such a request is not necessary. In general, the nudge tracker will consider such a request to be unnecessary unless the sync cycle was triggered by a local refresh request or an invalidation, or invalidations are disabled. This behavior is enabled only if explicitly requested by the client or the server. The client can enable this mode with the command-line flag '--sync-enable-get-update-avoidance'. The server can toggle it on or off with the 'pre_commit_update_avoidance' experiment. Unless at least one of these flags are set, this CL will have no effect on syncer behavior. When this experimental mode is enabled, the SyncScheduler will use the "short poll" interval rather than the "long poll". This should help clients keep in sync with each other even if the experiment breaks. Also included in this CL are some extensions to the python test server to enable manual testing of the pre_commit_update_avoidance experiment node. BUG=147685 Review URL: https://chromiumcodereview.appspot.com/19309002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212746 0039d316-1c4b-4281-b951-d872f2087c98
* Fixed fetching of OAuth2 tokens through the MockAccountManager.joaodasilva@chromium.org2013-07-191-5/+9
| | | | | | | | | | | | | | | The native side requests oauth2 tokens without an activity. The intent started to ask for permission in these cases must have the Intent.FLAG_ACTIVITY_NEW_TASK flag. Additionally, when a response bundle has an intent but has no activity then start the intent using the main context. BUG=261458 Review URL: https://chromiumcodereview.appspot.com/19699005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212509 0039d316-1c4b-4281-b951-d872f2087c98
* [Android] Unify all string log tags to use a simple constant.yfriedman@chromium.org2013-07-182-2/+2
| | | | | | | | | | | | Per attached bug, this is cheaper and it's good to a have a consistent style. BUG=146559 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/19485004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212215 0039d316-1c4b-4281-b951-d872f2087c98
* Use a direct include of the message_loop header in ppapi/, printing/, rlz/, ↵avi@chromium.org2013-07-184-4/+4
| | | | | | | | | | | | sync/. BUG=260807 TEST=none TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/19627002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212193 0039d316-1c4b-4281-b951-d872f2087c98
* [Android] Only notify when setSyncAutomatically changes.yfriedman@chromium.org2013-07-171-2/+11
| | | | | | | | | | | | This makes the mock mirror production code better and cuts out on logcat spam while running instrumentation tests as we keep notfying indefinitely. NOTRY=true Review URL: https://chromiumcodereview.appspot.com/5144752345317376 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211889 0039d316-1c4b-4281-b951-d872f2087c98
* Migrate from googleurl/ includes to url/ ones in the remaining top-level ↵tfarina@chromium.org2013-07-132-2/+2
| | | | | | | | | | | directories. BUG=229660 TBR=darin@chromium.org Review URL: https://codereview.chromium.org/18919005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211572 0039d316-1c4b-4281-b951-d872f2087c98
* Sync periodic polls always fail because of expired access tokens.pavely@chromium.org2013-07-132-0/+7
| | | | | | | | | | | | | | The issue is that poll job runs after few hours of inactivity and therefore will always fail with auth error because of expired access token. Once fresh access token is requested poll job is not retried. The change is to remember that poll timer just fired and retry poll job after credentials are updated. BUG=251307 Review URL: https://chromiumcodereview.appspot.com/18041006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211569 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Lock-free shutdown of profile sync service. Changes include:"zea@chromium.org2013-07-132-3/+8
| | | | | | | | | | | | | | | | | | Introduced shutdown crashes. See bug crbug.com/259974 for discussion. Original codereview at https://chromiumcodereview.appspot.com/16770005 This also reverts "Disconnect non-frontend processor using the processor in " due to its depdency on the above patch. Original codereview at https://chromiumcodereview.appspot.com/5878607637381120 BUG=19757,259974 TBR=haitaol@chromium.org Review URL: https://codereview.chromium.org/18890004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211506 0039d316-1c4b-4281-b951-d872f2087c98
* Lock-free shutdown of profile sync service. Changes include:haitaol@chromium.org2013-07-102-8/+3
| | | | | | | | | | | | | | | | | | * Disconnect non-frontend processor/associator to stop accessing directory so that sync backend can be shut down without waiting. * Change non-frontend controller so that creation/destruction of processor/associator doesn't depend on valid controller. So scoped wait on stopping controller can be removed. * Move sync thread to PSS. It's created when starting first backend and destroyed on last browser thread. BUG=19757 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=210333 Review URL: https://chromiumcodereview.appspot.com/16770005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210955 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Add password support to sync apizea@chromium.org2013-07-101-1/+3
| | | | | | | | | | | This change modifies the password protobuf definition and the sync generic change processor in order to support passwords custom encryption scheme. BUG=117445 Review URL: https://chromiumcodereview.appspot.com/18551007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210915 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 210333 "Lock-free shutdown of profile sync service. Chang..."kinuko@chromium.org2013-07-082-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Suspected to have introduced (flaky) SEGV crash in ProfileSyncServiceTypedUrlTest.IgnoreLocalhostURL http://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Tests%20(1)/builds/28925/steps/unit_tests/logs/stdio http://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Tests%20(dbg)(1)/builds/21682/steps/unit_tests/logs/IgnoreLocalhostURL http://build.chromium.org/p/chromium.win/builders/Win%207%20Tests%20x64%20%283%29/builds/7252/steps/unit_tests/logs/IgnoreLocalhostURL > Lock-free shutdown of profile sync service. Changes include: > * Disconnect non-frontend processor/associator to stop accessing directory > so that sync backend can be shut down without waiting. > * Change non-frontend controller so that creation/destruction of > processor/associator doesn't depend on valid controller. So > scoped wait on stopping controller can be removed. > * Move sync thread to PSS. It's created when starting first backend and > destroyed on last browser thread. > > BUG=19757 > > Review URL: https://chromiumcodereview.appspot.com/16770005 TBR=haitaol@chromium.org Review URL: https://codereview.chromium.org/18489004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210346 0039d316-1c4b-4281-b951-d872f2087c98
* Lock-free shutdown of profile sync service. Changes include:haitaol@chromium.org2013-07-082-8/+3
| | | | | | | | | | | | | | | | * Disconnect non-frontend processor/associator to stop accessing directory so that sync backend can be shut down without waiting. * Change non-frontend controller so that creation/destruction of processor/associator doesn't depend on valid controller. So scoped wait on stopping controller can be removed. * Move sync thread to PSS. It's created when starting first backend and destroyed on last browser thread. BUG=19757 Review URL: https://chromiumcodereview.appspot.com/16770005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210333 0039d316-1c4b-4281-b951-d872f2087c98
* [Android] Fix bug in sense of setting isSyncable.yfriedman@chromium.org2013-07-021-1/+1
| | | | | | | | | | | | | | | The API specifies that >0 means syncable is true. After https://codereview.chromium.org/16092014/ when Android sync settings change, we have to read-back values to make sure we have the right settings. This started causing tests to fail as we stored the wrong value. BUG=238506 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/18429002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209569 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the OWNERS that no longer work on the project.aurimas@chromium.org2013-07-011-1/+0
| | | | | | | | | Remove jcivelli@, and nileshagrawal@ who no longer work on Chrome for Android. Review URL: https://chromiumcodereview.appspot.com/18178014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209531 0039d316-1c4b-4281-b951-d872f2087c98
* [Android] Introduce in-memory cache for Android sync settings.yfriedman@chromium.org2013-06-291-11/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Checking Android sync settings appears to be cheap but masks potential slow calls and jank on the ui-thread due to many parties querying sync state. One example for slowness is due to this issuing IPCs to a separate service which may need to be re-started and load state from disk. Testing on a Galaxy Nexus shows ~50-70ms aggregrate time spent querying Android sync state reducing to <5ms for loading an initial page. There are additional checks throughout the lifetime of the app that now become in-memory lookups. Regarding the implementation: - Master Sync Automatically is account agnostic and can be cached once at startup, and only updated when a notification is received that settings have changed. - The remaining settings are per-account. On access of any of these settings, we grab the latest values for the requested account, and also update when a notification is received. Updates are infrequent and only when the signed in account changes. BUG=238506 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/16092014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209249 0039d316-1c4b-4281-b951-d872f2087c98
* Use a direct include of time headers in rlz/, skia/, sql/, sync/.avi@chromium.org2013-06-281-1/+1
| | | | | | | | | | BUG=254986 TEST=none TBR=ben@chromium.org Review URL: https://codereview.chromium.org/18031009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209152 0039d316-1c4b-4281-b951-d872f2087c98
* Add base namespace to more values in sync and elsewhere.brettw@chromium.org2013-06-211-1/+1
| | | | | | | | | | This makes sync and net compile with no "using *Value". BUG= Review URL: https://codereview.chromium.org/17034006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207907 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Handle type throttling in NudgeTrackerrlarocque@chromium.org2013-06-143-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change removes the ThrottledDataTypeTracker and moves much of its functionality into the NudgeTracker. This allows us to better control throttling behavior and fix crbug.com/155296. This CL re-routes syncer_proto_util type throttling callbacks through the SyncSession::Delegate to the SyncScheduler. It adds a timer and some related functions to the SyncScheduler, so the scheduler can now wake up, unthrottle types, and attempt a sync cycle at the exact time when throttling expires. The information about which types are currently throttled has been moved to the NudgeTracker. This allows the NudgeTracker to take type throttling into account in functions like NudgeTracker::IsSyncRequired() and NudgeTracker::RecordSuccessfulSyncCycle(). The DownloadUpdatesCommand's special case for nudge-type syncs has been extended to take throttling into account. GetCommitIdsCommand has been updated to fetch its list of throttled types from the nudge tracker. Unfortunately, this meant that committing from poll-triggered sync sessions had to be disabled, since poll sync cycles do not have access to the nudge tracker. BUG=155296, 116184 Review URL: https://chromiumcodereview.appspot.com/16402013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206475 0039d316-1c4b-4281-b951-d872f2087c98
* Use OAuth2 token for syncpavely@chromium.org2013-06-131-2/+2
| | | | | | | | | | | | | | | | | | | | ProfileSyncService requests access token from OAuth2TokenService and passes it to ServerConnectionManager through UpdateCredentials. When server returns AUTH_ERROR it gets propagated to ProfileSyncService through OnGetStatusChange call. At this point ProfileSyncService needs to invalidate old token with OAuth2TokenService and request a new one. Access token is requested in PSS::StartUp since this is the place where all preconditions are verified. There is a call to pre-request access token in Initialize and Observe after Login token is loaded. There are still two tests disabled, I'll fix them and update this CR. BUG=226464 TBR=jhawkins@chromium.org Review URL: https://chromiumcodereview.appspot.com/15421011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206224 0039d316-1c4b-4281-b951-d872f2087c98
* Rewrite scoped_ptr<T>(NULL) to use the default ctor in sync/.dcheng@chromium.org2013-06-121-2/+0
| | | | | | | | | | | This is the result of running the rewrite_scoped_ptr_ctor_null tool across all files built on Linux in the sync/ directory. BUG=173286 Review URL: https://chromiumcodereview.appspot.com/16654009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205919 0039d316-1c4b-4281-b951-d872f2087c98
* Use a direct include of strings headers in rlz/, sandbox/, skia/, sql/, sync/.avi@chromium.org2013-06-115-6/+5
| | | | | | | | | | BUG=247723 TEST=none TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/16358024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205458 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Cleanups in and around directory.hrlarocque@chromium.org2013-06-073-43/+5
| | | | | | | | | | | | | | | | | | | - Remove MockDirectorySyncerCommand (not used). - Remove MockDirectory (used only by MockDirectorySyncerCommand). - Remove Directory::InitKernelForTest (used only by MockDirectory). - Merge ChildHandles and UnsyncedMetahandles typedefs into a single Metahandles typedef. - Rearrange declarations in directory.h to match Google C++ style. - Create scoped_kernel_lock.cc; move related definitions from directory.cc to this new file. - Use DISALLOW_COPY_AND_ASSIGN instead of declaring an undefined Directory::operator= manually. BUG=245931 Review URL: https://chromiumcodereview.appspot.com/16591002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204828 0039d316-1c4b-4281-b951-d872f2087c98
* Use hash_map for syncable::Directory indicesrlarocque@chromium.org2013-06-042-4/+4
| | | | | | | | | | | | | | | | | | | | | | | The hash map is less convenient to use, but it promises much better expected algorithmic complexity for the most common directory operations. The indices converted with this patch almost never require iteration, so it makes much more sense to use a hash_map (ie. unordered_map) than a regular map. This change also introduces a new index based on the server-assigned unique tag. The server-assigned tag is set only on permanent items, so there won't be many items in this index. I ran some tests locally to confirm the new code does run faster. On certain model association tests I saw a speedup of ~10%. I doubt we'll see that much of a speedup in real world scenarios, but it could be a noticeable improvement on some of our slower platforms. BUG=238621, 115132, 241813 Review URL: https://chromiumcodereview.appspot.com/16231009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204069 0039d316-1c4b-4281-b951-d872f2087c98
* Update sync/, sql/, and printing/ to use scoped_refptr<T>::get() rather than ↵rsleevi@chromium.org2013-06-031-1/+1
| | | | | | | | | | | | | implicit "operator T*" Linux fixes BUG=110610 TBR=darin Review URL: https://chromiumcodereview.appspot.com/16298002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203651 0039d316-1c4b-4281-b951-d872f2087c98
* Use base::MessageLoop in more files.xhwang@chromium.org2013-05-302-3/+3
| | | | | | | | | | | These are either missed in the first pass, or added after the first pass. TBR=thestig@chromium.org BUG=236029 Review URL: https://codereview.chromium.org/16092013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203259 0039d316-1c4b-4281-b951-d872f2087c98
* Worker changes to prepare for lock-free shutdown.haitaol@chromium.org2013-05-292-4/+13
| | | | | | | | | | | | | | | | | | | * Make worker observe the destruction of the thread where it does work. * Make work done signal a memeber of worker and set it when worker's working thread is destroyed so that syncer won't be blocked indefinitely on work that's not gonna run. * Ref-count worker in session context so that worker remains valid when syncer is still iterating through workers but registrar has erased it from its worker map. * Add RequestStop() and Stopped() to allow worker to return early when it's stopped while waiting to run work on its working thread. This cl by itself should have no real impact because the added functions are not used. BUG=19757 Review URL: https://chromiumcodereview.appspot.com/14046031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202786 0039d316-1c4b-4281-b951-d872f2087c98
* Initial version of Test Accounts service client (attempt #2)pvalenzuela@chromium.org2013-05-136-0/+426
| | | | | | | | | | | | | | | | | | This version uses URLFetcher instead of curl. Original description (committed/reverted r198019): """ Initial version of Test Accounts service client. This client will allow Chrome Sync tests to utilize the upcoming Test Accounts service that allows short-term, exclusive access to test accounts for the purpose of testing against real servers. """ BUG= Review URL: https://chromiumcodereview.appspot.com/14591008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199805 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Report GetUpdate triggers to the serverrlarocque@chromium.org2013-05-093-16/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes use of the protocol buffers added in r198250. This adds code to the nudge tracker so it can keep more detailed information about the reasons for fetching an update. This information is copied into the per-type GetUpdateTriggers when we perform a "triggered" GetUpdate. There was no channel available to pass the nudge_tracker through to the DownloadUpdatesCommand, so it ended up being passed through a (maybe-NULL) member of the SyncSession. That's part of the reason why this change ended up touching so many files. The other reason why this change is so big is testing. Lots of tests had to be updated with some amended for the new SyncScheduler function signatures. This commit also includes quite a few test cases for the NudgeTracker itself. Because this change was delayed longer than expected, I've updated the comments in sync.proto referencing M28 to reference M29 instead. BUG=231693,138613 Review URL: https://chromiumcodereview.appspot.com/14963002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199136 0039d316-1c4b-4281-b951-d872f2087c98
* Move SpawnedTestServer to its own subdirectory.phajdan.jr@chromium.org2013-05-072-2/+2
| | | | | | | | | | | | This is a part of replacing most usages of the Python test server with an in-process C++ test server that should be easier to debug. BUG=96594 R=rch@chromium.org Review URL: https://codereview.chromium.org/14691006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198783 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Use base::MessageLoop.xhwang@chromium.org2013-05-073-3/+3
| | | | | | | | | BUG=236029 R=akalin@chromium.org Review URL: https://chromiumcodereview.appspot.com/14113050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198610 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Log age of auth tokens on authentication failurezea@chromium.org2013-05-061-1/+1
| | | | | | | | | | | | | The fetch/refresh time of the sync credentials are plumbed through to the server connection manager, which can then histogram their age in the event that there is an auth failure. BUG=none R=tim@chromium.org Review URL: https://codereview.chromium.org/14888003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198531 0039d316-1c4b-4281-b951-d872f2087c98
* GTTF: rename net::TestServer -> net::SpawnedTestServerphajdan.jr@chromium.org2013-05-031-7/+9
| | | | | | | | | | | | This is a part of replacing most usages of the Python test server with an in-process C++ test server that should be easier to debug. BUG=96594 R=rch@chromium.org Review URL: https://codereview.chromium.org/14702004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198151 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Initial version of Test Accounts service client. This client will" ↵mattm@chromium.org2013-05-033-278/+0
| | | | | | | | | | | | which failed compile on Mac bot. This reverts commit r198019. TBR=pvalenzuela@chromium.org Review URL: https://codereview.chromium.org/14892003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198039 0039d316-1c4b-4281-b951-d872f2087c98
* Initial version of Test Accounts service client. This client willpvalenzuela@chromium.org2013-05-033-0/+278
| | | | | | | | | | | | allow Chrome Sync tests to utilize the upcoming Test Accounts service that allows short-term, exclusive access to test accounts for the purpose of testing against real servers. BUG= Review URL: https://chromiumcodereview.appspot.com/14295014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198019 0039d316-1c4b-4281-b951-d872f2087c98
* Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>.erg@chromium.org2013-04-302-3/+3
| | | | | | | | | | | In r174057, enne@ added support for implicit testing to scoped_ptr<>. Removes these in sync/ and chrome/browser/sync/. BUG=232084 Review URL: https://chromiumcodereview.appspot.com/14411003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197441 0039d316-1c4b-4281-b951-d872f2087c98
* Add way to tell if device can add google accountsdtrainor@chromium.org2013-04-291-0/+9
| | | | | | | | | | Need to know if the device supports adding google accounts. BUG=235076 Review URL: https://chromiumcodereview.appspot.com/14314011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197093 0039d316-1c4b-4281-b951-d872f2087c98