OLD | NEW |
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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 480 } |
481 | 481 |
482 void ChildThread::OnDumpHandles() { | 482 void ChildThread::OnDumpHandles() { |
483 #if defined(OS_WIN) | 483 #if defined(OS_WIN) |
484 scoped_refptr<HandleEnumerator> handle_enum( | 484 scoped_refptr<HandleEnumerator> handle_enum( |
485 new HandleEnumerator( | 485 new HandleEnumerator( |
486 CommandLine::ForCurrentProcess()->HasSwitch( | 486 CommandLine::ForCurrentProcess()->HasSwitch( |
487 switches::kAuditAllHandles))); | 487 switches::kAuditAllHandles))); |
488 handle_enum->EnumerateHandles(); | 488 handle_enum->EnumerateHandles(); |
489 Send(new ChildProcessHostMsg_DumpHandlesDone); | 489 Send(new ChildProcessHostMsg_DumpHandlesDone); |
490 return; | 490 #else |
| 491 NOTIMPLEMENTED(); |
491 #endif | 492 #endif |
492 | |
493 NOTIMPLEMENTED(); | |
494 } | 493 } |
495 | 494 |
496 #if defined(USE_TCMALLOC) | 495 #if defined(USE_TCMALLOC) |
497 void ChildThread::OnGetTcmallocStats() { | 496 void ChildThread::OnGetTcmallocStats() { |
498 std::string result; | 497 std::string result; |
499 char buffer[1024 * 32]; | 498 char buffer[1024 * 32]; |
500 base::allocator::GetStats(buffer, sizeof(buffer)); | 499 base::allocator::GetStats(buffer, sizeof(buffer)); |
501 result.append(buffer); | 500 result.append(buffer); |
502 Send(new ChildProcessHostMsg_TcmallocStats(result)); | 501 Send(new ChildProcessHostMsg_TcmallocStats(result)); |
503 } | 502 } |
(...skipping 11 matching lines...) Expand all Loading... |
515 "this method should NOT be called from child thread itself"; | 514 "this method should NOT be called from child thread itself"; |
516 { | 515 { |
517 base::AutoLock lock(g_lazy_child_thread_lock.Get()); | 516 base::AutoLock lock(g_lazy_child_thread_lock.Get()); |
518 while (!g_child_thread) | 517 while (!g_child_thread) |
519 g_lazy_child_thread_cv.Get().Wait(); | 518 g_lazy_child_thread_cv.Get().Wait(); |
520 } | 519 } |
521 DCHECK_NE(base::MessageLoop::current(), g_child_thread->message_loop()); | 520 DCHECK_NE(base::MessageLoop::current(), g_child_thread->message_loop()); |
522 g_child_thread->message_loop()->PostTask( | 521 g_child_thread->message_loop()->PostTask( |
523 FROM_HERE, base::Bind(&QuitMainThreadMessageLoop)); | 522 FROM_HERE, base::Bind(&QuitMainThreadMessageLoop)); |
524 } | 523 } |
525 | |
526 #endif | 524 #endif |
527 | 525 |
528 void ChildThread::OnProcessFinalRelease() { | 526 void ChildThread::OnProcessFinalRelease() { |
529 if (on_channel_error_called_) { | 527 if (on_channel_error_called_) { |
530 base::MessageLoop::current()->Quit(); | 528 base::MessageLoop::current()->Quit(); |
531 return; | 529 return; |
532 } | 530 } |
533 | 531 |
534 // The child process shutdown sequence is a request response based mechanism, | 532 // The child process shutdown sequence is a request response based mechanism, |
535 // where we send out an initial feeler request to the child process host | 533 // where we send out an initial feeler request to the child process host |
536 // instance in the browser to verify if it's ok to shutdown the child process. | 534 // instance in the browser to verify if it's ok to shutdown the child process. |
537 // The browser then sends back a response if it's ok to shutdown. This avoids | 535 // The browser then sends back a response if it's ok to shutdown. This avoids |
538 // race conditions if the process refcount is 0 but there's an IPC message | 536 // race conditions if the process refcount is 0 but there's an IPC message |
539 // inflight that would addref it. | 537 // inflight that would addref it. |
540 Send(new ChildProcessHostMsg_ShutdownRequest); | 538 Send(new ChildProcessHostMsg_ShutdownRequest); |
541 } | 539 } |
542 | 540 |
543 void ChildThread::EnsureConnected() { | 541 void ChildThread::EnsureConnected() { |
544 VLOG(0) << "ChildThread::EnsureConnected()"; | 542 VLOG(0) << "ChildThread::EnsureConnected()"; |
545 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 543 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
546 } | 544 } |
547 | 545 |
548 } // namespace content | 546 } // namespace content |
OLD | NEW |