Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/image-stream-comp…
Browse files Browse the repository at this point in the history
…eleter
  • Loading branch information
andycall committed Oct 25, 2021
2 parents cdbbaf1 + 4b15d8d commit e2da860
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 16 deletions.
15 changes: 12 additions & 3 deletions bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
cmake_minimum_required(VERSION 3.10.0)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.14)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11)
project(KrakenBridge)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
execute_process(
COMMAND bash "-c" "clang --version | xargs | awk '{print $7}' | cut -c1-5"
OUTPUT_VARIABLE CLANG_ARCH
)
## Set univeral archs for Apple arm64 processors
if (${CLANG_ARCH} MATCHES "arm64")
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
endif()
endif()

if (${ENABLE_PROFILE})
add_definitions(-DENABLE_PROFILE=1)
else ()
Expand Down Expand Up @@ -325,8 +336,6 @@ elseif ($ENV{KRAKEN_JS_ENGINE} MATCHES "quickjs")
bindings/qjs/dom/elements/.gen/object_element.h
bindings/qjs/dom/elements/.gen/script_element.cc
bindings/qjs/dom/elements/.gen/script_element.h
bindings/qjs/dom/elements/.gen/svg_element.h
bindings/qjs/dom/elements/.gen/svg_element.cc
bindings/qjs/dom/elements/template_element.cc
bindings/qjs/dom/elements/template_element.h
bindings/qjs/dom/events/.gen/close_event.h
Expand Down
2 changes: 0 additions & 2 deletions bridge/bindings/qjs/dom/document.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "elements/.gen/object_element.h"
#include "elements/.gen/script_element.h"
#include "elements/template_element.h"
#include "elements/.gen/svg_element.h"

#include "events/.gen/close_event.h"
#include "events/.gen/gesture_event.h"
Expand Down Expand Up @@ -77,7 +76,6 @@ Document::Document(JSContext *context) : Node(context, "Document") {
Element::defineElement("input", InputElement::instance(m_context));
Element::defineElement("object", ObjectElement::instance(m_context));
Element::defineElement("script", ScriptElement::instance(m_context));
Element::defineElement("svg", SVGElement::instance(m_context));
Element::defineElement("template", TemplateElement::instance(m_context));
document_registered = true;
}
Expand Down
5 changes: 0 additions & 5 deletions bridge/bindings/qjs/dom/elements/svg_element.d.ts

This file was deleted.

10 changes: 8 additions & 2 deletions bridge/bindings/qjs/js_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ JSClassID JSContext::kHostClassClassId {0};
JSClassID JSContext::kHostObjectClassId {0};
JSClassID JSContext::kHostExoticObjectClassId{0};

std::atomic<int32_t> runningContexts{0};

#define MAX_JS_CONTEXT 1024
bool valid_contexts[MAX_JS_CONTEXT];
std::atomic<uint32_t> running_context_list{0};
Expand Down Expand Up @@ -69,6 +71,8 @@ JSContext::JSContext(int32_t contextId, const JSExceptionHandler &handler, void
JS_FreeAtom(m_ctx, windowKey);
JS_SetContextOpaque(m_ctx, this);
JS_SetHostPromiseRejectionTracker(m_runtime, promiseRejectTracker, this);

runningContexts++;
}

JSContext::~JSContext() {
Expand Down Expand Up @@ -157,8 +161,10 @@ JSContext::~JSContext() {
JS_RunGC(m_runtime);

#if DUMP_LEAKS
JS_FreeRuntime(m_runtime);
m_runtime = nullptr;
if (--runningContexts == 0) {
JS_FreeRuntime(m_runtime);
m_runtime = nullptr;
}
#endif
m_ctx = nullptr;
}
Expand Down
2 changes: 0 additions & 2 deletions bridge/bridge_qjs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "bindings/qjs/dom/elements/.gen/input_element.h"
#include "bindings/qjs/dom/elements/.gen/object_element.h"
#include "bindings/qjs/dom/elements/.gen/script_element.h"
#include "bindings/qjs/dom/elements/.gen/svg_element.h"
#include "bindings/qjs/dom/elements/template_element.h"
#include "bindings/qjs/dom/elements/image_element.h"
#include "bindings/qjs/dom/event.h"
Expand Down Expand Up @@ -89,7 +88,6 @@ JSBridge::JSBridge(int32_t contextId, const JSExceptionHandler &handler) : conte
bindObjectElement(m_context);
bindScriptElement(m_context);
bindTemplateElement(m_context);
bindSVGElement(m_context);
bindCSSStyleDeclaration(m_context);
bindCloseEvent(m_context);
bindGestureEvent(m_context);
Expand Down
11 changes: 11 additions & 0 deletions bridge/polyfill/src/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,14 @@ Object.defineProperty(document, 'body', {
enumerable: true,
configurable: false
});

// @ts-ignore
class SVGElement extends Element {
constructor() {
super();
}
}

Object.defineProperty(window, 'SVGElement', {
value: SVGElement
});
2 changes: 1 addition & 1 deletion kraken/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: kraken
description: A high-performance, web standards-compliant rendering engine.
version: 0.9.0-rc
version: 0.9.0-rc.2
homepage: https://openkraken.com

environment:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build:bridge:all:release": "KRAKEN_BUILD=Release node scripts/prepare_kraken_release_binary",
"build:android:sdk": "KRAKEN_BUILD=Release node scripts/build_android_sdk",
"build:ios:sdk": "KRAKEN_BUILD=Release node scripts/build_ios_sdk",
"pretest": "npm install && npm run lint && node scripts/build_darwin_dylib",
"pretest": "npm install && npm run lint && ENABLE_ASAN=true node scripts/build_darwin_dylib",
"benchmark": "npm install && ENABLE_PROFILE=true KRAKEN_BUILD=Release node scripts/run_benchmark.js",
"start": "cd kraken/example && flutter run",
"test": "node scripts/run_test.js",
Expand Down
4 changes: 4 additions & 0 deletions scripts/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ task('build-darwin-kraken-lib', done => {
externCmakeArgs.push('-DENABLE_PROFILE=TRUE');
}

if (process.env.ENABLE_ASAN === 'true') {
externCmakeArgs.push('-DENABLE_ASAN=true');
}

if (builtWithDebugJsc) {
let debugJsEngine = findDebugJSEngine(platform == 'darwin' ? 'macos' : platform);
externCmakeArgs.push(`-DDEBUG_JSC_ENGINE=${debugJsEngine}`)
Expand Down

0 comments on commit e2da860

Please sign in to comment.