Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ struct semantic_snapshot_data_v1 final {
uint64_t top_document_generation{};
uint64_t layout_generation{};
uint32_t flags{};
uint32_t focused_node_index{WEBSCENE_SEMANTIC_NONE_INDEX_V1};
uint32_t focused_node_index{
static_cast<uint32_t>(WEBSCENE_SEMANTIC_NONE_INDEX_V1)};
std::vector<webscene_semantic_document_v1> documents;
std::vector<webscene_semantic_node_v1> nodes;
std::vector<webscene_semantic_relationship_v1> relationships;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@
: pending.locators.size();
if (pending.next_durable_index >= count) continue;
const auto index = pending.next_durable_index++;
const auto action = exporting
const auto action = static_cast<std::uint32_t>(exporting
? WEBSCENE_FILE_GRANT_DURABLE_EXPORT_V2
: restoring ? WEBSCENE_FILE_GRANT_DURABLE_RESTORE_V2
: WEBSCENE_FILE_GRANT_DURABLE_REVOKE_V2;
: WEBSCENE_FILE_GRANT_DURABLE_REVOKE_V2);
webscene_file_grant_durable_request_v2 request{
sizeof(request), 2U, ++next_host_request_id, action, 0U,
{}, {}, {}, {}};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,20 +597,22 @@
last_child_indices.reserve(result->nodes.capacity());
std::vector<std::unordered_map<std::string, uint32_t>> ids;
std::vector<std::unordered_map<std::string, const dom_node*>> all_id_nodes;
constexpr auto no_semantic_index =
static_cast<uint32_t>(WEBSCENE_SEMANTIC_NONE_INDEX_V1);

const auto append_document = [&](uint32_t frame_owner, uint64_t frame_generation,
std::string_view origin) -> uint32_t {
if (result->documents.size() == maximum_semantic_documents_v1) {
result->flags |= WEBSCENE_SEMANTIC_SNAPSHOT_TRUNCATED_DOCUMENTS_V1;
return WEBSCENE_SEMANTIC_NONE_INDEX_V1;
return no_semantic_index;
}
webscene_semantic_document_v1 view{};
view.struct_size = sizeof(view);
view.version = 1U;
view.document_generation = result->top_document_generation;
view.frame_generation = frame_generation;
view.frame_owner_dom_node_id = frame_owner;
view.root_node_index = WEBSCENE_SEMANTIC_NONE_INDEX_V1;
view.root_node_index = no_semantic_index;
view.origin = result->append_string(origin);
result->documents.push_back(view);
ids.emplace_back();
Expand Down Expand Up @@ -661,8 +663,8 @@
view.dom_node_id = node.id;
view.document_index = active_document;
view.parent_index = parent_index;
view.first_child_index = WEBSCENE_SEMANTIC_NONE_INDEX_V1;
view.next_sibling_index = WEBSCENE_SEMANTIC_NONE_INDEX_V1;
view.first_child_index = no_semantic_index;
view.next_sibling_index = no_semantic_index;
const auto& semantic_document = result->documents[active_document];
view.semantic_id = semantic_identity(
semantic_document.document_generation,
Expand All @@ -689,7 +691,7 @@
node.id,
view.supported_actions});
captured.push_back({&node, active_document});
last_child_indices.push_back(WEBSCENE_SEMANTIC_NONE_INDEX_V1);
last_child_indices.push_back(no_semantic_index);
if (!node.id_attribute.empty()) {
ids[active_document].try_emplace(node.id_attribute, node_index);
}
Expand All @@ -716,7 +718,7 @@
break;
}
};
visit(document.body(), top_document, WEBSCENE_SEMANTIC_NONE_INDEX_V1, false);
visit(document.body(), top_document, no_semantic_index, false);

const auto subtree_text = [&](const dom_node& root) {
std::string text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ int main() {
&& current_lease->view.request_id == 100 + index,
"ancestry lifecycle lease was lost");
completion_fixture result{100 + index,
index % 2 == 0 ? WEBSCENE_FILE_GRANT_ANCESTRY_SUCCESS_V2
: WEBSCENE_FILE_GRANT_ANCESTRY_NOT_DESCENDANT_V2,
static_cast<std::uint32_t>(
index % 2 == 0 ? WEBSCENE_FILE_GRANT_ANCESTRY_SUCCESS_V2
: WEBSCENE_FILE_GRANT_ANCESTRY_NOT_DESCENDANT_V2),
index % 2 == 0 ? std::vector<std::string>{"child"}
: std::vector<std::string>{}};
require(broker.complete(result.completion),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ struct entry_fixture final {
{sizeof(webscene_file_grant_metadata_v2), 2,
kind == WEBSCENE_FILE_PANEL_ENTRY_FILE_V2 ? 7U : 0U,
123, kind, 0},
kind == WEBSCENE_FILE_PANEL_ENTRY_FILE_V2
? WEBSCENE_FILE_PANEL_GRANT_READ_V2
: WEBSCENE_FILE_PANEL_GRANT_ENUMERATE_V2,
static_cast<std::uint32_t>(
kind == WEBSCENE_FILE_PANEL_ENTRY_FILE_V2
? WEBSCENE_FILE_PANEL_GRANT_READ_V2
: WEBSCENE_FILE_PANEL_GRANT_ENUMERATE_V2),
0, {name.data(), name.size()}, {grant.data(), grant.size()}};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ int main() {
const auto resident_before = resident_bytes();
const auto started = std::chrono::steady_clock::now();
for (std::uint64_t index = 0; index < cycles; ++index) {
const auto action = index % 3 == 0
const auto action = static_cast<std::uint32_t>(index % 3 == 0
? WEBSCENE_FILE_GRANT_DURABLE_EXPORT_V2
: index % 3 == 1 ? WEBSCENE_FILE_GRANT_DURABLE_RESTORE_V2
: WEBSCENE_FILE_GRANT_DURABLE_REVOKE_V2;
: WEBSCENE_FILE_GRANT_DURABLE_REVOKE_V2);
request_fixture current{100 + index, action};
require(broker.queue(current.request,
[&](file_grant_durable_completion_data_v2&&) { ++callbacks; }),
Expand Down
Loading