summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-10 18:52:41 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-10 18:52:41 +0000
commitced292e33a26f9b0330657d5d3ec9e6f1663a742 (patch)
tree1302cd93d5b8f0afc09c6b6f71b7f4a4fb9528f2 /cc
parenta256cbedd25f336fd3a4abca4ec4b54b5f640ae5 (diff)
downloadchromium_src-ced292e33a26f9b0330657d5d3ec9e6f1663a742.zip
chromium_src-ced292e33a26f9b0330657d5d3ec9e6f1663a742.tar.gz
chromium_src-ced292e33a26f9b0330657d5d3ec9e6f1663a742.tar.bz2
Fix LTHI shutdown crash when disabling vsync immediately
Before this, scheduler is destroyed after LTHI. Scheduler disables vsync in its destructor, which when the notification is propagated immediately from VSyncTimeSource (in Android WebView), it crashes in ThreadProxy::RequestVSyncNotification because LTHI is already gone. Fix by destroying scheduler before LTHI. BUG= Review URL: https://chromiumcodereview.appspot.com/15057006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199513 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/trees/layer_tree_host_unittest.cc22
-rw-r--r--cc/trees/thread_proxy.cc2
2 files changed, 23 insertions, 1 deletions
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 8be478e..4591f14 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -2318,6 +2318,28 @@ class LayerTreeHostTestVSyncNotification : public LayerTreeHostTest {
MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification);
+class LayerTreeHostTestVSyncNotificationShutdownWhileEnabled
+ : public LayerTreeHostTest {
+ public:
+ virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ settings->render_vsync_notification_enabled = true;
+ settings->synchronously_disable_vsync = true;
+ }
+
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+
+ virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ // The vsync notification is turned off now but will get enabled once we
+ // return. End test while it's enabled.
+ ImplThread()->PostTask(base::Bind(
+ &LayerTreeHostTestVSyncNotification::EndTest, base::Unretained(this)));
+ }
+
+ virtual void AfterTest() OVERRIDE {}
+};
+
+MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotificationShutdownWhileEnabled);
+
class LayerTreeHostTestInputDrivenRendering : public LayerTreeHostTest {
public:
virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 6ec17c8..86f4381 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -1218,8 +1218,8 @@ void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
layer_tree_host_impl_->resource_provider());
layer_tree_host_impl_->EnableVSyncNotification(false);
input_handler_client_on_impl_thread_.reset();
- layer_tree_host_impl_.reset();
scheduler_on_impl_thread_.reset();
+ layer_tree_host_impl_.reset();
weak_factory_on_impl_thread_.InvalidateWeakPtrs();
vsync_client_ = NULL;
completion->Signal();