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

Side by Side Diff: third_party/tcmalloc/chromium/src/heap-profiler.cc

Issue 18314006: Enable DMP for system Chromium WebView on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for a review Created 7 years, 5 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) 2005, Google Inc. 1 // Copyright (c) 2005, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 //---------------------------------------------------------------------- 647 //----------------------------------------------------------------------
648 648
649 // Initialization code 649 // Initialization code
650 static void HeapProfilerInit() { 650 static void HeapProfilerInit() {
651 // Everything after this point is for setting up the profiler based on envvar 651 // Everything after this point is for setting up the profiler based on envvar
652 char fname[PATH_MAX]; 652 char fname[PATH_MAX];
653 if (!GetUniquePathFromEnv(HEAPPROFILE, fname)) { 653 if (!GetUniquePathFromEnv(HEAPPROFILE, fname)) {
654 return; 654 return;
655 } 655 }
656 // We do a uid check so we don't write out files in a setuid executable. 656 // We do a uid check so we don't write out files in a setuid executable.
657 #ifdef HAVE_GETEUID 657 #if !defined(__ANDROID__) && defined(HAVE_GETEUID)
658 if (getuid() != geteuid()) { 658 if (getuid() != geteuid()) {
659 RAW_LOG(WARNING, ("HeapProfiler: ignoring " HEAPPROFILE " because " 659 RAW_LOG(WARNING, ("HeapProfiler: ignoring " HEAPPROFILE " because "
660 "program seems to be setuid\n")); 660 "program seems to be setuid\n"));
661 return; 661 return;
662 } 662 }
663 #endif 663 #endif
664 664
665 HeapProfileTable::CleanupOldProfiles(fname); 665 HeapProfileTable::CleanupOldProfiles(fname);
666 666
667 HeapProfilerStart(fname); 667 HeapProfilerStart(fname);
668 } 668 }
669 669
670 // class used for finalization -- dumps the heap-profile at program exit 670 // class used for finalization -- dumps the heap-profile at program exit
671 struct HeapProfileEndWriter { 671 struct HeapProfileEndWriter {
672 ~HeapProfileEndWriter() { HeapProfilerDump("Exiting"); } 672 ~HeapProfileEndWriter() { HeapProfilerDump("Exiting"); }
673 }; 673 };
674 674
675 // We want to make sure tcmalloc is up and running before starting the profiler 675 // We want to make sure tcmalloc is up and running before starting the profiler
676 static const TCMallocGuard tcmalloc_initializer; 676 static const TCMallocGuard tcmalloc_initializer;
677 REGISTER_MODULE_INITIALIZER(heapprofiler, HeapProfilerInit()); 677 REGISTER_MODULE_INITIALIZER(heapprofiler, HeapProfilerInit());
678 static HeapProfileEndWriter heap_profile_end_writer; 678 static HeapProfileEndWriter heap_profile_end_writer;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698