summaryrefslogtreecommitdiffstats
path: root/webkit/extensions
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-19 19:09:30 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-19 19:09:30 +0000
commit63dc378eac88be2da11255b61d7af140bb89ba55 (patch)
treee5ae5e3659b8a9bafa3d93f09072901e20338f59 /webkit/extensions
parent7e96b7ac9c98f54506da88a4d69e9012b164761f (diff)
downloadchromium_src-63dc378eac88be2da11255b61d7af140bb89ba55.zip
chromium_src-63dc378eac88be2da11255b61d7af140bb89ba55.tar.gz
chromium_src-63dc378eac88be2da11255b61d7af140bb89ba55.tar.bz2
Drop allocator dependency from base library.
This will fix libnpapi_test_plugin from loading TCMalloc. This undoes the bad dependency from base to allocator added in http://src.chromium.org/viewvc/chrome/trunk/src/base/base.gyp?revision=43477&view=markup, which was required to fix the linux shared build, due to http://src.chromium.org/viewvc/chrome?view=rev&revision=41218 which added the base/profiler.cc compile-time dependency on TCMalloc (rather than a link-time dependency injection, relying on something like weak symbols) The purify/quantify dependency is indeed compile-time, and is appropriately done in profiler.cc. But, to simply this change, I've killed profiler.cc and only used it in the profiler extension. We can add it back if needed, but it's only been used in that one place for a long time anyway. BUG=59317,40467 TEST=make -j15 npapi_test_plugin && nm out/Debug/libnpapi_test_plugin.so | grep TCMalloc. Should be empty. Review URL: http://codereview.chromium.org/3783009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63082 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/extensions')
-rw-r--r--webkit/extensions/v8/profiler_extension.cc42
1 files changed, 35 insertions, 7 deletions
diff --git a/webkit/extensions/v8/profiler_extension.cc b/webkit/extensions/v8/profiler_extension.cc
index 8f393d4..487649a 100644
--- a/webkit/extensions/v8/profiler_extension.cc
+++ b/webkit/extensions/v8/profiler_extension.cc
@@ -4,11 +4,22 @@
#include "webkit/extensions/v8/profiler_extension.h"
-#include "base/profiler.h"
+#include "build/build_config.h"
+
+#if defined(QUANTIFY)
+// this #define is used to prevent people from directly using pure.h
+// instead of profiler.h
+#define PURIFY_PRIVATE_INCLUDE
+#include "base/third_party/purify/pure.h"
+#endif // QUANTIFY
+
+#if defined(USE_TCMALLOC) && defined(OS_LINUX)
+#include "third_party/tcmalloc/chromium/src/google/profiler.h"
+#endif
namespace extensions_v8 {
-const char* kProfilerExtensionName = "v8/Profiler";
+const char kProfilerExtensionName[] = "v8/Profiler";
class ProfilerWrapper : public v8::Extension {
public:
@@ -58,25 +69,37 @@ class ProfilerWrapper : public v8::Extension {
static v8::Handle<v8::Value> ProfilerStart(
const v8::Arguments& args) {
- base::Profiler::StartRecording();
+#if defined(QUANTIFY)
+ QuantifyStartRecordingData();
+#elif defined(USE_TCMALLOC) && defined(OS_LINUX)
+ ::ProfilerStart("chrome-profile");
+#endif
return v8::Undefined();
}
static v8::Handle<v8::Value> ProfilerStop(
const v8::Arguments& args) {
- base::Profiler::StopRecording();
+#if defined(QUANTIFY)
+ QuantifyStopRecordingData();
+#elif defined(USE_TCMALLOC) && defined(OS_LINUX)
+ ::ProfilerStop();
+#endif
return v8::Undefined();
}
static v8::Handle<v8::Value> ProfilerClearData(
const v8::Arguments& args) {
- base::Profiler::ClearData();
+#if defined(QUANTIFY)
+ QuantifyClearData();
+#endif
return v8::Undefined();
}
static v8::Handle<v8::Value> ProfilerFlush(
const v8::Arguments& args) {
- base::Profiler::Flush();
+#if defined(USE_TCMALLOC) && defined(OS_LINUX)
+ ::ProfilerFlush();
+#endif
return v8::Undefined();
}
@@ -87,7 +110,12 @@ class ProfilerWrapper : public v8::Extension {
v8::Local<v8::String> inputString = args[0]->ToString();
char nameBuffer[256];
inputString->WriteAscii(nameBuffer, 0, sizeof(nameBuffer)-1);
- base::Profiler::SetThreadName(nameBuffer);
+#if defined(QUANTIFY)
+ // make a copy since the Quantify function takes a char*, not const char*
+ char buffer[512];
+ base::snprintf(buffer, arraysize(buffer)-1, "%s", name);
+ QuantifySetThreadName(buffer);
+#endif
}
return v8::Undefined();
}