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

Unified Diff: android_webview/renderer/aw_execution_termination_filter.cc

Issue 536593004: Revert "Merge 281715 "[Android WebView] Terminate execution of stuck JS ..."" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2062
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/renderer/aw_execution_termination_filter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/renderer/aw_execution_termination_filter.cc
diff --git a/android_webview/renderer/aw_execution_termination_filter.cc b/android_webview/renderer/aw_execution_termination_filter.cc
deleted file mode 100644
index 75f130dbcb07e71cfad1f4c0564202034af53e87..0000000000000000000000000000000000000000
--- a/android_webview/renderer/aw_execution_termination_filter.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "android_webview/renderer/aw_execution_termination_filter.h"
-
-#include <v8.h>
-
-#include "android_webview/common/render_view_messages.h"
-#include "base/message_loop/message_loop_proxy.h"
-
-namespace {
-const int kTerminationTimeoutInSeconds = 3;
-} // namespace
-
-namespace android_webview {
-
-AwExecutionTerminationFilter::AwExecutionTerminationFilter(
- const scoped_refptr<base::MessageLoopProxy>& io_message_loop,
- const scoped_refptr<base::MessageLoopProxy>& main_message_loop)
- : io_message_loop_(io_message_loop),
- main_message_loop_(main_message_loop),
- render_thread_isolate_(NULL) {
-}
-
-AwExecutionTerminationFilter::~AwExecutionTerminationFilter() {
-}
-
-void AwExecutionTerminationFilter::SetRenderThreadIsolate(
- v8::Isolate* isolate) {
- render_thread_isolate_ = isolate;
-}
-
-bool AwExecutionTerminationFilter::OnMessageReceived(
- const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(AwExecutionTerminationFilter, message)
- IPC_MESSAGE_HANDLER(AwViewMsg_CheckRenderThreadResponsiveness,
- OnCheckRenderThreadResponsiveness)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-void AwExecutionTerminationFilter::OnCheckRenderThreadResponsiveness() {
- termination_timer_.Start(
- FROM_HERE,
- base::TimeDelta::FromSeconds(kTerminationTimeoutInSeconds),
- base::Bind(&AwExecutionTerminationFilter::TerminateExecution, this));
- // Post a request to stop the timer via render thread's message loop
- // to ensure that render thread is responsive.
- main_message_loop_->PostTask(
- FROM_HERE,
- base::Bind(&AwExecutionTerminationFilter::StopTimerOnMainThread,
- this));
-}
-
-void AwExecutionTerminationFilter::StopTimerOnMainThread() {
- io_message_loop_->PostTask(
- FROM_HERE,
- base::Bind(&AwExecutionTerminationFilter::StopTimer, this));
-}
-
-void AwExecutionTerminationFilter::StopTimer() {
- termination_timer_.Stop();
-}
-
-void AwExecutionTerminationFilter::TerminateExecution() {
- if (render_thread_isolate_) {
- LOG(WARNING) << "Trying to terminate JavaScript execution because "
- "renderer is unresponsive";
- v8::V8::TerminateExecution(render_thread_isolate_);
- }
-}
-
-} // namespace android_webview
« no previous file with comments | « android_webview/renderer/aw_execution_termination_filter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698