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

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

Issue 1468993003: [Eraser] Remove chrome://tcmalloc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/child/child_thread_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/allocator/allocator_extension.h"
12 #include "base/base_switches.h" 11 #include "base/base_switches.h"
13 #include "base/basictypes.h" 12 #include "base/basictypes.h"
14 #include "base/command_line.h" 13 #include "base/command_line.h"
15 #include "base/debug/leak_annotations.h" 14 #include "base/debug/leak_annotations.h"
16 #include "base/debug/profiler.h" 15 #include "base/debug/profiler.h"
17 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
18 #include "base/location.h" 17 #include "base/location.h"
19 #include "base/logging.h" 18 #include "base/logging.h"
20 #include "base/message_loop/timer_slack.h" 19 #include "base/message_loop/timer_slack.h"
21 #include "base/metrics/field_trial.h" 20 #include "base/metrics/field_trial.h"
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, 650 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus,
652 OnSetProfilerStatus) 651 OnSetProfilerStatus)
653 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, 652 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData,
654 OnGetChildProfilerData) 653 OnGetChildProfilerData)
655 IPC_MESSAGE_HANDLER(ChildProcessMsg_ProfilingPhaseCompleted, 654 IPC_MESSAGE_HANDLER(ChildProcessMsg_ProfilingPhaseCompleted,
656 OnProfilingPhaseCompleted) 655 OnProfilingPhaseCompleted)
657 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded, 656 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded,
658 OnProcessBackgrounded) 657 OnProcessBackgrounded)
659 IPC_MESSAGE_HANDLER(MojoMsg_BindExternalMojoShellHandle, 658 IPC_MESSAGE_HANDLER(MojoMsg_BindExternalMojoShellHandle,
660 OnBindExternalMojoShellHandle) 659 OnBindExternalMojoShellHandle)
661 #if defined(USE_TCMALLOC)
662 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats)
663 #endif
664 IPC_MESSAGE_UNHANDLED(handled = false) 660 IPC_MESSAGE_UNHANDLED(handled = false)
665 IPC_END_MESSAGE_MAP() 661 IPC_END_MESSAGE_MAP()
666 662
667 if (handled) 663 if (handled)
668 return true; 664 return true;
669 665
670 if (msg.routing_id() == MSG_ROUTING_CONTROL) 666 if (msg.routing_id() == MSG_ROUTING_CONTROL)
671 return OnControlMessageReceived(msg); 667 return OnControlMessageReceived(msg);
672 668
673 return router_.OnMessageReceived(msg); 669 return router_.OnMessageReceived(msg);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 #elif defined(OS_WIN) 719 #elif defined(OS_WIN)
724 base::PlatformFile handle = file; 720 base::PlatformFile handle = file;
725 #endif 721 #endif
726 mojo::ScopedMessagePipeHandle message_pipe = 722 mojo::ScopedMessagePipeHandle message_pipe =
727 mojo_shell_channel_init_.Init(handle, GetIOTaskRunner()); 723 mojo_shell_channel_init_.Init(handle, GetIOTaskRunner());
728 DCHECK(message_pipe.is_valid()); 724 DCHECK(message_pipe.is_valid());
729 MojoShellConnectionImpl::CreateWithMessagePipe(message_pipe.Pass()); 725 MojoShellConnectionImpl::CreateWithMessagePipe(message_pipe.Pass());
730 #endif // defined(MOJO_SHELL_CLIENT) 726 #endif // defined(MOJO_SHELL_CLIENT)
731 } 727 }
732 728
733 #if defined(USE_TCMALLOC)
734 void ChildThreadImpl::OnGetTcmallocStats() {
735 std::string result;
736 char buffer[1024 * 32];
737 base::allocator::GetStats(buffer, sizeof(buffer));
738 result.append(buffer);
739 Send(new ChildProcessHostMsg_TcmallocStats(result));
740 }
741 #endif
742
743 ChildThreadImpl* ChildThreadImpl::current() { 729 ChildThreadImpl* ChildThreadImpl::current() {
744 return g_lazy_tls.Pointer()->Get(); 730 return g_lazy_tls.Pointer()->Get();
745 } 731 }
746 732
747 #if defined(OS_ANDROID) 733 #if defined(OS_ANDROID)
748 // The method must NOT be called on the child thread itself. 734 // The method must NOT be called on the child thread itself.
749 // It may block the child thread if so. 735 // It may block the child thread if so.
750 void ChildThreadImpl::ShutdownThread() { 736 void ChildThreadImpl::ShutdownThread() {
751 DCHECK(!ChildThreadImpl::current()) << 737 DCHECK(!ChildThreadImpl::current()) <<
752 "this method should NOT be called from child thread itself"; 738 "this method should NOT be called from child thread itself";
(...skipping 19 matching lines...) Expand all
772 void ChildThreadImpl::EnsureConnected() { 758 void ChildThreadImpl::EnsureConnected() {
773 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 759 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
774 base::Process::Current().Terminate(0, false); 760 base::Process::Current().Terminate(0, false);
775 } 761 }
776 762
777 bool ChildThreadImpl::IsInBrowserProcess() const { 763 bool ChildThreadImpl::IsInBrowserProcess() const {
778 return browser_process_io_runner_; 764 return browser_process_io_runner_;
779 } 765 }
780 766
781 } // namespace content 767 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698