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

Unified Diff: test/cctest/profiler-extension.cc

Issue 1665303004: Unflake CPU profiler tests. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: make top level functions to be JS ones. Created 4 years, 10 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
« no previous file with comments | « test/cctest/profiler-extension.h ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/profiler-extension.cc
diff --git a/test/cctest/profiler-extension.cc b/test/cctest/profiler-extension.cc
index a917932978c128e27b044da453facbcdf8b4f506..024cc9c635a3d1b97d9c474a004b866e8598507b 100644
--- a/test/cctest/profiler-extension.cc
+++ b/test/cctest/profiler-extension.cc
@@ -27,41 +27,35 @@
//
// Tests of profiles generator and utilities.
-#include "src/base/logging.h"
#include "test/cctest/profiler-extension.h"
+#include "test/cctest/cctest.h"
namespace v8 {
namespace internal {
-
v8::CpuProfile* ProfilerExtension::last_profile = NULL;
const char* ProfilerExtension::kSource =
"native function startProfiling();"
- "native function stopProfiling();";
+ "native function stopProfiling();"
+ "native function collectSample();";
v8::Local<v8::FunctionTemplate> ProfilerExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Local<v8::String> name) {
v8::Local<v8::Context> context = isolate->GetCurrentContext();
- if (name->Equals(context, v8::String::NewFromUtf8(isolate, "startProfiling",
- v8::NewStringType::kNormal)
- .ToLocalChecked())
- .FromJust()) {
+ if (name->Equals(context, v8_str(isolate, "startProfiling")).FromJust()) {
return v8::FunctionTemplate::New(isolate,
ProfilerExtension::StartProfiling);
- } else if (name->Equals(context,
- v8::String::NewFromUtf8(isolate, "stopProfiling",
- v8::NewStringType::kNormal)
- .ToLocalChecked())
- .FromJust()) {
- return v8::FunctionTemplate::New(isolate,
- ProfilerExtension::StopProfiling);
- } else {
- CHECK(false);
- return v8::Local<v8::FunctionTemplate>();
}
+ if (name->Equals(context, v8_str(isolate, "stopProfiling")).FromJust()) {
+ return v8::FunctionTemplate::New(isolate, ProfilerExtension::StopProfiling);
+ }
+ if (name->Equals(context, v8_str(isolate, "collectSample")).FromJust()) {
+ return v8::FunctionTemplate::New(isolate, ProfilerExtension::CollectSample);
+ }
+ CHECK(false);
+ return v8::Local<v8::FunctionTemplate>();
}
-
void ProfilerExtension::StartProfiling(
const v8::FunctionCallbackInfo<v8::Value>& args) {
last_profile = NULL;
@@ -71,7 +65,6 @@ void ProfilerExtension::StartProfiling(
: v8::String::Empty(args.GetIsolate()));
}
-
void ProfilerExtension::StopProfiling(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler();
@@ -80,5 +73,10 @@ void ProfilerExtension::StopProfiling(
: v8::String::Empty(args.GetIsolate()));
}
+void ProfilerExtension::CollectSample(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ args.GetIsolate()->GetCpuProfiler()->CollectSample();
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « test/cctest/profiler-extension.h ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698