Description: fix the problems about wearable devices compile alarms

IssueNo: https://gitee.com/openharmony/graphic_ui/issues/I53JQ8
Feature or Bugfix: Bugfix
Binary Source:No
Signed-off-by: liuyuxiang <liuyuxiang7@huawei.com>
This commit is contained in:
liuyuxiang-bear
2022-04-19 09:38:14 +08:00
parent 25bec3a863
commit 5ead28a085
30 changed files with 183 additions and 201 deletions
+3 -3
View File
@@ -23,8 +23,8 @@
* #if DISABLED(LOG_OUTPUT)
* #if ENABLED(LOG_OUTPUT)
*/
#define ENABLED(CONFIGURATION) ((CONFIGURATION) == 1)
#define DISABLED(CONFIGURATION) ((CONFIGURATION) != 1)
#define IS_ENABLED(CONFIGURATION) ((CONFIGURATION) == 1)
#define IS_DISABLED(CONFIGURATION) ((CONFIGURATION) != 1)
/**
* Enable/Disable JS framework runtime performance measurement.
@@ -36,7 +36,7 @@
* Default: 1
*/
#ifndef JS_PROFILER
#define JS_PROFILER 1
#define JS_PROFILER 0
#endif
/**
+3 -2
View File
@@ -15,8 +15,8 @@
#ifndef OHOS_ACELITE_JS_DEBUGGER_CONFIG_H
#define OHOS_ACELITE_JS_DEBUGGER_CONFIG_H
#include <cstdio>
#include <cstdint>
#include <cstdio>
#include "js_config.h"
#include "memory_heap.h"
@@ -131,8 +131,9 @@ public:
* @brief Release jerry external context
*/
void ReleaseJSContext();
private:
#if ENABLED(ENGINE_DEBUGGER)
#if IS_ENABLED(ENGINE_DEBUGGER)
#ifdef JS_ENGINE_EXTERNAL_CONTEXT
void *engineContext_ = nullptr;
#endif // JS_ENGINE_EXTERNAL_CONTEXT
@@ -23,7 +23,7 @@ namespace OHOS {
namespace ACELite {
static int8_t g_descValue = 0;
JsiInterfaceTddTest::JsiInterfaceTddTest(){}
JsiInterfaceTddTest::JsiInterfaceTddTest() {}
void JsiInterfaceTddTest::SetUp()
{
@@ -377,7 +377,7 @@ void JsiInterfaceTddTest::JSIInterfaceTest010()
TDD_CASE_END();
}
#if ENABLED(JS_FWK_SYMBOL)
#if IS_ENABLED(JS_FWK_SYMBOL)
void JsiInterfaceTddTest::JSIInterfaceTest011()
{
TDD_CASE_BEGIN();
@@ -471,14 +471,12 @@ void JsiInterfaceTddTest::JSIInterfaceTest013()
/**
* @tc.expected: step2. jsonStr = "{\"key1\":\"value1\",\"key2\":\"value2\"}"
*/
if ((jsonStr != nullptr) &&
!strcmp(jsonStr, "{\"key1\":\"value1\",\"key2\":\"value2\"}")) {
if ((jsonStr != nullptr) && !strcmp(jsonStr, "{\"key1\":\"value1\",\"key2\":\"value2\"}")) {
printf("JSIInterfaceTest013 pass\n");
} else {
printf("JSIInterfaceTest013 fail\n");
}
EXPECT_TRUE((jsonStr != nullptr) &&
!strcmp(jsonStr, "{\"key1\":\"value1\",\"key2\":\"value2\"}"));
EXPECT_TRUE((jsonStr != nullptr) && !strcmp(jsonStr, "{\"key1\":\"value1\",\"key2\":\"value2\"}"));
JSI::ReleaseValue(jsonValue);
JSI::ReleaseString(jsonStr);
TDD_CASE_END();
@@ -599,7 +597,7 @@ void JsiInterfaceTddTest::JSIInterfaceTest017()
TDD_CASE_END();
}
#if ENABLED(JS_FWK_TYPEDARRAY)
#if IS_ENABLED(JS_FWK_TYPEDARRAY)
void JsiInterfaceTddTest::JSIInterfaceTest018()
{
TDD_CASE_BEGIN();
@@ -702,14 +700,13 @@ void JsiInterfaceTddTest::JSIInterfaceTest019()
* @tc.expected: step3-step5. res1 = true, res2 = false, typedArray params are correct
*/
if (res1 && !res2 && (type == TypedArrayType::JSI_UINT8_ARRAY) && (length == byteLength) &&
(offset == initOffset) && ptr2 != nullptr && (ptr2[offset] == value1) &&
(ptr2[offset + 1] == value2)) {
(offset == initOffset) && ptr2 != nullptr && (ptr2[offset] == value1) && (ptr2[offset + 1] == value2)) {
printf("JSIInterfaceTest019 pass\n");
} else {
printf("JSIInterfaceTest019 fail\n");
}
EXPECT_TRUE(res1 && !res2 && (type == TypedArrayType::JSI_UINT8_ARRAY) && (length == byteLength) &&
(offset == initOffset) && ptr2 != nullptr && (ptr2[offset] == value1) && (ptr2[offset + 1] == value2));
(offset == initOffset) && ptr2 != nullptr && (ptr2[offset] == value1) && (ptr2[offset + 1] == value2));
JSI::ReleaseValueList(typedArray, undef, arrayBuffer);
TDD_CASE_END();
@@ -780,15 +777,14 @@ void JsiInterfaceTddTest::JSIInterfaceTest021()
/**
* @tc.expected: step2. keyAcquired1 = key1, num1 = 0, keyAcquired2 = key2, num1 = 1
*/
if (keyAcquired1 != nullptr && !strcmp(keyAcquired1, key1) &&
num1 == 0 && keyAcquired2 != nullptr &&
if (keyAcquired1 != nullptr && !strcmp(keyAcquired1, key1) && num1 == 0 && keyAcquired2 != nullptr &&
!strcmp(keyAcquired2, key2) && num2 == 1) {
printf("JSIInterfaceTest021 pass\n");
} else {
printf("JSIInterfaceTest021 fail\n");
}
EXPECT_TRUE(keyAcquired1 != nullptr && !strcmp(keyAcquired1, key1) && num1 == 0 &&
keyAcquired2 != nullptr && !strcmp(keyAcquired2, key2) && num2 == 1);
EXPECT_TRUE(keyAcquired1 != nullptr && !strcmp(keyAcquired1, key1) && num1 == 0 && keyAcquired2 != nullptr &&
!strcmp(keyAcquired2, key2) && num2 == 1);
JSI::ReleaseValueList(object, keys, keyValue1, keyValue2);
JSI::ReleaseString(keyAcquired1);
@@ -874,7 +870,7 @@ void JsiInterfaceTddTest::RunTests()
JSIInterfaceTest008();
JSIInterfaceTest009();
JSIInterfaceTest010();
#if ENABLED(JS_FWK_SYMBOL)
#if IS_ENABLED(JS_FWK_SYMBOL)
JSIInterfaceTest011();
#endif // ENABLED(JS_FWK_SYMBOL)
JSIInterfaceTest012();
@@ -883,7 +879,7 @@ void JsiInterfaceTddTest::RunTests()
JSIInterfaceTest015();
JSIInterfaceTest016();
JSIInterfaceTest017();
#if ENABLED(JS_FWK_TYPEDARRAY)
#if IS_ENABLED(JS_FWK_TYPEDARRAY)
JSIInterfaceTest018();
JSIInterfaceTest019();
#endif // ENABLED(JS_FWK_TYPEDARRAY)
@@ -994,7 +990,7 @@ HWTEST_F(JsiInterfaceTddTest, test010, TestSize.Level1)
JsiInterfaceTddTest::JSIInterfaceTest010();
}
#if ENABLED(JS_FWK_SYMBOL)
#if IS_ENABLED(JS_FWK_SYMBOL)
/**
* @tc.name: JSIInterfaceTest011
* @tc.desc: Verify JSI interface related to Symbol object.
@@ -1066,7 +1062,7 @@ HWTEST_F(JsiInterfaceTddTest, test017, TestSize.Level1)
JsiInterfaceTddTest::JSIInterfaceTest017();
}
#if ENABLED(JS_FWK_TYPEDARRAY)
#if IS_ENABLED(JS_FWK_TYPEDARRAY)
/**
* @tc.name: JSIInterfaceTest018
* @tc.desc: Verify JSI interface related to JS ArrayBuffer.
@@ -1128,5 +1124,5 @@ HWTEST_F(JsiInterfaceTddTest, test023, TestSize.Level0)
JsiInterfaceTddTest::JSIInterfaceTest023();
}
#endif
}
}
} // namespace ACELite
} // namespace OHOS
@@ -56,7 +56,7 @@ public:
void JSIInterfaceTest008();
void JSIInterfaceTest009();
void JSIInterfaceTest010();
#if ENABLED(JS_FWK_SYMBOL)
#if IS_ENABLED(JS_FWK_SYMBOL)
void JSIInterfaceTest011();
#endif // ENABLED(JS_FWK_SYMBOL)
void JSIInterfaceTest012();
@@ -65,7 +65,7 @@ public:
void JSIInterfaceTest015();
void JSIInterfaceTest016();
void JSIInterfaceTest017();
#if ENABLED(JS_FWK_TYPEDARRAY)
#if IS_ENABLED(JS_FWK_TYPEDARRAY)
void JSIInterfaceTest018();
void JSIInterfaceTest019();
#endif // ENABLED(JS_FWK_TYPEDARRAY)
@@ -313,10 +313,10 @@ void TransitionImpl::PerformTransition(int16_t from,
break;
case TransitionType::OPACITY: {
double rate = (double)updateAttrValue / ALPHA_MAX;
view_->SetStyle(STYLE_BACKGROUND_OPA, viewStatus_.rectOpacity * rate);
view_->SetStyle(STYLE_IMAGE_OPA, viewStatus_.imageOpacity * rate);
view_->SetStyle(STYLE_LINE_OPA, viewStatus_.lineOpacity * rate);
view_->SetStyle(STYLE_TEXT_OPA, viewStatus_.textOpacity * rate);
view_->SetStyle(STYLE_BACKGROUND_OPA, static_cast<int64_t>(viewStatus_.rectOpacity * rate));
view_->SetStyle(STYLE_IMAGE_OPA, static_cast<int64_t>(viewStatus_.imageOpacity * rate));
view_->SetStyle(STYLE_LINE_OPA, static_cast<int64_t>(viewStatus_.lineOpacity * rate));
view_->SetStyle(STYLE_TEXT_OPA, static_cast<int64_t>(viewStatus_.textOpacity * rate));
break;
}
default:
@@ -327,7 +327,7 @@ void TransitionImpl::PerformTransition(int16_t from,
invalidatedArea.Join(invalidatedArea, view_->GetRect());
view_->InvalidateRect(invalidatedArea);
}
int8_t TransitionImpl::GetNumIterations(const char* iterations)
int8_t TransitionImpl::GetNumIterations(const char *iterations)
{
int8_t min = 1;
int8_t max = 127;
@@ -345,7 +345,7 @@ int8_t TransitionImpl::GetNumIterations(const char* iterations)
return (int8_t)value;
}
bool TransitionImpl::IsEndWith(const char* src, const char* end)
bool TransitionImpl::IsEndWith(const char *src, const char *end)
{
if ((src == nullptr) || (end == nullptr)) {
return false;
@@ -385,9 +385,9 @@ void TransitionImpl::ResetRepeatParam()
if (animator_ != nullptr) {
animator_->SetRunTime(0); // reset animation executing time
}
timeArrivaled_ = false; // reset timeArrivaled flag
bgcolorTimeSrc_ = 0; // reset bg-color last update time
count_ = 1; // reset bg-color update number of times
timeArrivaled_ = false; // reset timeArrivaled flag
bgcolorTimeSrc_ = 0; // reset bg-color last update time
count_ = 1; // reset bg-color update number of times
}
void TransitionImpl::RecordViewStatus()
@@ -410,7 +410,7 @@ void TransitionImpl::RecoveryViewStatus(Rect invalidatedAreaBefore) const
view_->SetY(viewStatus_.y);
view_->SetHeight(viewStatus_.height);
view_->SetWidth(viewStatus_.width);
TransformMap& transMap = view_->GetTransformMap();
TransformMap &transMap = view_->GetTransformMap();
Polygon polygon(Rect(0, 0, 0, 0));
transMap.SetPolygon(polygon);
view_->SetStyle(STYLE_BACKGROUND_COLOR, viewStatus_.background_color.full);
+4 -4
View File
@@ -20,23 +20,23 @@
#include "js_config.h"
#if ENABLED(ACE_LITE_VERSION_JS_API)
#if IS_ENABLED(ACE_LITE_VERSION_JS_API)
namespace OHOS {
namespace ACELite {
class ACEVersion final {
public:
static const char* GetStr()
static const char *GetStr()
{
return "1.0.16";
}
static const char* GetCommit()
static const char *GetCommit()
{
return "1e53ee81c";
}
static const char* GetTimeStamp()
static const char *GetTimeStamp()
{
return "2020-08-13 17:25:20";
}
@@ -29,7 +29,7 @@ Debugger &Debugger::GetInstance()
return instance;
}
#if ENABLED(ENGINE_DEBUGGER)
#if IS_ENABLED(ENGINE_DEBUGGER)
bool Debugger::IsDebuggerEnabled()
{
return debuggerConfig_.startDebuggerServer;
@@ -120,7 +120,7 @@ void Debugger::ReleaseJSContext()
engineContext_ = nullptr;
#endif // JS_ENGINE_EXTERNAL_CONTEXT
}
#else // ENABLED(ENGINE_DEBUGGER)
#else // ENABLED(ENGINE_DEBUGGER)
bool Debugger::IsDebuggerEnabled()
{
return true;
@@ -131,30 +131,20 @@ void Debugger::ConfigEngineDebugger(DebuggerConfig &config)
UNUSED(config);
}
void Debugger::StartDebugger()
{
}
void Debugger::StartDebugger() {}
void Debugger::TearDownDebugger()
{
}
void Debugger::TearDownDebugger() {}
void Debugger::Output(const char * const str)
{
UNUSED(str);
}
void Debugger::FlushOutput()
{
}
void Debugger::FlushOutput() {}
void Debugger::SetupJSContext()
{
}
void Debugger::SetupJSContext() {}
void Debugger::ReleaseJSContext()
{
}
void Debugger::ReleaseJSContext() {}
#endif // ENABLED(ENGINE_DEBUGGER)
} // namespace ACELite
} // namespace OHOS
+11 -13
View File
@@ -31,7 +31,7 @@
#include "js_app_context.h"
#include "js_app_environment.h"
#include "js_profiler.h"
#if ENABLED(CONSOLE_LOG_OUTPUT)
#if IS_ENABLED(CONSOLE_LOG_OUTPUT)
#include "presets/console_module.h"
#endif
#include "presets/console_log_impl.h"
@@ -256,7 +256,7 @@ void PrintErrorMessage(const jerry_value_t errorValue)
DfxAssist dfxAssist;
dfxAssist.DumpErrorCode(errorValue);
dfxAssist.DumpErrorMessage(errorValue);
#if ENABLED(ENGINE_DEBUGGER)
#if IS_ENABLED(ENGINE_DEBUGGER)
FlushOutput();
#endif
}
@@ -439,8 +439,8 @@ char *RelocateFilePath(const char *appRootPath, const char *subPath, const char
{
size_t appRootPathLength = 0;
size_t fileNameLength = 0;
if ((appRootPath == nullptr) || ((appRootPathLength = strlen(appRootPath)) == 0) ||
(fileName == nullptr) || ((fileNameLength = strlen(fileName)) == 0)) {
if ((appRootPath == nullptr) || ((appRootPathLength = strlen(appRootPath)) == 0) || (fileName == nullptr) ||
((fileNameLength = strlen(fileName)) == 0)) {
HILOG_ERROR(HILOG_MODULE_ACE, "input path or fileName is invalid");
return nullptr;
}
@@ -960,15 +960,13 @@ bool ParseHexColor(const char * const source, uint32_t &color, uint8_t &alpha)
// Parse HEX color like #ABC
if (length == LENGTH_RGB) {
// #ABC equals to #AABBCC
char buffer[LENGTH_RRGGBB + 1] = {
source[IDX_RGB_RED],
source[IDX_RGB_RED],
source[IDX_RGB_GREEN],
source[IDX_RGB_GREEN],
source[IDX_RGB_BLUE],
source[IDX_RGB_BLUE],
0
};
char buffer[LENGTH_RRGGBB + 1] = {source[IDX_RGB_RED],
source[IDX_RGB_RED],
source[IDX_RGB_GREEN],
source[IDX_RGB_GREEN],
source[IDX_RGB_BLUE],
source[IDX_RGB_BLUE],
0};
color = strtol(buffer, nullptr, HEX);
alpha = ALPHA_MAX;
return true;
+1 -1
View File
@@ -70,7 +70,7 @@ struct Watcher : public MemoryHeap {
void ThrowError();
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
#ifndef LOG_PROFILER_TRACE
#define LOG_PROFILER(format, ...) printf(format "\n", ##__VA_ARGS__)
#define LOG_PROFILER_TRACE(format, ...) printf("[PERFORMANCE]:" format "\n", ##__VA_ARGS__)
@@ -51,13 +51,11 @@ const char * const CanvasComponent::FUNC_CLOSEPATH = "closePath";
const char * const CanvasComponent::FUNC_STROKE = "stroke";
// create canvas draw attribute-callback mapping
const AttrMap CanvasComponent::attrMap_[] = {
{ATTR_FILLSTYLE, FillStyleSetter, FillStyleGetter},
{ATTR_STROKESTYLE, StrokeStyleSetter, StrokeStyleGetter},
{ATTR_LINEWIDTH, LineWidthSetter, LineWidthGetter},
{ATTR_FONT, FontSetter, FontGetter},
{ATTR_TEXTALIGN, TextAlignSetter, TextAlignGetter}
};
const AttrMap CanvasComponent::attrMap_[] = {{ATTR_FILLSTYLE, FillStyleSetter, FillStyleGetter},
{ATTR_STROKESTYLE, StrokeStyleSetter, StrokeStyleGetter},
{ATTR_LINEWIDTH, LineWidthSetter, LineWidthGetter},
{ATTR_FONT, FontSetter, FontGetter},
{ATTR_TEXTALIGN, TextAlignSetter, TextAlignGetter}};
// create canvas draw method-callback mapping
const MethodMap CanvasComponent::methodMap_[] = {
@@ -891,8 +889,8 @@ bool CanvasComponent::FormatArcAngle(double sAngle,
return false;
}
startAngle = DEGREES_180 * sAngle / UI_PI;
endAngle = DEGREES_180 * eAngle / UI_PI;
startAngle = static_cast<int16_t>(DEGREES_180 * sAngle / UI_PI);
endAngle = static_cast<int16_t>(DEGREES_180 * eAngle / UI_PI);
if (!counterClockwise) {
// reset end-angle degrees when (endAngle - startAngle) > 360
+11 -7
View File
@@ -135,7 +135,7 @@ bool Component::Render()
STOP_TRACING();
// The event bubbling mechanism is supported from API version 5, and events are bubbled by default.
// However, it should be compatible with the migrated old application (API version 4)
// However, it should be compatible with the migrated old application (API version 4)
// so that it does not bubble by default.
const int32_t supportEventBubbleApiVersion = 5;
if (JsAppContext::GetInstance()->GetTargetApi() < supportEventBubbleApiVersion) {
@@ -1176,8 +1176,9 @@ void Component::SetLongPressEventListener(UIView &view, const jerry_value_t even
void Component::SetSwipeEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation)
{
if (onTouchListener_ == nullptr)
if (onTouchListener_ == nullptr) {
onTouchListener_ = new ViewOnTouchListener(viewModel_, isStopPropagation);
}
if (onTouchListener_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "DragEnd listener create failed");
return;
@@ -1192,15 +1193,16 @@ void Component::SetSwipeEventListener(UIView &view, jerry_value_t eventFunc, boo
void Component::SetTouchStartEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation)
{
if (onTouchListener_ == nullptr)
if (onTouchListener_ == nullptr) {
onTouchListener_ = new ViewOnTouchListener(viewModel_, isStopPropagation);
}
if (onTouchListener_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "DragStart listener create failed");
return;
}
view.SetOnDragListener(onTouchListener_);
view.SetDraggable(true);
view.SetTouchable(true);
@@ -1209,8 +1211,9 @@ void Component::SetTouchStartEventListener(UIView &view, jerry_value_t eventFunc
void Component::SetTouchMoveEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation)
{
if (onTouchListener_ == nullptr)
if (onTouchListener_ == nullptr) {
onTouchListener_ = new ViewOnTouchListener(viewModel_, isStopPropagation);
}
if (onTouchListener_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "Drag listener create failed");
return;
@@ -1225,8 +1228,9 @@ void Component::SetTouchMoveEventListener(UIView &view, jerry_value_t eventFunc,
void Component::SetTouchEndEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation)
{
if (onTouchListener_ == nullptr)
if (onTouchListener_ == nullptr) {
onTouchListener_ = new ViewOnTouchListener(viewModel_, isStopPropagation);
}
if (onTouchListener_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "DragEnd listener create failed");
return;
@@ -1460,7 +1464,7 @@ void Component::SetOpacity(UIView &view, const AppStyleItem &styleItem) const
} else if (opacity > opacityMax) {
opacity = opacityMax;
}
view.SetOpaScale(opacity * OPA_OPAQUE);
view.SetOpaScale(static_cast<uint8_t>(opacity * OPA_OPAQUE));
}
void Component::SetMargin(UIView &view) const
@@ -176,11 +176,11 @@ public:
ACE_DISALLOW_COPY_AND_MOVE(ViewOnTouchListener);
ViewOnTouchListener(jerry_value_t vm, bool isStopPropagation)
: vm_(jerry_acquire_value(vm)),
isStopPropagation_(isStopPropagation),
bindTouchStartFunc_(UNDEFINED),
bindTouchMoveFunc_(UNDEFINED),
bindTouchEndFunc_(UNDEFINED),
bindSwipeFunc_(UNDEFINED)
bindSwipeFunc_(UNDEFINED),
isStopPropagation_(isStopPropagation)
{
}
@@ -18,9 +18,9 @@
namespace OHOS {
namespace ACELite {
HorizonProgressComponent::HorizonProgressComponent(jerry_value_t options,
jerry_value_t children, AppStyleManager *styleManager)
: Component(options, children, styleManager),
hStrokeWidth_(0)
jerry_value_t children,
AppStyleManager *styleManager)
: Component(options, children, styleManager), hStrokeWidth_(0)
{
}
@@ -54,15 +54,14 @@ bool HorizonProgressComponent::CreateNativeViews()
progressView_.SetForegroundStyle(STYLE_BORDER_WIDTH, 0);
progressView_.SetBackgroundStyle(STYLE_BORDER_WIDTH, 0);
const double alpha = 0.15;
progressView_.SetBackgroundStyle(STYLE_BACKGROUND_COLOR,
Color::GetColorFromRGBA(0xFF, 0xFF, 0xFF, alpha * 0xFF).full);
progressView_.SetBackgroundStyle(
STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0xFF, 0xFF, 0xFF, static_cast<uint8_t>(alpha * 0xFF)).full);
// set defaut progress stroke width & canvas width & canvas height & border width
const int16_t width = 4;
hStrokeWidth_ = width;
return true;
}
UIView *HorizonProgressComponent::GetComponentRootView() const
{
return const_cast<UIBoxProgress *>(&progressView_);
@@ -208,9 +208,6 @@ bool ImageAnimatorComponent::ParseToFrames(jerry_value_t value)
HILOG_ERROR(HILOG_MODULE_ACE, "images is empty.");
return false;
}
if (framesSize_ > UINT8_MAX) {
framesSize_ = UINT8_MAX;
}
frames_ = static_cast<ImageAnimatorInfo *>(ace_malloc(sizeof(ImageAnimatorInfo) * framesSize_));
if (frames_ == nullptr) {
@@ -20,7 +20,7 @@
#include "js_debugger_config.h"
#include "js_router.h"
#include "js_timer_list.h"
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
#include "js_profiler.h"
#endif
#include "non_copyable.h"
@@ -43,7 +43,7 @@ public:
isEnvInit_(false),
router_(nullptr)
{
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
// Call GetInstance() to prepare data
JSProfiler::GetInstance()->PrepareDataBuffer();
#endif
@@ -58,7 +58,7 @@ public:
*/
virtual ~JSAbilityImpl()
{
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
// Call release() to free all performance data
JSProfiler::GetInstance()->Release();
#endif
@@ -111,7 +111,7 @@ public:
*
* @brief call this function when replace new page
*/
const Router* GetRouter() const
const Router *GetRouter() const
{
return router_;
}
@@ -122,12 +122,12 @@ private:
void InvokeOnBackPressed() const;
void InvokeMethodWithoutParameter(const char * const name) const;
JsAppContext* appContext_;
JsAppContext *appContext_;
jerry_value_t abilityModel_; // the object evaled from user JS code
jerry_value_t nativeElement_; // the object returned from render function
bool rendered_;
bool isEnvInit_;
Router* router_;
Router *router_;
};
} // namespace ACELite
} // namespace OHOS
+7 -7
View File
@@ -15,7 +15,7 @@
#include "js_profiler.h"
// invoked into compiling only if performance measurement enabled
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
#include "ace_log.h"
#include "ace_mem_base.h"
#include "js_async_work.h"
@@ -25,7 +25,9 @@
#include <fcntl.h>
#include "los_tick.h"
#include "unistd.h"
#elif defined(FEATURE_ACELITE_JS_PROFILER)
#include <sys/time.h>
#else
#include <time.h>
@@ -163,9 +165,7 @@ JSProfiler::JSProfiler() : data_(nullptr), dataCount_(0), traceIdSlot_(0), enabl
JSProfiler::JSProfiler() : data_(nullptr), dataCount_(0), traceIdSlot_(0), enabled_(false) {}
#endif
JSProfiler::~JSProfiler()
{
}
JSProfiler::~JSProfiler() {}
JSProfiler *JSProfiler::GetInstance()
{
@@ -264,7 +264,7 @@ void JSProfiler::ResetData()
{
if (data_) {
if (memset_s(data_, (maxTracingDataCount * sizeof(PerformanceData)), 0,
(maxTracingDataCount * sizeof(PerformanceData))) != 0) {
(maxTracingDataCount * sizeof(PerformanceData))) != 0) {
HILOG_ERROR(HILOG_MODULE_ACE, "ace js profiler memset_s failed");
return;
}
@@ -273,7 +273,7 @@ void JSProfiler::ResetData()
#ifdef FEATURE_ACELITE_MC_JS_PROFILER
if (msg_) {
if (memset_s(msg_, (PROFILER_MSG_LENGTH * sizeof(ProfilerMsg)), 0,
(PROFILER_MSG_LENGTH * sizeof(ProfilerMsg))) != 0) {
(PROFILER_MSG_LENGTH * sizeof(ProfilerMsg))) != 0) {
HILOG_ERROR(HILOG_MODULE_ACE, "ace js profiler memset_s failed");
return;
}
@@ -364,7 +364,7 @@ void JSProfiler::Output()
char buf[MSG_LENGTH] = {'\0'};
if (sprintf_s(buf, MSG_LENGTH, "%d %d %llu %d %d\n", data.component, data.label,
CalculateElapsedTime(data.start, data.end), data.description, data.label) < 0) {
CalculateElapsedTime(data.start, data.end), data.description, data.label) < 0) {
HILOG_ERROR(HILOG_MODULE_ACE, "ace js profiler memset_s msg failed");
return;
}
+2 -2
View File
@@ -24,7 +24,7 @@
/*
* Wrapper macro, use directly in code after including this header file.
*/
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
// start tracing for one given phase, and return a traceId which will be used when calling STOP_TRACING
#define START_TRACING(traceTag) JSProfiler::GetInstance()->PushTrace(traceTag, 0, 0)
// start tracing for one given phase, and provids the component name together
@@ -44,7 +44,7 @@
#endif // ENABLED(JS_PROFILER)
// invoked into compiling only if performance measurement enabled
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
namespace OHOS {
namespace ACELite {
/**
@@ -24,13 +24,13 @@
namespace OHOS {
namespace ACELite {
JSfwkTddTest::JSfwkTddTest(){}
JSfwkTddTest::JSfwkTddTest() {}
static JSAbility* g_targetJSAbility = nullptr;
static char* g_currentTestCaseName = nullptr;
static JSAbility *g_targetJSAbility = nullptr;
static char *g_currentTestCaseName = nullptr;
static uint8_t g_assertRecord = 0;
void JSfwkTddTest::TestCaseB(const char* name) const
void JSfwkTddTest::TestCaseB(const char *name) const
{
g_assertRecord = 0;
g_currentTestCaseName = const_cast<char *>(name);
@@ -88,7 +88,7 @@ void JSfwkTddTest::ACELiteFrameworkInitialization001()
/**
* @tc.steps: step3. check if the top JS ability is initialized
*/
JSAbilityImpl* jsAbilityImpl = const_cast<JSAbilityImpl *>(JsAppContext::GetInstance()->GetTopJSAbilityImpl());
JSAbilityImpl *jsAbilityImpl = const_cast<JSAbilityImpl *>(JsAppContext::GetInstance()->GetTopJSAbilityImpl());
EXPECT_TRUE(jsAbilityImpl == nullptr);
/**
* @tc.steps: step4. clean up test environment
@@ -111,7 +111,7 @@ void JSfwkTddTest::ACELiteFrameworkInitialization002()
/**
* @tc.steps: step3. check if the top JS ability is initialized
*/
JSAbilityImpl* jsAbilityImpl = const_cast<JSAbilityImpl *>(JsAppContext::GetInstance()->GetTopJSAbilityImpl());
JSAbilityImpl *jsAbilityImpl = const_cast<JSAbilityImpl *>(JsAppContext::GetInstance()->GetTopJSAbilityImpl());
EXPECT_TRUE(jsAbilityImpl == nullptr);
/**
* @tc.steps: step4. clean up test environment
@@ -135,7 +135,7 @@ void JSfwkTddTest::ACELiteFrameworkInitialization003()
/**
* @tc.steps: step3. check if the top JS ability is initialized
*/
JSAbilityImpl* jsAbilityImpl = const_cast<JSAbilityImpl *>(JsAppContext::GetInstance()->GetTopJSAbilityImpl());
JSAbilityImpl *jsAbilityImpl = const_cast<JSAbilityImpl *>(JsAppContext::GetInstance()->GetTopJSAbilityImpl());
EXPECT_TRUE(jsAbilityImpl != nullptr);
/**
@@ -166,7 +166,7 @@ void JSfwkTddTest::ACELiteFrameworkInitialization009()
* @tc.steps: step1. init test environment
*/
TDD_CASE_BEGIN();
#if ENABLED(ACE_LITE_VERSION_JS_API)
#if IS_ENABLED(ACE_LITE_VERSION_JS_API)
/**
* @tc.steps: step2. check version code
*/
@@ -178,7 +178,7 @@ void JSfwkTddTest::ACELiteFrameworkInitialization009()
/**
* @tc.steps: step4. check build timestamp
*/
const char* buildStamp = ACEVersion::GetTimeStamp();
const char *buildStamp = ACEVersion::GetTimeStamp();
EXPECT_TRUE(buildStamp != nullptr);
constexpr char firstVersionBuildStamp[] = "2020-05-09 16:31:41";
if (strcmp(buildStamp, firstVersionBuildStamp) == 0) {
@@ -450,5 +450,5 @@ HWTEST_F(JSfwkTddTest, engineIntegrating004, TestSize.Level1)
JSfwkTddTest::AceliteFrameworkEngineIntegrating04();
}
#endif
}
}
} // namespace ACELite
} // namespace OHOS
@@ -14,7 +14,7 @@
*/
#include "console_log_impl.h"
#if ENABLED(CONSOLE_LOG_OUTPUT)
#if IS_ENABLED(CONSOLE_LOG_OUTPUT)
#include "js_app_environment.h"
#ifdef FEATURE_USER_MC_LOG_PRINTF
#include "product_adapter.h"
@@ -19,7 +19,7 @@
#include "acelite_config.h"
#include "js_config.h"
#if ENABLED(CONSOLE_LOG_OUTPUT)
#if IS_ENABLED(CONSOLE_LOG_OUTPUT)
#include "jerryscript.h"
@@ -29,13 +29,13 @@ namespace ACELite {
* The log level definations.
*/
enum LogLevel : uint8_t {
LOG_LEVEL_NONE = 0, // console.log
LOG_LEVEL_DEBUG = 1, // console.debug
LOG_LEVEL_INFO = 2, // console.info
LOG_LEVEL_WARN = 3, // console.warn
LOG_LEVEL_ERR = 4, // console.error
LOG_LEVEL_FATAL = 5, // fatal, no console.fatal
LOG_LEVEL_TRACE = 6, // console.trace
LOG_LEVEL_NONE = 0, // console.log
LOG_LEVEL_DEBUG = 1, // console.debug
LOG_LEVEL_INFO = 2, // console.info
LOG_LEVEL_WARN = 3, // console.warn
LOG_LEVEL_ERR = 4, // console.error
LOG_LEVEL_FATAL = 5, // fatal, no console.fatal
LOG_LEVEL_TRACE = 6, // console.trace
};
#ifdef TDD_ASSERTIONS
@@ -80,7 +80,7 @@ void FlushOutput();
jerry_value_t LogNative(const LogLevel logLevel,
const jerry_value_t func,
const jerry_value_t context,
const jerry_value_t* args,
const jerry_value_t *args,
const jerry_length_t length);
/**
@@ -14,7 +14,7 @@
*/
#include "presets/console_module.h"
#if ENABLED(CONSOLE_LOG_OUTPUT)
#if IS_ENABLED(CONSOLE_LOG_OUTPUT)
#include "presets/console_log_impl.h"
#endif // ENABLED(CONSOLE_LOG_OUTPUT)
@@ -36,10 +36,10 @@ void ConsoleModule::Init()
jerry_value_t ConsoleModule::LogDebug(const jerry_value_t func,
const jerry_value_t context,
const jerry_value_t* args,
const jerry_value_t *args,
const jerry_length_t length)
{
#if DISABLED(CONSOLE_LOG_OUTPUT)
#if IS_DISABLED(CONSOLE_LOG_OUTPUT)
return UNDEFINED;
#else
return LogNative(LOG_LEVEL_DEBUG, func, context, args, length);
@@ -48,10 +48,10 @@ jerry_value_t ConsoleModule::LogDebug(const jerry_value_t func,
jerry_value_t ConsoleModule::LogInfo(const jerry_value_t func,
const jerry_value_t context,
const jerry_value_t* args,
const jerry_value_t *args,
const jerry_length_t length)
{
#if DISABLED(CONSOLE_LOG_OUTPUT)
#if IS_DISABLED(CONSOLE_LOG_OUTPUT)
return UNDEFINED;
#else
return LogNative(LOG_LEVEL_INFO, func, context, args, length);
@@ -60,10 +60,10 @@ jerry_value_t ConsoleModule::LogInfo(const jerry_value_t func,
jerry_value_t ConsoleModule::LogWarn(const jerry_value_t func,
const jerry_value_t context,
const jerry_value_t* args,
const jerry_value_t *args,
const jerry_length_t length)
{
#if DISABLED(CONSOLE_LOG_OUTPUT)
#if IS_DISABLED(CONSOLE_LOG_OUTPUT)
return UNDEFINED;
#else
return LogNative(LOG_LEVEL_WARN, func, context, args, length);
@@ -72,10 +72,10 @@ jerry_value_t ConsoleModule::LogWarn(const jerry_value_t func,
jerry_value_t ConsoleModule::Log(const jerry_value_t func,
const jerry_value_t context,
const jerry_value_t* args,
const jerry_value_t *args,
const jerry_length_t length)
{
#if DISABLED(CONSOLE_LOG_OUTPUT)
#if IS_DISABLED(CONSOLE_LOG_OUTPUT)
return UNDEFINED;
#else
return LogNative(LOG_LEVEL_NONE, func, context, args, length);
@@ -84,10 +84,10 @@ jerry_value_t ConsoleModule::Log(const jerry_value_t func,
jerry_value_t ConsoleModule::LogError(const jerry_value_t func,
const jerry_value_t context,
const jerry_value_t* args,
const jerry_value_t *args,
const jerry_length_t length)
{
#if DISABLED(CONSOLE_LOG_OUTPUT)
#if IS_DISABLED(CONSOLE_LOG_OUTPUT)
return UNDEFINED;
#else
return LogNative(LOG_LEVEL_ERR, func, context, args, length);
@@ -20,20 +20,22 @@
#include "keys.h"
#include "key_parser.h"
#include "string_util.h"
namespace OHOS {
namespace ACELite {
using namespace I18N;
jerry_object_native_info_t DateTimeFormatModule::GC_CALLBACK = {.free_cb = DateTimeFormatModule::DeleteDateFormat};
DateTimeFormatModule::DateTimeFormatModule(): dateFormat_(nullptr),
info_(nullptr),
timePattern_(I18N::AvailableDateTimeFormatPattern::SHORT),
datePattern_(I18N::AvailableDateTimeFormatPattern::SHORT),
weekStyle_(StyleState::UNKNOWN),
monthStyle_(StyleState::UNKNOWN),
numArray_(nullptr),
isSetTime_(false),
isSetDate_(false)
DateTimeFormatModule::DateTimeFormatModule()
: dateFormat_(nullptr),
info_(nullptr),
timePattern_(I18N::AvailableDateTimeFormatPattern::SHORT),
datePattern_(I18N::AvailableDateTimeFormatPattern::SHORT),
weekStyle_(StyleState::UNKNOWN),
monthStyle_(StyleState::UNKNOWN),
numArray_(nullptr),
isSetTime_(false),
isSetDate_(false)
{
if (memset_s(digitArray_, TIME_NUMBER_LEN, 0, TIME_NUMBER_LEN) != EOK) {
HILOG_ERROR(HILOG_MODULE_ACE, "init digit array failed");
@@ -103,13 +105,13 @@ jerry_value_t DateTimeFormatModule::CreateDateTimeFormat(const jerry_value_t fun
const jerry_length_t argsNum)
{
if (!jerry_value_is_constructor(func)) {
return jerry_create_error(JERRY_ERROR_EVAL, reinterpret_cast<const jerry_char_t *>
("use new to create number format"));
return jerry_create_error(JERRY_ERROR_EVAL,
reinterpret_cast<const jerry_char_t *>("use new to create number format"));
}
DateTimeFormatModule *dateModel = new DateTimeFormatModule();
if (dateModel == nullptr) {
return jerry_create_error(JERRY_ERROR_EVAL, reinterpret_cast<const jerry_char_t *>
("create date format model failed"));
return jerry_create_error(JERRY_ERROR_EVAL,
reinterpret_cast<const jerry_char_t *>("create date format model failed"));
}
char *value = nullptr;
if (argsNum >= 1) {
@@ -121,15 +123,15 @@ jerry_value_t DateTimeFormatModule::CreateDateTimeFormat(const jerry_value_t fun
HILOG_ERROR(HILOG_MODULE_ACE, "create LocaleInfo failed");
delete dateModel;
dateModel = nullptr;
return jerry_create_error(JERRY_ERROR_COMMON, reinterpret_cast<const jerry_char_t*>("lack of memory"));
return jerry_create_error(JERRY_ERROR_COMMON, reinterpret_cast<const jerry_char_t *>("lack of memory"));
}
// set the default format pattern year(numeric)-month(numeric)-day(numeric)
dateModel->dateFormat_ = new DateTimeFormat(AvailableDateTimeFormatPattern::SHORT, *dateModel->info_);
if ((dateModel->dateFormat_ == nullptr) || (!dateModel->InitNumArray(*dateModel->info_))) {
delete dateModel;
dateModel = nullptr;
return jerry_create_error(JERRY_ERROR_EVAL, reinterpret_cast<const jerry_char_t *>
("create dateTimeFormat failed"));
return jerry_create_error(JERRY_ERROR_EVAL,
reinterpret_cast<const jerry_char_t *>("create dateTimeFormat failed"));
}
if (argsNum > 1) {
// deal the year month day style
@@ -141,8 +143,9 @@ jerry_value_t DateTimeFormatModule::CreateDateTimeFormat(const jerry_value_t fun
delete dateModel;
dateModel = nullptr;
const char *result = (dateRes != nullptr) ? dateRes : timeRes;
return (result == nullptr) ? jerry_create_null() :
jerry_create_error(JERRY_ERROR_EVAL, reinterpret_cast<const jerry_char_t *>(result));
return (result == nullptr)
? jerry_create_null()
: jerry_create_error(JERRY_ERROR_EVAL, reinterpret_cast<const jerry_char_t *>(result));
}
}
jerry_set_object_native_pointer(context, dateModel, &GC_CALLBACK);
@@ -164,7 +167,7 @@ jerry_value_t DateTimeFormatModule::Format(const jerry_value_t func,
const jerry_length_t argsNum)
{
if (!jerry_is_feature_enabled(JERRY_FEATURE_DATE)) {
return jerry_create_error(JERRY_ERROR_EVAL, reinterpret_cast<const jerry_char_t*>("the date is not enabled"));
return jerry_create_error(JERRY_ERROR_EVAL, reinterpret_cast<const jerry_char_t *>("the date is not enabled"));
}
if (argsNum < 1) {
return jerry_create_error(JERRY_ERROR_EVAL, reinterpret_cast<const jerry_char_t *>("date is invalid"));
@@ -176,7 +179,7 @@ jerry_value_t DateTimeFormatModule::Format(const jerry_value_t func,
return UNDEFINED;
}
const uint16_t msToSec = 1000;
time_t dateTime = formatter->GetTimeVal(args[0], "getTime") / msToSec;
time_t dateTime = static_cast<time_t>(formatter->GetTimeVal(args[0], "getTime") / msToSec);
formatter->ConvertLocalToGMT(dateTime);
if (formatter->isSetDate_ || formatter->isSetTime_) {
uint8_t maxSize = 128;
@@ -199,7 +202,7 @@ jerry_value_t DateTimeFormatModule::Format(const jerry_value_t func,
}
// the style group is not support, format the lonely support style week or month
if (formatter->weekStyle_ != StyleState::UNKNOWN) {
int8_t weekIndex = formatter->GetTimeVal(args[0], "getDay");
int8_t weekIndex = static_cast<int8_t>(formatter->GetTimeVal(args[0], "getDay"));
DateTimeDataType type = (formatter->weekStyle_ == StyleState::LONG) ? FORMAT_WIDE : FORMAT_ABBR;
std::string weekName = formatter->dateFormat_->GetWeekName(weekIndex, type);
return jerry_create_string(reinterpret_cast<const jerry_char_t *>(weekName.c_str()));
@@ -218,7 +221,7 @@ jerry_value_t DateTimeFormatModule::Format(const jerry_value_t func,
jerry_value_t DateTimeFormatModule::GetMonthVal(jerry_value_t time) const
{
int month = GetTimeVal(time, "getMonth");
int month = static_cast<int>(GetTimeVal(time, "getMonth"));
// format the long style ans short month style
if ((monthStyle_ == StyleState::LONG) || (monthStyle_ == StyleState::SHORT)) {
DateTimeDataType type = (monthStyle_ == StyleState::LONG) ? FORMAT_WIDE : FORMAT_ABBR;
@@ -294,7 +297,7 @@ void DateTimeFormatModule::FormatDate(time_t time, char *res, const uint8_t resS
}
isMonthFirst = (GetNumberEnd(check.c_str(), 0) < 0);
}
const uint8_t dayStyleIndex = 2; // the day number style index
const uint8_t dayStyleIndex = 2; // the day number style index
const uint8_t monthStyleIndex = 1; // the month style index
uint8_t firstFormatIndex = dayStyleIndex;
int16_t formatIndex = 0;
@@ -310,8 +313,8 @@ void DateTimeFormatModule::FormatDate(time_t time, char *res, const uint8_t resS
HILOG_ERROR(HILOG_MODULE_ACE, "format the first number in date str failed");
return;
}
formatIndex = FormatDigit(dateStr + formatIndex, res, resSize,
start, digitArray_[secondFormatIndex]) + formatIndex;
formatIndex =
FormatDigit(dateStr + formatIndex, res, resSize, start, digitArray_[secondFormatIndex]) + formatIndex;
} else {
// format the day digit or year digit
formatIndex = FormatDigit(dateStr, res, resSize, start, digitArray_[dayStyleIndex]);
@@ -670,8 +673,7 @@ bool DateTimeFormatModule::SetDatePattern(StyleState weekdayStyle,
StyleState dayStyle)
{
// the pattern support is (weekday)-year-month-day
if ((yearStyle == StyleState::UNKNOWN) ||
(dayStyle == StyleState::UNKNOWN) ||
if ((yearStyle == StyleState::UNKNOWN) || (dayStyle == StyleState::UNKNOWN) ||
(monthStyle == StyleState::UNKNOWN)) {
return false;
}
@@ -691,17 +693,14 @@ bool DateTimeFormatModule::SetDatePattern(StyleState weekdayStyle,
}
default: {
result = SetMonthPattern(monthStyle, AvailableDateTimeFormatPattern::YEAR_WIDE_MONTH_DAY,
AvailableDateTimeFormatPattern::MEDIUM,
AvailableDateTimeFormatPattern::SHORT);
AvailableDateTimeFormatPattern::MEDIUM, AvailableDateTimeFormatPattern::SHORT);
break;
}
}
return result;
}
bool DateTimeFormatModule::GetTimePattern(StyleState hourStyle,
StyleState minuteStyle,
StyleState secondStyle)
bool DateTimeFormatModule::GetTimePattern(StyleState hourStyle, StyleState minuteStyle, StyleState secondStyle)
{
// the support pattern is hour-minute-(second)
if ((hourStyle == StyleState::UNKNOWN) || (minuteStyle == StyleState::UNKNOWN)) {
@@ -710,18 +709,18 @@ bool DateTimeFormatModule::GetTimePattern(StyleState hourStyle,
bool result = true;
switch (hourStyle) {
case StyleState::HOUR12: {
timePattern_ = (secondStyle == StyleState::UNKNOWN) ? AvailableDateTimeFormatPattern::HOUR12_MINUTE :
AvailableDateTimeFormatPattern::HOUR12_MINUTE_SECOND;
timePattern_ = (secondStyle == StyleState::UNKNOWN) ? AvailableDateTimeFormatPattern::HOUR12_MINUTE
: AvailableDateTimeFormatPattern::HOUR12_MINUTE_SECOND;
break;
}
case StyleState::HOUR24: {
timePattern_ = (secondStyle == StyleState::UNKNOWN) ? AvailableDateTimeFormatPattern::HOUR24_MINUTE :
AvailableDateTimeFormatPattern::HOUR24_MINUTE_SECOND;
timePattern_ = (secondStyle == StyleState::UNKNOWN) ? AvailableDateTimeFormatPattern::HOUR24_MINUTE
: AvailableDateTimeFormatPattern::HOUR24_MINUTE_SECOND;
break;
}
case StyleState::HOUR: {
timePattern_ = (secondStyle == StyleState::UNKNOWN) ? AvailableDateTimeFormatPattern::HOUR_MINUTE :
HOUR_MINUTE_SECOND;
timePattern_ =
(secondStyle == StyleState::UNKNOWN) ? AvailableDateTimeFormatPattern::HOUR_MINUTE : HOUR_MINUTE_SECOND;
break;
}
default: {
@@ -13,7 +13,7 @@
* limitations under the License.
*/
#include "profiler_module.h"
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
namespace OHOS {
namespace ACELite {
/**
@@ -33,10 +33,10 @@ void ProfilerModule::Init()
jerry_value_t ProfilerModule::StartTracing(const jerry_value_t func,
const jerry_value_t context,
const jerry_value_t* args,
const jerry_value_t *args,
const jerry_length_t argsNum)
{
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
if ((args == nullptr) || (argsNum < 1)) {
return UNDEFINED;
}
@@ -61,10 +61,10 @@ jerry_value_t ProfilerModule::StartTracing(const jerry_value_t func,
jerry_value_t ProfilerModule::StopTracing(const jerry_value_t func,
const jerry_value_t context,
const jerry_value_t* args,
const jerry_value_t *args,
const jerry_length_t argsNum)
{
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
STOP_TRACING();
#endif
return UNDEFINED;
@@ -17,7 +17,7 @@
#include "js_profiler.h"
#include "non_copyable.h"
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
#include "presets/preset_module.h"
namespace OHOS {
namespace ACELite {
@@ -82,7 +82,7 @@ public:
~PerformaceProfilerModule() = default;
static void Load()
{
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
ProfilerModule profilerModule;
profilerModule.Init();
#endif
@@ -35,7 +35,7 @@ public:
void Init() override;
const int GetInitState()
int GetInitState()
{
return initRes_;
}
@@ -14,7 +14,7 @@
*/
#include "version_module.h"
#if ENABLED(ACE_LITE_VERSION_JS_API)
#if IS_ENABLED(ACE_LITE_VERSION_JS_API)
#include "ace_log.h"
#include "ace_version.h"
#include "platform_adapter.h"
@@ -19,7 +19,7 @@
#include "acelite_config.h"
#include "js_config.h"
#include "non_copyable.h"
#if ENABLED(ACE_LITE_VERSION_JS_API)
#if IS_ENABLED(ACE_LITE_VERSION_JS_API)
#include "presets/preset_module.h"
namespace OHOS {
namespace ACELite {
@@ -70,7 +70,7 @@ public:
~AceVersionModule() = default;
static void Load()
{
#if ENABLED(ACE_LITE_VERSION_JS_API)
#if IS_ENABLED(ACE_LITE_VERSION_JS_API)
VersionModule versionModule;
versionModule.Init();
#endif
@@ -199,8 +199,8 @@ bool StateMachine::BindUri(jerry_value_t &jsRes)
ace_free(uri_);
uri_ = nullptr;
HILOG_ERROR(HILOG_MODULE_ACE, "statemachine init failed as uri is empty.");
jsRes = jerry_create_error(JERRY_ERROR_URI,
reinterpret_cast<const jerry_char_t *>("uri value can't be empty."));
jsRes =
jerry_create_error(JERRY_ERROR_URI, reinterpret_cast<const jerry_char_t *>("uri value can't be empty."));
return false;
}
int result = GenerateJsPagePath(uri_);
@@ -322,7 +322,7 @@ static void ForceGC(void *data)
{
static_cast<void>(data);
jerry_gc(jerry_gc_mode_t::JERRY_GC_PRESSURE_HIGH);
#if ENABLED(JS_PROFILER)
#if IS_ENABLED(JS_PROFILER)
if (JSProfiler::GetInstance()->IsEnabled()) {
// dump the JS heap status
JSHeapStatus heapStatus;
@@ -338,7 +338,7 @@ void StateMachine::RenderPage()
{
START_TRACING(RENDER);
// if not in init state, reset all watchers of previous page at first
LazyLoadManager* lazy = const_cast<LazyLoadManager *>(appContext_->GetLazyLoadManager());
LazyLoadManager *lazy = const_cast<LazyLoadManager *>(appContext_->GetLazyLoadManager());
if (lazy != nullptr) {
lazy->ResetWatchers();
}
+1 -1
View File
@@ -274,7 +274,7 @@ bool JSUndefined::Is(JSValue value)
return jerry_value_is_undefined(value);
}
JSValue JSNumber::Create(uint32_t number)
JSValue JSNumber::Create(double number)
{
return jerry_create_number(number);
}
+1 -1
View File
@@ -84,7 +84,7 @@ public:
class JSNumber final : public MemoryHeap {
public:
static JSValue Create(uint32_t number);
static JSValue Create(double number);
static bool Is(JSValue target);
static double Value(JSValue value);
};