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

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

Issue 117353002: Delete several deprecated methods on v8::CpuProfiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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: test/cctest/profiler-extension.cc
diff --git a/src/extensions/trigger-failure-extension.cc b/test/cctest/profiler-extension.cc
similarity index 52%
copy from src/extensions/trigger-failure-extension.cc
copy to test/cctest/profiler-extension.cc
index 5fe6bbbf477a57696421f35dc41ad218bda1910e..aebabe7d97f9ea3609a38187f65b5d735f2179ef 100644
--- a/src/extensions/trigger-failure-extension.cc
+++ b/test/cctest/profiler-extension.cc
@@ -24,59 +24,53 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Tests of profiles generator and utilities.
-#include "trigger-failure-extension.h"
-#include "v8.h"
-
-namespace v8 {
-namespace internal {
-
+#include "profiler-extension.h"
-const char* const TriggerFailureExtension::kSource =
- "native function triggerCheckFalse();"
- "native function triggerAssertFalse();"
- "native function triggerSlowAssertFalse();";
+#include "cctest.h"
+const v8::CpuProfile* ProfilerExtension::last_profile = NULL;
+const char* ProfilerExtension::kSource =
+ "native function startProfiling();"
+ "native function stopProfiling();";
-v8::Handle<v8::FunctionTemplate>
-TriggerFailureExtension::GetNativeFunctionTemplate(
- v8::Isolate* isolate,
- v8::Handle<v8::String> str) {
- if (strcmp(*v8::String::Utf8Value(str), "triggerCheckFalse") == 0) {
- return v8::FunctionTemplate::New(
- TriggerFailureExtension::TriggerCheckFalse);
- } else if (strcmp(*v8::String::Utf8Value(str), "triggerAssertFalse") == 0) {
- return v8::FunctionTemplate::New(
- TriggerFailureExtension::TriggerAssertFalse);
+v8::Handle<v8::FunctionTemplate> ProfilerExtension::GetNativeFunctionTemplate(
+ v8::Isolate* isolate, v8::Handle<v8::String> name) {
+ if (name->Equals(v8::String::NewFromUtf8(isolate, "startProfiling"))) {
+ return v8::FunctionTemplate::New(ProfilerExtension::StartProfiling);
+ } else if (name->Equals(v8::String::NewFromUtf8(isolate, "stopProfiling"))) {
+ return v8::FunctionTemplate::New(ProfilerExtension::StopProfiling);
} else {
- CHECK_EQ(0, strcmp(*v8::String::Utf8Value(str), "triggerSlowAssertFalse"));
- return v8::FunctionTemplate::New(
- TriggerFailureExtension::TriggerSlowAssertFalse);
+ CHECK(false);
+ return v8::Handle<v8::FunctionTemplate>();
}
}
-void TriggerFailureExtension::TriggerCheckFalse(
+void ProfilerExtension::StartProfiling(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- CHECK(false);
+ last_profile = NULL;
+ 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::NewFromUtf8(args.GetIsolate(), ""));
alph 2013/12/17 16:20:17 Will v8::String::Empty() work here?
Sven Panne 2013/12/18 06:48:21 Heads up: Although this is not explicitly deprecat
yurys 2013/12/18 07:26:19 Done.
yurys 2013/12/18 07:26:19 Switched to the method with Isolate* parameter.
}
-void TriggerFailureExtension::TriggerAssertFalse(
+void ProfilerExtension::StopProfiling(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- ASSERT(false);
+ v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler();
+ if (args.Length() > 0)
+ last_profile = cpu_profiler->StopCpuProfiling(args[0].As<v8::String>());
+ else
+ last_profile = cpu_profiler->StopCpuProfiling(
+ v8::String::NewFromUtf8(args.GetIsolate(), ""));
alph 2013/12/17 16:20:17 ditto
yurys 2013/12/18 07:26:19 Done.
}
-void TriggerFailureExtension::TriggerSlowAssertFalse(
- const v8::FunctionCallbackInfo<v8::Value>& args) {
- SLOW_ASSERT(false);
-}
-
-
-void TriggerFailureExtension::Register() {
- static TriggerFailureExtension trigger_failure_extension;
- static v8::DeclareExtension declaration(&trigger_failure_extension);
-}
-
-} } // namespace v8::internal
+static ProfilerExtension kProfilerExtension;
+v8::DeclareExtension kProfilerExtensionDeclaration(&kProfilerExtension);

Powered by Google App Engine
This is Rietveld 408576698