summaryrefslogtreecommitdiffstats
path: root/webkit/extensions
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 23:07:52 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 23:07:52 +0000
commitc5d7f32f2fdae32e4ebf5c67b02026eefecc17b2 (patch)
tree85cce8731ba57fc701e3d49b1b9a9f1b2304eeb6 /webkit/extensions
parent9165f748223f75790fb7f504de538b3003c27e4f (diff)
downloadchromium_src-c5d7f32f2fdae32e4ebf5c67b02026eefecc17b2.zip
chromium_src-c5d7f32f2fdae32e4ebf5c67b02026eefecc17b2.tar.gz
chromium_src-c5d7f32f2fdae32e4ebf5c67b02026eefecc17b2.tar.bz2
Support controlling the TCMalloc CPU profiler from script in test_shell
Review URL: http://codereview.chromium.org/607008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/extensions')
-rw-r--r--webkit/extensions/v8/profiler_extension.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/webkit/extensions/v8/profiler_extension.cc b/webkit/extensions/v8/profiler_extension.cc
index 7a4f13f..cbfc721 100644
--- a/webkit/extensions/v8/profiler_extension.cc
+++ b/webkit/extensions/v8/profiler_extension.cc
@@ -21,6 +21,7 @@ class ProfilerWrapper : public v8::Extension {
"chromium.Profiler = function() {"
" native function ProfilerStart();"
" native function ProfilerStop();"
+ " native function ProfilerFlush();"
" native function ProfilerClearData();"
" native function ProfilerSetThreadName();"
" this.start = function() {"
@@ -32,6 +33,9 @@ class ProfilerWrapper : public v8::Extension {
" this.clear = function() {"
" ProfilerClearData();"
" };"
+ " this.flush = function() {"
+ " ProfilerFlush();"
+ " };"
" this.setThreadName = function(name) {"
" ProfilerSetThreadName(name);"
" };"
@@ -45,6 +49,8 @@ class ProfilerWrapper : public v8::Extension {
return v8::FunctionTemplate::New(ProfilerStop);
} else if (name->Equals(v8::String::New("ProfilerClearData"))) {
return v8::FunctionTemplate::New(ProfilerClearData);
+ } else if (name->Equals(v8::String::New("ProfilerFlush"))) {
+ return v8::FunctionTemplate::New(ProfilerFlush);
} else if (name->Equals(v8::String::New("ProfilerSetThreadName"))) {
return v8::FunctionTemplate::New(ProfilerSetThreadName);
}
@@ -69,6 +75,13 @@ class ProfilerWrapper : public v8::Extension {
return v8::Undefined();
}
+ static v8::Handle<v8::Value> ProfilerFlush(
+ const v8::Arguments& args) {
+ base::Profiler::Flush();
+ return v8::Undefined();
+ }
+
+
static v8::Handle<v8::Value> ProfilerSetThreadName(
const v8::Arguments& args) {
if (args.Length() >= 1 && args[0]->IsString()) {