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

Unified Diff: content/browser/renderer_host/render_message_filter.cc

Issue 2334533002: base: Move renderer threads to the appropriate cpuset. (Closed)
Patch Set: revert to CHECK_NE Created 4 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 | « content/browser/renderer_host/render_message_filter.h ('k') | content/child/child_process.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_message_filter.cc
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 9e2aa1c63738e4396a14e26bb2b503987dfa7b76..1c6b5d7efa5f90530949ce2fbbc59c7839449657 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -89,6 +89,11 @@
#include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
#endif
+#if defined(OS_LINUX)
+#include "base/linux_util.h"
+#include "base/threading/platform_thread.h"
+#endif
+
namespace content {
namespace {
@@ -204,6 +209,10 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
OnAllocateLockedDiscardableSharedMemory)
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedDiscardableSharedMemory,
OnDeletedDiscardableSharedMemory)
+#if defined(OS_LINUX)
+ IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SetThreadPriority,
+ OnSetThreadPriority)
+#endif
IPC_MESSAGE_HANDLER_DELAY_REPLY(RenderProcessHostMsg_Keygen, OnKeygen)
IPC_MESSAGE_HANDLER(RenderProcessHostMsg_DidGenerateCacheableMetadata,
OnCacheableMetadataAvailable)
@@ -414,6 +423,35 @@ void RenderMessageFilter::OnDeletedDiscardableSharedMemory(
this, id));
}
+#if defined(OS_LINUX)
+void RenderMessageFilter::SetThreadPriorityOnFileThread(
+ base::PlatformThreadId ns_tid,
+ base::ThreadPriority priority) {
+ bool ns_pid_supported = false;
+ pid_t peer_tid = base::FindThreadID(peer_pid(), ns_tid, &ns_pid_supported);
+ if (peer_tid == -1) {
+ if (ns_pid_supported)
+ DLOG(WARNING) << "Could not find tid";
+ return;
+ }
+
+ if (peer_tid == peer_pid()) {
+ DLOG(WARNING) << "Changing priority of main thread is not allowed";
+ return;
+ }
+
+ base::PlatformThread::SetThreadPriority(peer_tid, priority);
+}
+
+void RenderMessageFilter::OnSetThreadPriority(base::PlatformThreadId ns_tid,
+ base::ThreadPriority priority) {
+ BrowserThread::PostTask(
+ BrowserThread::FILE_USER_BLOCKING, FROM_HERE,
+ base::Bind(&RenderMessageFilter::SetThreadPriorityOnFileThread, this,
+ ns_tid, priority));
+}
+#endif
+
void RenderMessageFilter::OnCacheableMetadataAvailable(
const GURL& url,
base::Time expected_response_time,
« no previous file with comments | « content/browser/renderer_host/render_message_filter.h ('k') | content/child/child_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698