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

Unified Diff: content/child/child_resource_message_filter.cc

Issue 242103007: NOT FOR REVIEW - prioritize fonts Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 | « base/message_loop/message_loop.cc ('k') | content/child/resource_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_resource_message_filter.cc
diff --git a/content/child/child_resource_message_filter.cc b/content/child/child_resource_message_filter.cc
index 0a761713ad4ad857c89149d6a9230152643af791..961638c8cda639ef0dff3f7ffe1e5efdf46a8adf 100644
--- a/content/child/child_resource_message_filter.cc
+++ b/content/child/child_resource_message_filter.cc
@@ -9,9 +9,23 @@
#include "base/thread_task_runner_handle.h"
#include "content/child/resource_dispatcher.h"
#include "content/common/resource_messages.h"
+#include "content/renderer/renderer_high_priority_task_queue.h"
namespace content {
+void ResourceDispatchedOnMessageReceived(
+ ResourceDispatcher* resource_dispatcher, const IPC::Message& message) {
+ resource_dispatcher->OnMessageReceived(message);
+}
+
+void MarkFontNormalExecuteTaskPosition() {
+ TRACE_EVENT0("simon", "MarkFont_Normal");
+}
+
+void MarkFontHighPriorityExecuteTaskPosition() {
+ TRACE_EVENT0("simon", "MarkFont_High");
+}
+
ChildResourceMessageFilter::ChildResourceMessageFilter(
ResourceDispatcher* resource_dispatcher)
: main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
@@ -24,11 +38,32 @@ bool ChildResourceMessageFilter::OnMessageReceived(
if (message.type() == ResourceMsg_RequestComplete::ID ||
message.type() == ResourceMsg_ReceivedResponse::ID ||
message.type() == ResourceMsg_ReceivedRedirect::ID) {
+ if (resource_dispatcher_->IsPendingRequestFontType(message)) {
+ RendererHighPriorityTaskQueue::PostTask(FROM_HERE, base::Bind(
+ &ResourceDispatcher::set_io_timestamp,
+ base::Unretained(resource_dispatcher_),
+ base::TimeTicks::Now()));
+ } else {
+ main_thread_task_runner_->PostTask(FROM_HERE, base::Bind(
+ &ResourceDispatcher::set_io_timestamp,
+ base::Unretained(resource_dispatcher_),
+ base::TimeTicks::Now()));
+ }
+ }
+
+ if (resource_dispatcher_->IsPendingRequestFontType(message)) {
main_thread_task_runner_->PostTask(FROM_HERE, base::Bind(
- &ResourceDispatcher::set_io_timestamp,
- base::Unretained(resource_dispatcher_),
- base::TimeTicks::Now()));
+ &MarkFontNormalExecuteTaskPosition));
+
+ RendererHighPriorityTaskQueue::PostTask(FROM_HERE, base::Bind(
+ &ResourceDispatchedOnMessageReceived,
+ base::Unretained(resource_dispatcher_),
+ message));
+ RendererHighPriorityTaskQueue::PostTask(FROM_HERE, base::Bind(
+ &MarkFontHighPriorityExecuteTaskPosition));
+ return true;
}
+
return false;
}
« no previous file with comments | « base/message_loop/message_loop.cc ('k') | content/child/resource_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698