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

Unified Diff: test/cctest/test-profile-generator.cc

Issue 16932003: CPUProfiler: unflake flaky CPUProfiler tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: HandleScope was moved one line down Created 7 years, 6 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/test-cpu-profiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-profile-generator.cc
diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc
index 70091d90325ec7d71a9a59b1858ef23ec4c7bf31..d56c12f44788f88ebf8de908a8fc91a8f5a686a6 100644
--- a/test/cctest/test-profile-generator.cc
+++ b/test/cctest/test-profile-generator.cc
@@ -30,6 +30,7 @@
#include "v8.h"
#include "profile-generator-inl.h"
#include "cctest.h"
+#include "profiler-extension.h"
#include "../include/v8-profiler.h"
using i::CodeEntry;
@@ -797,62 +798,6 @@ TEST(NoSamples) {
}
-// --- P r o f i l e r E x t e n s i o n ---
-
-class ProfilerExtension : public v8::Extension {
- public:
- ProfilerExtension() : v8::Extension("v8/profiler", kSource) { }
- virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
- v8::Handle<v8::String> name);
- static v8::Handle<v8::Value> StartProfiling(const v8::Arguments& args);
- static v8::Handle<v8::Value> StopProfiling(const v8::Arguments& args);
- private:
- static const char* kSource;
-};
-
-
-const char* ProfilerExtension::kSource =
- "native function startProfiling();"
- "native function stopProfiling();";
-
-v8::Handle<v8::FunctionTemplate> ProfilerExtension::GetNativeFunction(
- v8::Handle<v8::String> name) {
- if (name->Equals(v8::String::New("startProfiling"))) {
- return v8::FunctionTemplate::New(ProfilerExtension::StartProfiling);
- } else if (name->Equals(v8::String::New("stopProfiling"))) {
- return v8::FunctionTemplate::New(ProfilerExtension::StopProfiling);
- } else {
- CHECK(false);
- return v8::Handle<v8::FunctionTemplate>();
- }
-}
-
-
-v8::Handle<v8::Value> ProfilerExtension::StartProfiling(
- const v8::Arguments& args) {
- v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler();
- if (args.Length() > 0)
- cpu_profiler->StartCpuProfiling(args[0].As<v8::String>());
- else
- cpu_profiler->StartCpuProfiling(v8::String::New(""));
- return v8::Undefined();
-}
-
-
-v8::Handle<v8::Value> ProfilerExtension::StopProfiling(
- const v8::Arguments& args) {
- v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler();
- if (args.Length() > 0)
- cpu_profiler->StopCpuProfiling(args[0].As<v8::String>());
- else
- cpu_profiler->StopCpuProfiling(v8::String::New(""));
- return v8::Undefined();
-}
-
-
-static ProfilerExtension kProfilerExtension;
-v8::DeclareExtension kProfilerExtensionDeclaration(&kProfilerExtension);
-
static const ProfileNode* PickChild(const ProfileNode* parent,
const char* name) {
for (int i = 0; i < parent->children()->length(); ++i) {
@@ -870,7 +815,7 @@ TEST(RecordStackTraceAtStartProfiling) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
- const char* extensions[] = { "v8/profiler" };
+ const char* extensions[] = { i::ProfilerExtension::kName };
v8::ExtensionConfiguration config(1, extensions);
v8::Local<v8::Context> context = v8::Context::New(isolate, &config);
context->Enter();
« no previous file with comments | « test/cctest/test-cpu-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698