Skip to content

Commit dd590ec

Browse files
committed
feat: support array codegen
1 parent 5eb385b commit dd590ec

File tree

77 files changed

+503
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+503
-13
lines changed

bridge/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ if (${WEBF_JS_ENGINE} MATCHES "quickjs")
632632
out/plugin_api_mouse_event.cc
633633
out/plugin_api_mutation_observer_registration.cc
634634
out/plugin_api_performance_entry.cc
635+
out/plugin_api_performance.cc
635636
out/plugin_api_performance_mark.cc
636637
out/plugin_api_performance_measure.cc
637638
out/plugin_api_pointer_event.cc

bridge/core/api/executing_context.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "core/frame/module_manager.h"
1212
#include "core/frame/window.h"
1313
#include "core/frame/window_or_worker_global_scope.h"
14+
#include "core/timing/performance.h"
1415
#include "foundation/native_value_converter.h"
1516

1617
namespace webf {
@@ -26,6 +27,11 @@ WebFValue<Window, WindowPublicMethods> ExecutingContextWebFMethods::window(webf:
2627
context->window()->KeepAlive());
2728
}
2829

30+
WebFValue<Performance, PerformancePublicMethods> ExecutingContextWebFMethods::performance(webf::ExecutingContext* context) {
31+
return WebFValue<Performance, PerformancePublicMethods>(context->performance(), context->performance()->performancePublicMethods(),
32+
context->performance()->KeepAlive());
33+
}
34+
2935
WebFValue<SharedExceptionState, ExceptionStatePublicMethods> ExecutingContextWebFMethods::CreateExceptionState() {
3036
return WebFValue<SharedExceptionState, ExceptionStatePublicMethods>(new SharedExceptionState(),
3137
ExceptionState::publicMethodPointer(), nullptr);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (C) 2022-present The WebF authors. All rights reserved.
3+
*/
4+
5+
#ifndef WEBF_CORE_NATIVE_VECTOR_VALUE_REF_H_
6+
#define WEBF_CORE_NATIVE_VECTOR_VALUE_REF_H_
7+
8+
#include "plugin_api/webf_value.h"
9+
10+
namespace webf {
11+
struct VectorValueRef {
12+
int64_t size;
13+
void* data;
14+
15+
VectorValueRef(void* data, int64_t size) : data(data), size(size) {};
16+
};
17+
} // namespace webf
18+
19+
#endif // WEBF_CORE_NATIVE_VECTOR_VALUE_REF_H_

bridge/core/timing/performance.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,9 @@ void Performance::measure(const AtomicString& measure_name,
282282
}
283283
}
284284

285+
const PerformancePublicMethods* Performance::performancePublicMethods() {
286+
static PerformancePublicMethods performance_public_methods;
287+
return &performance_public_methods;
288+
}
289+
285290
} // namespace webf

bridge/core/timing/performance.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ interface Performance {
1111
getEntriesByName(name: string, type?: string): PerformanceEntry[];
1212

1313
mark(name: string, options?: PerformanceMarkOptions): void;
14-
measure(name: string): void;
15-
measure(name: string, startMark?: any): void;
14+
// measure(name: string): void;
15+
// measure(name: string, startMark?: any): void;
1616
measure(name: string, startMark?: any, endMark?: string): void;
1717
clearMarks(name?: string): void;
1818
clearMeasures(name?: string): void;

bridge/core/timing/performance.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "core/binding_object.h"
1313
#include "performance_entry.h"
1414
#include "qjs_performance_mark_options.h"
15+
#include "plugin_api/performance.h"
1516

1617
namespace webf {
1718

@@ -63,6 +64,8 @@ class Performance : public ScriptWrappable {
6364

6465
void Trace(GCVisitor* visitor) const override;
6566

67+
const PerformancePublicMethods* performancePublicMethods();
68+
6669
private:
6770
void measure(const AtomicString& measure_name,
6871
const AtomicString& start_mark,

bridge/include/plugin_api/add_event_listener_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef WEBF_CORE_WEBF_API_PLUGIN_API_ADD_EVENT_LISTENER_OPTIONS_H_
88
#define WEBF_CORE_WEBF_API_PLUGIN_API_ADD_EVENT_LISTENER_OPTIONS_H_
99
#include <stdint.h>
10+
#include "core/native/vector_value_ref.h"
1011
#include "webf_value.h"
1112
#include "foundation/native_value.h"
1213
namespace webf {

bridge/include/plugin_api/animation_event.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef WEBF_CORE_WEBF_API_PLUGIN_API_ANIMATION_EVENT_H_
88
#define WEBF_CORE_WEBF_API_PLUGIN_API_ANIMATION_EVENT_H_
99
#include <stdint.h>
10+
#include "core/native/vector_value_ref.h"
1011
#include "rust_readable.h"
1112
#include "event.h"
1213
namespace webf {

bridge/include/plugin_api/animation_event_init.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef WEBF_CORE_WEBF_API_PLUGIN_API_ANIMATION_EVENT_INIT_H_
88
#define WEBF_CORE_WEBF_API_PLUGIN_API_ANIMATION_EVENT_INIT_H_
99
#include <stdint.h>
10+
#include "core/native/vector_value_ref.h"
1011
#include "webf_value.h"
1112
#include "foundation/native_value.h"
1213
namespace webf {

bridge/include/plugin_api/bounding_client_rect.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef WEBF_CORE_WEBF_API_PLUGIN_API_BOUNDING_CLIENT_RECT_H_
88
#define WEBF_CORE_WEBF_API_PLUGIN_API_BOUNDING_CLIENT_RECT_H_
99
#include <stdint.h>
10+
#include "core/native/vector_value_ref.h"
1011
#include "rust_readable.h"
1112
#include "webf_value.h"
1213
namespace webf {

0 commit comments

Comments
 (0)