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

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

Issue 985773002: Introducing phased profiling framework (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@write_to_file
Patch Set: Created 5 years, 9 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/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
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg) 520 IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg)
521 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) 521 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown)
522 #if defined(IPC_MESSAGE_LOG_ENABLED) 522 #if defined(IPC_MESSAGE_LOG_ENABLED)
523 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, 523 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled,
524 OnSetIPCLoggingEnabled) 524 OnSetIPCLoggingEnabled)
525 #endif 525 #endif
526 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, 526 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus,
527 OnSetProfilerStatus) 527 OnSetProfilerStatus)
528 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, 528 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData,
529 OnGetChildProfilerData) 529 OnGetChildProfilerData)
530 IPC_MESSAGE_HANDLER(ChildProcessMsg_OnProfilingPhase,
531 OnProfilingPhaseCompletion)
530 IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles) 532 IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles)
531 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded, 533 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded,
532 OnProcessBackgrounded) 534 OnProcessBackgrounded)
533 #if defined(USE_TCMALLOC) 535 #if defined(USE_TCMALLOC)
534 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats) 536 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats)
535 #endif 537 #endif
536 IPC_MESSAGE_UNHANDLED(handled = false) 538 IPC_MESSAGE_UNHANDLED(handled = false)
537 IPC_END_MESSAGE_MAP() 539 IPC_END_MESSAGE_MAP()
538 540
539 if (handled) 541 if (handled)
(...skipping 19 matching lines...) Expand all
559 IPC::Logging::GetInstance()->Enable(); 561 IPC::Logging::GetInstance()->Enable();
560 else 562 else
561 IPC::Logging::GetInstance()->Disable(); 563 IPC::Logging::GetInstance()->Disable();
562 } 564 }
563 #endif // IPC_MESSAGE_LOG_ENABLED 565 #endif // IPC_MESSAGE_LOG_ENABLED
564 566
565 void ChildThreadImpl::OnSetProfilerStatus(ThreadData::Status status) { 567 void ChildThreadImpl::OnSetProfilerStatus(ThreadData::Status status) {
566 ThreadData::InitializeAndSetTrackingStatus(status); 568 ThreadData::InitializeAndSetTrackingStatus(status);
567 } 569 }
568 570
569 void ChildThreadImpl::OnGetChildProfilerData(int sequence_number) { 571 void ChildThreadImpl::OnGetChildProfilerData(int sequence_number,
570 tracked_objects::ProcessDataSnapshot process_data; 572 int current_profiling_phase) {
571 ThreadData::Snapshot(&process_data); 573 tracked_objects::ProcessDataSnapshot process_data_snapshot;
574 ThreadData::GetProcessDataSnapshot(current_profiling_phase,
575 &process_data_snapshot);
572 576
573 Send(new ChildProcessHostMsg_ChildProfilerData(sequence_number, 577 Send(new ChildProcessHostMsg_ChildProfilerData(sequence_number,
574 process_data)); 578 process_data_snapshot));
579 }
580
581 void ChildThreadImpl::OnProfilingPhaseCompletion(int profiling_phase) {
582 ThreadData::OnProfilingPhaseCompletion(profiling_phase);
575 } 583 }
576 584
577 void ChildThreadImpl::OnDumpHandles() { 585 void ChildThreadImpl::OnDumpHandles() {
578 #if defined(OS_WIN) 586 #if defined(OS_WIN)
579 scoped_refptr<HandleEnumerator> handle_enum( 587 scoped_refptr<HandleEnumerator> handle_enum(
580 new HandleEnumerator( 588 new HandleEnumerator(
581 base::CommandLine::ForCurrentProcess()->HasSwitch( 589 base::CommandLine::ForCurrentProcess()->HasSwitch(
582 switches::kAuditAllHandles))); 590 switches::kAuditAllHandles)));
583 handle_enum->EnumerateHandles(); 591 handle_enum->EnumerateHandles();
584 Send(new ChildProcessHostMsg_DumpHandlesDone); 592 Send(new ChildProcessHostMsg_DumpHandlesDone);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 // doesn't cause such issues. TODO(gab): Remove this once the experiment is 671 // doesn't cause such issues. TODO(gab): Remove this once the experiment is
664 // over (http://crbug.com/458594). 672 // over (http://crbug.com/458594).
665 base::FieldTrial* trial = 673 base::FieldTrial* trial =
666 base::FieldTrialList::Find("BackgroundRendererProcesses"); 674 base::FieldTrialList::Find("BackgroundRendererProcesses");
667 if (trial && trial->group_name() == "AllowBackgroundModeFromRenderer") 675 if (trial && trial->group_name() == "AllowBackgroundModeFromRenderer")
668 base::Process::Current().SetProcessBackgrounded(background); 676 base::Process::Current().SetProcessBackgrounded(background);
669 #endif // OS_WIN 677 #endif // OS_WIN
670 } 678 }
671 679
672 } // namespace content 680 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698