Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: chromecast/browser/android/cast_window_android.cc

Issue 1142513004: Chromecast: MessageLoopProxy cleanup --> SingleThreadTaskRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromecast/browser/android/cast_window_android.h" 5 #include "chromecast/browser/android/cast_window_android.h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/single_thread_task_runner.h"
8 #include "base/thread_task_runner_handle.h"
8 #include "chromecast/browser/android/cast_window_manager.h" 9 #include "chromecast/browser/android/cast_window_manager.h"
9 #include "chromecast/browser/cast_content_window.h" 10 #include "chromecast/browser/cast_content_window.h"
10 #include "content/public/browser/devtools_agent_host.h" 11 #include "content/public/browser/devtools_agent_host.h"
11 #include "content/public/browser/navigation_controller.h" 12 #include "content/public/browser/navigation_controller.h"
12 #include "content/public/browser/navigation_entry.h" 13 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
14 #include "content/public/browser/render_view_host.h" 15 #include "content/public/browser/render_view_host.h"
15 #include "content/public/browser/render_widget_host_view.h" 16 #include "content/public/browser/render_widget_host_view.h"
16 #include "content/public/common/renderer_preferences.h" 17 #include "content/public/common/renderer_preferences.h"
17 #include "jni/CastWindowAndroid_jni.h" 18 #include "jni/CastWindowAndroid_jni.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 119 }
119 } 120 }
120 121
121 void CastWindowAndroid::CloseContents(content::WebContents* source) { 122 void CastWindowAndroid::CloseContents(content::WebContents* source) {
122 DCHECK_EQ(source, web_contents_.get()); 123 DCHECK_EQ(source, web_contents_.get());
123 124
124 // We need to delay the deletion of web_contents_ (currently for 50ms) to 125 // We need to delay the deletion of web_contents_ (currently for 50ms) to
125 // give (and guarantee) the renderer enough time to finish 'onunload' 126 // give (and guarantee) the renderer enough time to finish 'onunload'
126 // handler (but we don't want to wait any longer than that to delay the 127 // handler (but we don't want to wait any longer than that to delay the
127 // starting of next app). 128 // starting of next app).
128 base::MessageLoopProxy::current()->PostDelayedTask( 129 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
129 FROM_HERE, 130 FROM_HERE,
130 base::Bind(&CastWindowAndroid::Destroy, weak_factory_.GetWeakPtr()), 131 base::Bind(&CastWindowAndroid::Destroy, weak_factory_.GetWeakPtr()),
131 base::TimeDelta::FromMilliseconds(kWebContentsDestructionDelayInMs)); 132 base::TimeDelta::FromMilliseconds(kWebContentsDestructionDelayInMs));
132 } 133 }
133 134
134 bool CastWindowAndroid::CanOverscrollContent() const { 135 bool CastWindowAndroid::CanOverscrollContent() const {
135 return false; 136 return false;
136 } 137 }
137 138
138 bool CastWindowAndroid::AddMessageToConsole(content::WebContents* source, 139 bool CastWindowAndroid::AddMessageToConsole(content::WebContents* source,
(...skipping 14 matching lines...) Expand all
153 contents->GetRenderViewHost()->Blur(); 154 contents->GetRenderViewHost()->Blur();
154 } 155 }
155 156
156 void CastWindowAndroid::RenderProcessGone(base::TerminationStatus status) { 157 void CastWindowAndroid::RenderProcessGone(base::TerminationStatus status) {
157 LOG(ERROR) << "Render process gone: status=" << status; 158 LOG(ERROR) << "Render process gone: status=" << status;
158 Destroy(); 159 Destroy();
159 } 160 }
160 161
161 } // namespace shell 162 } // namespace shell
162 } // namespace chromecast 163 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698