From d8da5e60e32d9c582c5ca183fb973ed882c9d33d Mon Sep 17 00:00:00 2001 From: 3y3 <3y3@bk.ru> Date: Tue, 12 May 2015 23:41:48 +0300 Subject: [PATCH] Some small fixes for `lineTicks` in cpu profiler --- src/cpu_profile_node.cc | 10 +++++----- src/cpu_profile_node.h | 11 ++++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/cpu_profile_node.cc b/src/cpu_profile_node.cc index 9a907ce..3c2f631 100644 --- a/src/cpu_profile_node.cc +++ b/src/cpu_profile_node.cc @@ -13,18 +13,18 @@ namespace nodex { uint32_t ProfileNode::UIDCounter = 1; - #if (NODE_MODULE_VERSION >= 42) - static Handle GetLineTicks(const CpuProfileNode* node) { +#if (NODE_MODULE_VERSION >= 42) + static ProfileNode::Handle GetLineTicks(const CpuProfileNode* node) { NanEscapableScope(); - unsigned int count = node->GetHitLineCount(); + uint32_t count = node->GetHitLineCount(); v8::CpuProfileNode::LineTick *entries = new v8::CpuProfileNode::LineTick[count]; bool result = node->GetLineTicks(entries, count); Local lineTicks; if (result) { Local array = NanNew(count); - for (unsigned int index = 0; index < count; index++) { + for (uint32_t index = 0; index < count; index++) { Local tick = NanNew(); tick->Set(NanNew("line"), NanNew(entries[index].line)); tick->Set(NanNew("hitCount"), NanNew(entries[index].hit_count)); @@ -69,7 +69,7 @@ namespace nodex { profile_node->Set(NanNew("children"), children); #if (NODE_MODULE_VERSION >= 42) - auto lineTicks = GetLineTicks(node); + Handle lineTicks = GetLineTicks(node); if (!lineTicks->IsNull()) { profile_node->Set(NanNew("lineTicks"), lineTicks); } diff --git a/src/cpu_profile_node.h b/src/cpu_profile_node.h index 1636d26..8f71704 100644 --- a/src/cpu_profile_node.h +++ b/src/cpu_profile_node.h @@ -7,9 +7,14 @@ namespace nodex { class ProfileNode { - public: - static v8::Handle New(const v8::CpuProfileNode* node); - static uint32_t UIDCounter; + public: + static v8::Handle New(const v8::CpuProfileNode* node); + static uint32_t UIDCounter; + + private: +#if (NODE_MODULE_VERSION >= 42) + static v8::Handle GetLineTicks(const v8::CpuProfileNode* node); +#endif }; }