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

Unified Diff: base/allocator/allocated_type_profiler_control.cc

Issue 10411047: Type profiler by intercepting 'new' and 'delete' expressions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reflected comments #21,22 Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: base/allocator/allocated_type_profiler_control.cc
diff --git a/base/allocator/allocated_type_profiler_control.cc b/base/allocator/allocated_type_profiler_control.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ea8ec878ff55eb879f0c85420d32980f2d34201e
--- /dev/null
+++ b/base/allocator/allocated_type_profiler_control.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "allocated_type_profiler_control.h"
+
+#ifdef PROFILING_ALLOCATED_TYPE
Ryan Sleevi 2012/08/10 04:16:09 style nit: In general, Chromium code tends more to
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Done.
+
+static int g_enable_intercept = 1;
+
+namespace base {
+namespace allocated_type {
+
+// Stops the interceptors __op_new_intercept__ and __op_delete_intercept__.
+//
+// The interceptors should be stopped at new/delete between fork and exec.
+// See http://crbug.com/36678.
+
+void StopProfilingAllocatedType() {
+ g_enable_intercept = 0;
+}
+
+bool IsProfilingAllocatedType() {
+ return g_enable_intercept != 0;
+}
+
+}
+}
+
+#else // PROFILING_ALLOCATED_TYPE
Ryan Sleevi 2012/08/10 04:16:09 nit: Having a broad swath of file between #ifdefs
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Done.
+
+namespace base {
+namespace allocated_type {
+
+void StopProfilingAllocatedType() {
+ // no operation
+}
+
+bool IsProfilingAllocatedType() {
+ return true;
Ryan Sleevi 2012/08/10 04:16:09 Is this really true? Seems like you should be ret
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Thanks for the good catch. Right. It affects nothi
+}
+
+}
+}
+
+#endif // PROFILING_ALLOCATED_TYPE

Powered by Google App Engine
This is Rietveld 408576698