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

Side by Side Diff: content/child/child_thread.cc

Issue 305533006: Control process backgrounding from within the child process on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix other platforms. Created 6 years, 6 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 | Annotate | Revision Log
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/child/child_thread.h" 5 #include "content/child/child_thread.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) 433 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown)
434 #if defined(IPC_MESSAGE_LOG_ENABLED) 434 #if defined(IPC_MESSAGE_LOG_ENABLED)
435 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, 435 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled,
436 OnSetIPCLoggingEnabled) 436 OnSetIPCLoggingEnabled)
437 #endif 437 #endif
438 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, 438 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus,
439 OnSetProfilerStatus) 439 OnSetProfilerStatus)
440 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, 440 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData,
441 OnGetChildProfilerData) 441 OnGetChildProfilerData)
442 IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles) 442 IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles)
443 #if defined(OS_WIN)
444 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded,
445 OnProcessBackgrounded)
446 #endif
443 #if defined(USE_TCMALLOC) 447 #if defined(USE_TCMALLOC)
444 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats) 448 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats)
445 #endif 449 #endif
446 IPC_MESSAGE_UNHANDLED(handled = false) 450 IPC_MESSAGE_UNHANDLED(handled = false)
447 IPC_END_MESSAGE_MAP() 451 IPC_END_MESSAGE_MAP()
448 452
449 if (handled) 453 if (handled)
450 return true; 454 return true;
451 455
452 if (msg.routing_id() == MSG_ROUTING_CONTROL) 456 if (msg.routing_id() == MSG_ROUTING_CONTROL)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // race conditions if the process refcount is 0 but there's an IPC message 545 // race conditions if the process refcount is 0 but there's an IPC message
542 // inflight that would addref it. 546 // inflight that would addref it.
543 Send(new ChildProcessHostMsg_ShutdownRequest); 547 Send(new ChildProcessHostMsg_ShutdownRequest);
544 } 548 }
545 549
546 void ChildThread::EnsureConnected() { 550 void ChildThread::EnsureConnected() {
547 VLOG(0) << "ChildThread::EnsureConnected()"; 551 VLOG(0) << "ChildThread::EnsureConnected()";
548 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); 552 base::KillProcess(base::GetCurrentProcessHandle(), 0, false);
549 } 553 }
550 554
555 #if defined(OS_WIN)
556 void ChildThread::OnProcessBackgrounded(bool background) {
557 base::Process::Current().SetProcessBackgrounded(background);
nasko 2014/05/28 23:08:37 Out of curiosity, does that work from inside the s
DaleCurtis 2014/05/29 00:06:59 Yup, I've confirmed the cpu, io priorities of the
558 }
559 #endif
560
551 } // namespace content 561 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698