Skip to content

Commit 41c5771

Browse files
committed
[Testing] cq-cq-721248-65564-65587-mvhwp
1 parent 5418259 commit 41c5771

7 files changed

Lines changed: 25 additions & 10 deletions

File tree

core/public/pipeline_option.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <sys/types.h>
99

10+
#include <cstdint>
1011
#include <sstream>
1112
#include <string>
1213
#include <thread>
@@ -75,6 +76,7 @@ struct PipelineOptions {
7576
static const int32_t kRecycleTemplateBundle = 0x01 << 2;
7677
static const int32_t kProcessLayoutWithoutUIFlush = 0x01 << 3;
7778
static const int32_t kRenderForRecreateEngine = 0x01 << 4;
79+
static constexpr int32_t kInvalidTargetNodeId = 0;
7880

7981
// TODO(kechenglong): impl ToLepusValue here.
8082
// Default constructor that generates a unique PipelineID
@@ -179,7 +181,7 @@ struct PipelineOptions {
179181
bool resolve_requested{false};
180182
bool layout_requested{false};
181183
bool flush_ui_requested{false};
182-
Element* target_node{nullptr};
184+
int32_t target_node{kInvalidTargetNodeId};
183185
// Whether the current template has been reloaded.
184186
bool reload{false};
185187
const PipelineVersion* version{nullptr};

core/renderer/dom/element_manager.cc

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,8 @@ void ElementManager::OnFinishUpdateProps(
576576
// redundant logic here.
577577
if (options->enable_unified_pixel_pipeline) {
578578
options->resolve_requested = true;
579-
options->target_node = target_node;
579+
options->target_node = target_node ? target_node->impl_id()
580+
: PipelineOptions::kInvalidTargetNodeId;
580581
} else {
581582
OnPatchFinish(options, target_node);
582583
}
@@ -1241,9 +1242,17 @@ void ElementManager::OnPatchFinish(std::shared_ptr<PipelineOptions> &option,
12411242
}
12421243

12431244
void ElementManager::ResolveStyle(std::shared_ptr<PipelineOptions> &option,
1244-
Element *element) {
1245-
if (element == nullptr) {
1245+
int32_t target_node) {
1246+
Element *element = nullptr;
1247+
if (target_node == PipelineOptions::kInvalidTargetNodeId) {
12461248
element = static_cast<Element *>(root());
1249+
} else {
1250+
element = node_manager()->Get(target_node);
1251+
if (element == nullptr) {
1252+
LOGE("ElementManager::ResolveStyle failed since target node is gone, id:"
1253+
<< target_node);
1254+
return;
1255+
}
12471256
}
12481257
if (!element) {
12491258
LOGE("ElementManager::OnPatchFinish failed since element is nullptr.");

core/renderer/dom/element_manager.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,9 @@ class ElementManager : public ElementContextDelegate,
928928
* Used By RunPixelPipeline Process.
929929
*
930930
*/
931-
void ResolveStyle(std::shared_ptr<PipelineOptions> &option,
932-
Element *root = nullptr);
931+
void ResolveStyle(
932+
std::shared_ptr<PipelineOptions> &option,
933+
int32_t target_node = PipelineOptions::kInvalidTargetNodeId);
933934

934935
/**
935936
* Generate ID for element

core/renderer/dom/fiber/fiber_element.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,7 +2461,7 @@ void FiberElement::SetNativeProps(
24612461
// redundant logic here.
24622462
if (pipeline_options->enable_unified_pixel_pipeline) {
24632463
pipeline_options->resolve_requested = true;
2464-
pipeline_options->target_node = this;
2464+
pipeline_options->target_node = impl_id();
24652465
} else {
24662466
element_manager()->OnPatchFinish(pipeline_options, this);
24672467
}
@@ -2819,7 +2819,7 @@ void FiberElement::UpdateCSSVariable(
28192819
// redundant logic here.
28202820
if (pipeline_option->enable_unified_pixel_pipeline) {
28212821
pipeline_option->resolve_requested = true;
2822-
pipeline_option->target_node = this;
2822+
pipeline_option->target_node = impl_id();
28232823
} else {
28242824
element_manager()->OnPatchFinish(pipeline_option, this);
28252825
}

core/renderer/pipeline/pipeline_context.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void PipelineContext::ResetResolveRequested() {
116116
return;
117117
}
118118
options_->resolve_requested = false;
119-
options_->target_node = nullptr;
119+
options_->target_node = PipelineOptions::kInvalidTargetNodeId;
120120
}
121121

122122
void PipelineContext::ResetLayoutRequested() {

core/renderer/pipeline/pipeline_context_unittest.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ TEST_F(PipelineContextTest, TestPipelineContextResolve) {
7171
EXPECT_FALSE(context->IsResolveRequested());
7272
context->RequestResolve();
7373
EXPECT_TRUE(context->IsResolveRequested());
74+
options_->target_node = 42;
7475
context->ResetResolveRequested();
7576
EXPECT_FALSE(context->IsResolveRequested());
77+
EXPECT_EQ(options_->target_node, PipelineOptions::kInvalidTargetNodeId);
7678
}
7779

7880
TEST_F(PipelineContextTest, TestPipelineContextLayout) {

core/runtime/lepus/bindings/renderer_functions.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5323,7 +5323,8 @@ RENDERER_FUNCTION_CC(FiberFlushElementTree) {
53235323
// redundant logic here.
53245324
if (current_option->enable_unified_pixel_pipeline) {
53255325
current_option->resolve_requested = true;
5326-
current_option->target_node = element;
5326+
current_option->target_node =
5327+
element ? element->impl_id() : PipelineOptions::kInvalidTargetNodeId;
53275328
current_option->need_trigger_data_updated_ = trigger_data_updated;
53285329
} else {
53295330
self->page_proxy()->element_manager()->OnPatchFinish(current_option,

0 commit comments

Comments
 (0)