From e19d4ef3a1fd8d287ea198b1bf37241d2046a1cc Mon Sep 17 00:00:00 2001 From: alexclarke Date: Fri, 9 Jan 2015 09:45:40 -0800 Subject: [PATCH] Fix CrOS FileManagerBrowserTest with scheduler enabled The timeouts in OpenAudioFiles/FileManagerBrowserTest where due to a task reordering which caused audioPlayerApp.closeWindowAndWait to never complete because the call to getWindows failed silently. Patches 837203002 and 832183008 must be submitted first. BUG=432129, 444574 Review URL: https://codereview.chromium.org/838193002 Cr-Commit-Position: refs/heads/master@{#310791} --- content/public/test/mock_render_thread.cc | 2 +- content/renderer/render_widget.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/public/test/mock_render_thread.cc b/content/public/test/mock_render_thread.cc index 3d75afcb84bb..cdd96b8a0913 100644 --- a/content/public/test/mock_render_thread.cc +++ b/content/public/test/mock_render_thread.cc @@ -63,7 +63,7 @@ bool MockRenderThread::Send(IPC::Message* msg) { } scoped_refptr MockRenderThread::GetTaskRunner() { - return scoped_refptr(); + return base::MessageLoopProxy::current(); } IPC::SyncChannel* MockRenderThread::GetChannel() { diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 1f1627271570..f3e5a6278614 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -835,7 +835,7 @@ void RenderWidget::OnClose() { // If there is a Send call on the stack, then it could be dangerous to close // now. Post a task that only gets invoked when there are no nested message // loops. - base::MessageLoop::current()->PostNonNestableTask( + RenderThread::Get()->GetTaskRunner()->PostNonNestableTask( FROM_HERE, base::Bind(&RenderWidget::Close, this)); // Balances the AddRef taken when we called AddRoute. @@ -1507,7 +1507,7 @@ void RenderWidget::closeWidgetSoon() { // could be closed before the JS finishes executing. So instead, post a // message back to the message loop, which won't run until the JS is // complete, and then the Close message can be sent. - base::MessageLoop::current()->PostTask( + RenderThread::Get()->GetTaskRunner()->PostTask( FROM_HERE, base::Bind(&RenderWidget::DoDeferredClose, this)); } -- 2.11.4.GIT