Sync: store FakeServer as WeakPtr
commit4f4dc3834e1aa811300703074f824685d2cdeabc
authorpvalenzuela <pvalenzuela@chromium.org>
Fri, 26 Jun 2015 18:38:59 +0000 (26 11:38 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 26 Jun 2015 18:39:30 +0000 (26 18:39 +0000)
tree30b55c2c21696f6bbe29175956400f0921ca41f6
parentac53d3da52014db50e638e96fd9f52817072fd64
Sync: store FakeServer as WeakPtr

This CL changes the FakeServerNetworkResources stack to store FakeServer
as a WeakPtr. This is done because FakeServerHttpPostProvider posts a
task to another thread and FakeServer may be deleted before the task
executes.

This CL adds a ThreadChecker to FakeServer to ensure that all actions
(especially AsWeakPtr() and destruction) happen on the same thread. As
a result of this thread restriction, FakeServerHelper has been changed
to call all FakeServer methods on the UI thread.

FakeServerHttpPostProvider's task-posting has also been reconfigured to
be cleaner. This class now calls PostTask (instead of unnecessarily
calling PostNonNestableTask previously) and has removed the possibility
of FakeServer::HandleCommand (UI thread) calling a method on
FakeServerHttpPostProvider (Sync thread).

BUG=481192

Review URL: https://codereview.chromium.org/1149723007

Cr-Commit-Position: refs/heads/master@{#336422}
chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FakeServerHelper.java
chrome/browser/sync/test/integration/sync_test.cc
sync/test/fake_server/android/fake_server_helper_android.cc
sync/test/fake_server/fake_server.cc
sync/test/fake_server/fake_server.h
sync/test/fake_server/fake_server_http_post_provider.cc
sync/test/fake_server/fake_server_http_post_provider.h
sync/test/fake_server/fake_server_network_resources.cc
sync/test/fake_server/fake_server_network_resources.h