Skip to content

Commit

Permalink
fix(android): fix compile issue in AS release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ruifanyuan authored and hippy-actions[bot] committed Oct 30, 2023
1 parent b93d175 commit f2ba451
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
12 changes: 5 additions & 7 deletions dom/src/dom/root_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,21 +278,19 @@ void RootNode::CallFunction(uint32_t id, const std::string& name, const DomArgum
}

void RootNode::SyncWithRenderManager(const std::shared_ptr<RenderManager>& render_manager) {
HP_PERF_LOG("RootNode::SyncWithRenderManager");
unsigned long cnt = dom_operations_.size();
TDF_PERF_DO_STMT_AND_LOG(unsigned long domCnt = dom_operations_.size(); , "RootNode::SyncWithRenderManager");
FlushDomOperations(render_manager);
HP_PERF_LOG("RootNode::FlushDomOperations Done, dom op count:%lld", cnt);
cnt = event_operations_.size();
TDF_PERF_DO_STMT_AND_LOG(unsigned long evCnt = event_operations_.size(); , "RootNode::FlushDomOperations Done, dom op count:%lld", domCnt);
FlushEventOperations(render_manager);
HP_PERF_LOG("RootNode::FlushEventOperations Done, event op count:%d",cnt);
TDF_PERF_LOG("RootNode::FlushEventOperations Done, event op count:%d", evCnt);
DoAndFlushLayout(render_manager);
HP_PERF_LOG("RootNode::DoAndFlushLayout Done");
TDF_PERF_LOG("RootNode::DoAndFlushLayout Done");
auto dom_manager = dom_manager_.lock();
if (dom_manager) {
dom_manager->RecordDomEndTimePoint();
}
render_manager->EndBatch(GetWeakSelf());
HP_PERF_LOG("RootNode::SyncWithRenderManager End");
TDF_PERF_LOG("RootNode::SyncWithRenderManager End");
}

void RootNode::AddEvent(uint32_t id, const std::string& event_name) {
Expand Down
6 changes: 3 additions & 3 deletions driver/js/src/modules/scene_builder_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -600,14 +600,14 @@ std::shared_ptr<ClassTemplate<SceneBuilder>> RegisterSceneBuilder(const std::wea
size_t argument_count,
const std::shared_ptr<CtxValue> arguments[],
std::shared_ptr<CtxValue>&) -> std::shared_ptr<CtxValue> {
HP_PERF_LOG("SceneBuilder.build()");
TDF_PERF_LOG("SceneBuilder.build()");
auto scope = weak_scope.lock();
if (!scope) {
HP_PERF_LOG("SceneBuilder.build() exit with error");
TDF_PERF_LOG("SceneBuilder.build() exit with error");
return nullptr;
}
SceneBuilder::Build(scope->GetDomManager(), scope->GetRootNode());
HP_PERF_LOG("SceneBuilder.build() End");
TDF_PERF_LOG("SceneBuilder.build() End");
return nullptr;
};
class_template.functions.emplace_back(std::move(build_func_def));
Expand Down
9 changes: 7 additions & 2 deletions modules/footstone/include/footstone/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,17 @@ bool ShouldCreateLogMessage(LogSeverity severity);
#ifdef DEBUG

// enable perf log output in debug mode only
#define HP_PERF_LOG(format, ...) \
#define TDF_PERF_LOG(format, ...) \
footstone::LogMessage::LogWithFormat(__FILE_NAME__, __LINE__, "[HP PERF] " format, \
##__VA_ARGS__)

#define TDF_PERF_DO_STMT_AND_LOG( STMT , format , ...) STMT \
footstone::LogMessage::LogWithFormat(__FILE_NAME__, __LINE__, "[HP PERF] " format, \
##__VA_ARGS__)

#else

#define HP_PERF_LOG(format, ...)
#define TDF_PERF_LOG(format, ...)
#define TDF_PERF_DO_STMT_AND_LOG(STMT , format, ...)

#endif
10 changes: 5 additions & 5 deletions renderer/native/ios/renderer/HippyUIManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,8 @@ - (void)flushUIBlocksOnRootNode:(std::weak_ptr<RootNode>)rootNode {
if (!strongRootNode) {
return;
}
unsigned int rand = arc4random();
HP_PERF_LOG("flushUIBlocksOnRootNode(random id:%u", rand);
TDF_PERF_DO_STMT_AND_LOG(unsigned int rand = arc4random(); , "flushUIBlocksOnRootNode(random id:%u", rand);
int32_t rootTag = strongRootNode->GetId();
NSArray<HippyViewManagerUIBlock> *previousPendingUIBlocks = _pendingUIBlocks;
Expand All @@ -689,7 +689,7 @@ - (void)flushUIBlocksOnRootNode:(std::weak_ptr<RootNode>)rootNode {
dispatch_async(dispatch_get_main_queue(), ^{
__strong __typeof(weakSelf)strongSelf = weakSelf;
if (strongSelf) {
HP_PERF_LOG("flushUIBlocksOnRootNode on main thread(random id:%u)",rand);
TDF_PERF_LOG("flushUIBlocksOnRootNode on main thread(random id:%u)",rand);
NSDictionary<NSNumber *, UIView *> *viewReg = [strongSelf.viewRegistry componentsForRootTag:@(rootTag)];
@try {
for (HippyViewManagerUIBlock block in previousPendingUIBlocks) {
Expand All @@ -698,11 +698,11 @@ - (void)flushUIBlocksOnRootNode:(std::weak_ptr<RootNode>)rootNode {
} @catch (NSException *exception) {
HippyLogError(@"Exception thrown while executing UI block: %@", exception);
}
HP_PERF_LOG("flushUIBlocksOnRootNode on main thread done, block count:%d(random id:%u)", previousPendingUIBlocks.count, rand);
TDF_PERF_LOG("flushUIBlocksOnRootNode on main thread done, block count:%d(random id:%u)", previousPendingUIBlocks.count, rand);
}
});
}
HP_PERF_LOG("flushUIBlocksOnRootNode End(random id:%u)",rand);
TDF_PERF_LOG("flushUIBlocksOnRootNode End(random id:%u)",rand);
}
#pragma mark -
Expand Down
4 changes: 2 additions & 2 deletions renderer/native/ios/renderer/NativeRenderManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@

void NativeRenderManager::EndBatch(std::weak_ptr<hippy::RootNode> root_node) {
@autoreleasepool {
HP_PERF_LOG("NativeRenderManager::EndBatch Begin");
TDF_PERF_LOG("NativeRenderManager::EndBatch Begin");
HippyAssert(renderImpl_, @"renderImpl_ is null, did you forget to call Initialize()?");
[renderImpl_ batchOnRootNode:root_node];
HP_PERF_LOG("NativeRenderManager::EndBatch End");
TDF_PERF_LOG("NativeRenderManager::EndBatch End");

}
}
Expand Down

0 comments on commit f2ba451

Please sign in to comment.