Update Blink integration
This both makes changes to follow changes in Blink and adds stubs for SetFooCallback methods
This commit is contained in:
parent
61ff48c640
commit
0d045029fa
|
@ -343,6 +343,9 @@ def c_native_methods(types, typ):
|
||||||
Method(Name('release'), types['void'], []),
|
Method(Name('release'), types['void'], []),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def js_native_methods(types, typ):
|
||||||
|
return cpp_native_methods(types, typ)
|
||||||
|
|
||||||
def debug(text):
|
def debug(text):
|
||||||
print(text)
|
print(text)
|
||||||
|
|
||||||
|
@ -435,18 +438,19 @@ def main():
|
||||||
|
|
||||||
if 'wire' in targets:
|
if 'wire' in targets:
|
||||||
renders.append(FileRender('wire/WireCmd.h', 'wire/WireCmd_autogen.h', base_backend_params))
|
renders.append(FileRender('wire/WireCmd.h', 'wire/WireCmd_autogen.h', base_backend_params))
|
||||||
renders.append(FileRender('wire/WireCmd.cpp', 'wire/WireCmd.cpp', base_backend_params))
|
renders.append(FileRender('wire/WireCmd.cpp', 'wire/WireCmd_autogen.cpp', base_backend_params))
|
||||||
renders.append(FileRender('wire/WireClient.cpp', 'wire/WireClient.cpp', base_backend_params))
|
renders.append(FileRender('wire/WireClient.cpp', 'wire/WireClient.cpp', base_backend_params))
|
||||||
renders.append(FileRender('wire/WireServer.cpp', 'wire/WireServer.cpp', base_backend_params))
|
renders.append(FileRender('wire/WireServer.cpp', 'wire/WireServer.cpp', base_backend_params))
|
||||||
|
|
||||||
if 'blink' in targets:
|
if 'blink' in targets:
|
||||||
renders.append(FileRender('blink/autogen.gni', 'autogen.gni', [base_params, api_params]))
|
js_params = {'native_methods': lambda typ: js_native_methods(api_params['types'], typ)}
|
||||||
renders.append(FileRender('blink/Objects.cpp', 'NXT.cpp', [base_params, api_params]))
|
renders.append(FileRender('blink/autogen.gni', 'autogen.gni', [base_params, api_params, js_params]))
|
||||||
renders.append(FileRender('blink/Forward.h', 'Forward.h', [base_params, api_params]))
|
renders.append(FileRender('blink/Objects.cpp', 'NXT.cpp', [base_params, api_params, js_params]))
|
||||||
|
renders.append(FileRender('blink/Forward.h', 'Forward.h', [base_params, api_params, js_params]))
|
||||||
|
|
||||||
for typ in api_params['by_category']['object']:
|
for typ in api_params['by_category']['object']:
|
||||||
file_prefix = 'NXT' + typ.name.CamelCase()
|
file_prefix = 'NXT' + typ.name.CamelCase()
|
||||||
params = [base_params, api_params, {'type': typ}]
|
params = [base_params, api_params, js_params, {'type': typ}]
|
||||||
|
|
||||||
renders.append(FileRender('blink/Object.h', file_prefix + '.h', params))
|
renders.append(FileRender('blink/Object.h', file_prefix + '.h', params))
|
||||||
renders.append(FileRender('blink/Object.idl', file_prefix + '.idl', params))
|
renders.append(FileRender('blink/Object.idl', file_prefix + '.idl', params))
|
||||||
|
|
|
@ -21,6 +21,16 @@ namespace blink {
|
||||||
class NXT{{other_type.name.CamelCase()}};
|
class NXT{{other_type.name.CamelCase()}};
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
class V8NXTDeviceErrorCallback;
|
||||||
|
using NXTDeviceErrorCallback = V8NXTDeviceErrorCallback*;
|
||||||
|
|
||||||
|
class V8NXTBuilderErrorCallback;
|
||||||
|
using NXTBuilderErrorCallback = V8NXTBuilderErrorCallback*;
|
||||||
|
|
||||||
|
class V8NXTBufferMapReadCallback;
|
||||||
|
using NXTBufferMapReadCallback = V8NXTBufferMapReadCallback*;
|
||||||
|
|
||||||
|
using NXTCallbackUserdata = uint64_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nxtProcTable_s;
|
struct nxtProcTable_s;
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
NXT{{type.name.CamelCase()}}*
|
NXT{{type.name.CamelCase()}}*
|
||||||
{%- elif type.category == "enum" or type.category == "bitmask" -%}
|
{%- elif type.category == "enum" or type.category == "bitmask" -%}
|
||||||
uint32_t
|
uint32_t
|
||||||
|
{%- elif type.category == "natively defined" -%}
|
||||||
|
NXT{{type.name.CamelCase()}}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{as_cType(type.name)}}
|
{{as_cType(type.name)}}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
@ -27,7 +29,7 @@
|
||||||
#ifndef {{Class}}_H
|
#ifndef {{Class}}_H
|
||||||
#define {{Class}}_H
|
#define {{Class}}_H
|
||||||
|
|
||||||
#include "bindings/core/v8/ScriptWrappable.h"
|
#include "platform/bindings/ScriptWrappable.h"
|
||||||
#include "platform/heap/GarbageCollected.h"
|
#include "platform/heap/GarbageCollected.h"
|
||||||
#include "platform/wtf/text/WTFString.h"
|
#include "platform/wtf/text/WTFString.h"
|
||||||
|
|
||||||
|
@ -54,7 +56,7 @@ class {{Class}} final :
|
||||||
{{Class}}({{as_cType(type.name)}} self, Member<NXTState> state);
|
{{Class}}({{as_cType(type.name)}} self, Member<NXTState> state);
|
||||||
void Dispose();
|
void Dispose();
|
||||||
|
|
||||||
{% for method in type.methods %}
|
{% for method in native_methods(type) %}
|
||||||
{% if method.return_type.name.concatcase() == "void" %}
|
{% if method.return_type.name.concatcase() == "void" %}
|
||||||
{{Class}}*
|
{{Class}}*
|
||||||
{%- else %}
|
{%- else %}
|
||||||
|
|
|
@ -13,12 +13,21 @@
|
||||||
//* limitations under the License.
|
//* limitations under the License.
|
||||||
|
|
||||||
typedef unsigned long uint32_t;
|
typedef unsigned long uint32_t;
|
||||||
|
typedef unsigned long long uint64_t;
|
||||||
|
typedef boolean bool;
|
||||||
|
|
||||||
|
typedef unsigned long long NXTCallbackUserdata;
|
||||||
|
callback NXTDeviceErrorCallback = void(DOMString message);
|
||||||
|
callback NXTBuilderErrorCallback = void(uint32_t status, DOMString message);
|
||||||
|
callback NXTBufferMapReadCallback = void(uint32_t status, ArrayBufferView data);
|
||||||
|
|
||||||
{% macro idlType(type) -%}
|
{% macro idlType(type) -%}
|
||||||
{%- if type.category == "object" -%}
|
{%- if type.category == "object" -%}
|
||||||
NXT{{type.name.CamelCase()}}
|
NXT{{type.name.CamelCase()}}
|
||||||
{%- elif type.category == "enum" or type.category == "bitmask" -%}
|
{%- elif type.category == "enum" or type.category == "bitmask" -%}
|
||||||
uint32_t
|
uint32_t
|
||||||
|
{%- elif type.category == "natively defined" -%}
|
||||||
|
NXT{{type.name.CamelCase()}}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{as_cType(type.name)}}
|
{{as_cType(type.name)}}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
@ -33,7 +42,7 @@ interface {{idlType(type)}} {
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% for method in type.methods %}
|
{% for method in native_methods(type) %}
|
||||||
{% if method.return_type.name.concatcase() == "void" %}
|
{% if method.return_type.name.concatcase() == "void" %}
|
||||||
{{idlType(type)}}
|
{{idlType(type)}}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
|
@ -47,7 +56,7 @@ interface {{idlType(type)}} {
|
||||||
{%- elif arg.annotation == "const*" and arg.length == "strlen" -%}
|
{%- elif arg.annotation == "const*" and arg.length == "strlen" -%}
|
||||||
DOMString {{as_varName(arg.name)}}
|
DOMString {{as_varName(arg.name)}}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{idlType(arg.type)}}[] {{as_varName(arg.name)}}
|
sequence<{{idlType(arg.type)}}> {{as_varName(arg.name)}}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
);
|
);
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
NXT{{type.name.CamelCase()}}*
|
NXT{{type.name.CamelCase()}}*
|
||||||
{%- elif type.category == "enum" or type.category == "bitmask" -%}
|
{%- elif type.category == "enum" or type.category == "bitmask" -%}
|
||||||
uint32_t
|
uint32_t
|
||||||
|
{%- elif type.category == "natively defined" -%}
|
||||||
|
NXT{{type.name.CamelCase()}}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{as_cType(type.name)}}
|
{{as_cType(type.name)}}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
@ -110,8 +112,25 @@ namespace blink {
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if type.is_builder %}
|
||||||
|
{{Class}}* {{Class}}::setErrorCallback(V8NXTBuilderErrorCallback*, unsigned long, unsigned long) {
|
||||||
|
//TODO
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{{as_cType(type.name)}} {{Class}}::GetNXT() {
|
{{as_cType(type.name)}} {{Class}}::GetNXT() {
|
||||||
return self_;
|
return self_;
|
||||||
}
|
}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
NXTDevice* NXTDevice::setErrorCallback(V8NXTDeviceErrorCallback*, unsigned long) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
NXTBuffer* NXTBuffer::mapReadAsync(unsigned int, unsigned int, V8NXTBufferMapReadCallback*, unsigned long) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue