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

Unified Diff: content/renderer/input/input_event_filter.cc

Issue 281073002: NOT FOR REVIEW: Adding prioritized incoming task queue to renderers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prioritize input events Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/input/input_event_filter.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/input/input_event_filter.cc
diff --git a/content/renderer/input/input_event_filter.cc b/content/renderer/input/input_event_filter.cc
index cd5a8cd36c7b383a3145b213c1745c33ef68a3c7..6d9883234a7c8cf4dcb906551dfc48145be5d94d 100644
--- a/content/renderer/input/input_event_filter.cc
+++ b/content/renderer/input/input_event_filter.cc
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/location.h"
+#include "base/message_loop/high_priority_task_runner.h"
#include "base/message_loop/message_loop_proxy.h"
#include "cc/input/input_handler.h"
#include "content/common/input/did_overscroll_params.h"
@@ -134,14 +135,25 @@ void InputEventFilter::ForwardToHandler(const IPC::Message& message) {
"message_type", GetInputMessageTypeName(message));
if (message.type() != InputMsg_HandleInputEvent::ID) {
- TRACE_EVENT_INSTANT0(
- "input",
- "InputEventFilter::ForwardToHandler::ForwardToMainListener",
- TRACE_EVENT_SCOPE_THREAD);
- main_loop_->PostTask(
- FROM_HERE,
- base::Bind(&InputEventFilter::ForwardToMainListener,
- this, message));
+ if (high_priority_task_runner_.get()) {
+ TRACE_EVENT_INSTANT0(
+ "input",
+ "InputEventFilter::ForwardToHandler::ForwardToMainListenerHigh",
+ TRACE_EVENT_SCOPE_THREAD);
+ high_priority_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&InputEventFilter::ForwardToMainListener,
+ this, message));
+ } else {
+ TRACE_EVENT_INSTANT0(
+ "input",
+ "InputEventFilter::ForwardToHandler::ForwardToMainListener",
+ TRACE_EVENT_SCOPE_THREAD);
+ main_loop_->PostTask(
+ FROM_HERE,
+ base::Bind(&InputEventFilter::ForwardToMainListener,
+ this, message));
+ }
return;
}
@@ -157,16 +169,27 @@ void InputEventFilter::ForwardToHandler(const IPC::Message& message) {
InputEventAckState ack = handler_.Run(routing_id, event, &latency_info);
if (ack == INPUT_EVENT_ACK_STATE_NOT_CONSUMED) {
- TRACE_EVENT_INSTANT0(
- "input",
- "InputEventFilter::ForwardToHandler::ForwardToMainListener",
- TRACE_EVENT_SCOPE_THREAD);
IPC::Message new_msg = InputMsg_HandleInputEvent(
routing_id, event, latency_info, is_keyboard_shortcut);
- main_loop_->PostTask(
- FROM_HERE,
- base::Bind(&InputEventFilter::ForwardToMainListener,
- this, new_msg));
+ if (high_priority_task_runner_.get()) {
+ TRACE_EVENT_INSTANT0(
+ "input",
+ "InputEventFilter::ForwardToHandler::ForwardToMainListenerHigh",
+ TRACE_EVENT_SCOPE_THREAD);
+ high_priority_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&InputEventFilter::ForwardToMainListener,
+ this, new_msg));
+ } else {
+ TRACE_EVENT_INSTANT0(
+ "input",
+ "InputEventFilter::ForwardToHandler::ForwardToMainListener",
+ TRACE_EVENT_SCOPE_THREAD);
+ main_loop_->PostTask(
+ FROM_HERE,
+ base::Bind(&InputEventFilter::ForwardToMainListener,
+ this, new_msg));
+ }
return;
}
@@ -199,4 +222,9 @@ void InputEventFilter::SendMessageOnIOThread(const IPC::Message& message) {
sender_->Send(new IPC::Message(message));
}
+void InputEventFilter::SetHighPriorityTaskRunner(
+ scoped_refptr<base::HighPriorityTaskRunner> high_priority_task_runner) {
+ high_priority_task_runner_ = high_priority_task_runner;
+}
+
} // namespace content
« no previous file with comments | « content/renderer/input/input_event_filter.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698