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

Side by Side Diff: content/browser/renderer_host/render_message_filter.cc

Issue 2334533002: base: Move renderer threads to the appropriate cpuset. (Closed)
Patch Set: use file thread 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_message_filter.h" 5 #include "content/browser/renderer_host/render_message_filter.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <string.h> 8 #include <string.h>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 #endif 82 #endif
83 83
84 #if defined(OS_ANDROID) 84 #if defined(OS_ANDROID)
85 #include "content/browser/media/android/media_throttler.h" 85 #include "content/browser/media/android/media_throttler.h"
86 #endif 86 #endif
87 87
88 #if defined(OS_MACOSX) 88 #if defined(OS_MACOSX)
89 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" 89 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
90 #endif 90 #endif
91 91
92 #if defined(OS_LINUX)
93 #include "base/linux_util.h"
94 #include "base/threading/platform_thread.h"
95 #endif
96
92 namespace content { 97 namespace content {
93 namespace { 98 namespace {
94 99
95 const uint32_t kFilteredMessageClasses[] = { 100 const uint32_t kFilteredMessageClasses[] = {
96 ChildProcessMsgStart, RenderProcessMsgStart, ViewMsgStart, 101 ChildProcessMsgStart, RenderProcessMsgStart, ViewMsgStart,
97 }; 102 };
98 103
99 #if defined(OS_MACOSX) 104 #if defined(OS_MACOSX)
100 void ResizeHelperHandleMsgOnUIThread(int render_process_id, 105 void ResizeHelperHandleMsgOnUIThread(int render_process_id,
101 const IPC::Message& message) { 106 const IPC::Message& message) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 OnDeletedGpuMemoryBuffer) 202 OnDeletedGpuMemoryBuffer)
198 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_AllocatedSharedBitmap, 203 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_AllocatedSharedBitmap,
199 OnAllocatedSharedBitmap) 204 OnAllocatedSharedBitmap)
200 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedSharedBitmap, 205 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedSharedBitmap,
201 OnDeletedSharedBitmap) 206 OnDeletedSharedBitmap)
202 IPC_MESSAGE_HANDLER_DELAY_REPLY( 207 IPC_MESSAGE_HANDLER_DELAY_REPLY(
203 ChildProcessHostMsg_SyncAllocateLockedDiscardableSharedMemory, 208 ChildProcessHostMsg_SyncAllocateLockedDiscardableSharedMemory,
204 OnAllocateLockedDiscardableSharedMemory) 209 OnAllocateLockedDiscardableSharedMemory)
205 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedDiscardableSharedMemory, 210 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedDiscardableSharedMemory,
206 OnDeletedDiscardableSharedMemory) 211 OnDeletedDiscardableSharedMemory)
212 #if defined(OS_LINUX)
213 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SetThreadPriority,
214 OnSetThreadPriority)
215 #endif
207 IPC_MESSAGE_HANDLER_DELAY_REPLY(RenderProcessHostMsg_Keygen, OnKeygen) 216 IPC_MESSAGE_HANDLER_DELAY_REPLY(RenderProcessHostMsg_Keygen, OnKeygen)
208 IPC_MESSAGE_HANDLER(RenderProcessHostMsg_DidGenerateCacheableMetadata, 217 IPC_MESSAGE_HANDLER(RenderProcessHostMsg_DidGenerateCacheableMetadata,
209 OnCacheableMetadataAvailable) 218 OnCacheableMetadataAvailable)
210 IPC_MESSAGE_HANDLER( 219 IPC_MESSAGE_HANDLER(
211 RenderProcessHostMsg_DidGenerateCacheableMetadataInCacheStorage, 220 RenderProcessHostMsg_DidGenerateCacheableMetadataInCacheStorage,
212 OnCacheableMetadataAvailableForCacheStorage) 221 OnCacheableMetadataAvailableForCacheStorage)
213 #if defined(OS_MACOSX) 222 #if defined(OS_MACOSX)
214 IPC_MESSAGE_HANDLER_DELAY_REPLY(RenderProcessHostMsg_LoadFont, OnLoadFont) 223 IPC_MESSAGE_HANDLER_DELAY_REPLY(RenderProcessHostMsg_LoadFont, OnLoadFont)
215 #endif 224 #endif
216 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaLogEvents, OnMediaLogEvents) 225 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaLogEvents, OnMediaLogEvents)
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 416
408 void RenderMessageFilter::OnDeletedDiscardableSharedMemory( 417 void RenderMessageFilter::OnDeletedDiscardableSharedMemory(
409 DiscardableSharedMemoryId id) { 418 DiscardableSharedMemoryId id) {
410 BrowserThread::PostTask( 419 BrowserThread::PostTask(
411 BrowserThread::FILE_USER_BLOCKING, FROM_HERE, 420 BrowserThread::FILE_USER_BLOCKING, FROM_HERE,
412 base::Bind( 421 base::Bind(
413 &RenderMessageFilter::DeletedDiscardableSharedMemoryOnFileThread, 422 &RenderMessageFilter::DeletedDiscardableSharedMemoryOnFileThread,
414 this, id)); 423 this, id));
415 } 424 }
416 425
426 #if defined(OS_LINUX)
427 void RenderMessageFilter::SetThreadPriorityOnFileThread(
428 base::PlatformThreadId ns_tid,
429 base::ThreadPriority priority) {
430 bool ns_pid_supported = false;
431 pid_t peer_tid = base::FindThreadID(peer_pid(), ns_tid, &ns_pid_supported);
432 if (peer_tid == -1) {
433 if (ns_pid_supported)
434 DLOG(WARNING) << "Could not find tid";
435 return;
436 }
437
438 if (peer_tid == peer_pid()) {
439 DLOG(WARNING) << "Changing priority of main thread is not allowed";
Nico 2016/09/19 20:49:30 remove (?)
reveman 2016/09/19 21:43:39 Remove the warning log for this case? I'd like to
440 return;
441 }
442
443 base::PlatformThread::SetThreadPriority(peer_tid, priority);
444 }
445
446 void RenderMessageFilter::OnSetThreadPriority(base::PlatformThreadId ns_tid,
447 base::ThreadPriority priority) {
448 BrowserThread::PostTask(
449 BrowserThread::FILE_USER_BLOCKING, FROM_HERE,
450 base::Bind(&RenderMessageFilter::SetThreadPriorityOnFileThread, this,
451 ns_tid, priority));
452 }
453 #endif
454
417 void RenderMessageFilter::OnCacheableMetadataAvailable( 455 void RenderMessageFilter::OnCacheableMetadataAvailable(
418 const GURL& url, 456 const GURL& url,
419 base::Time expected_response_time, 457 base::Time expected_response_time,
420 const std::vector<char>& data) { 458 const std::vector<char>& data) {
421 net::HttpCache* cache = request_context_->GetURLRequestContext()-> 459 net::HttpCache* cache = request_context_->GetURLRequestContext()->
422 http_transaction_factory()->GetCache(); 460 http_transaction_factory()->GetCache();
423 if (!cache) 461 if (!cache)
424 return; 462 return;
425 463
426 // Use the same priority for the metadata write as for script 464 // Use the same priority for the metadata write as for script
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 void RenderMessageFilter::OnDeletedGpuMemoryBuffer( 678 void RenderMessageFilter::OnDeletedGpuMemoryBuffer(
641 gfx::GpuMemoryBufferId id, 679 gfx::GpuMemoryBufferId id,
642 const gpu::SyncToken& sync_token) { 680 const gpu::SyncToken& sync_token) {
643 DCHECK(BrowserGpuMemoryBufferManager::current()); 681 DCHECK(BrowserGpuMemoryBufferManager::current());
644 682
645 BrowserGpuMemoryBufferManager::current()->ChildProcessDeletedGpuMemoryBuffer( 683 BrowserGpuMemoryBufferManager::current()->ChildProcessDeletedGpuMemoryBuffer(
646 id, PeerHandle(), render_process_id_, sync_token); 684 id, PeerHandle(), render_process_id_, sync_token);
647 } 685 }
648 686
649 } // namespace content 687 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698