Remove Blink templates from this repository.
The templates will live in the Chromium prototype. This also removes the blink/ prefix from the Blink template filenames as this won't be present in anymore.
This commit is contained in:
parent
0d045029fa
commit
f280e87f36
|
@ -444,16 +444,16 @@ def main():
|
|||
|
||||
if 'blink' in targets:
|
||||
js_params = {'native_methods': lambda typ: js_native_methods(api_params['types'], typ)}
|
||||
renders.append(FileRender('blink/autogen.gni', 'autogen.gni', [base_params, api_params, js_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]))
|
||||
renders.append(FileRender('autogen.gni', 'autogen.gni', [base_params, api_params, js_params]))
|
||||
renders.append(FileRender('Objects.cpp', 'NXT.cpp', [base_params, api_params, js_params]))
|
||||
renders.append(FileRender('Forward.h', 'Forward.h', [base_params, api_params, js_params]))
|
||||
|
||||
for typ in api_params['by_category']['object']:
|
||||
file_prefix = 'NXT' + typ.name.CamelCase()
|
||||
params = [base_params, api_params, js_params, {'type': typ}]
|
||||
|
||||
renders.append(FileRender('blink/Object.h', file_prefix + '.h', params))
|
||||
renders.append(FileRender('blink/Object.idl', file_prefix + '.idl', params))
|
||||
renders.append(FileRender('Object.h', file_prefix + '.h', params))
|
||||
renders.append(FileRender('Object.idl', file_prefix + '.idl', params))
|
||||
|
||||
output_separator = '\n' if args.gn else ';'
|
||||
if args.print_dependencies:
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
//* Copyright 2017 The NXT Authors
|
||||
//*
|
||||
//* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//* you may not use this file except in compliance with the License.
|
||||
//* You may obtain a copy of the License at
|
||||
//*
|
||||
//* http://www.apache.org/licenses/LICENSE-2.0
|
||||
//*
|
||||
//* Unless required by applicable law or agreed to in writing, software
|
||||
//* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//* See the License for the specific language governing permissions and
|
||||
//* limitations under the License.
|
||||
|
||||
#ifndef NXTForward_H
|
||||
#define NXTForward_H
|
||||
|
||||
namespace blink {
|
||||
|
||||
{% for other_type in by_category["object"] %}
|
||||
class NXT{{other_type.name.CamelCase()}};
|
||||
{% endfor %}
|
||||
|
||||
class V8NXTDeviceErrorCallback;
|
||||
using NXTDeviceErrorCallback = V8NXTDeviceErrorCallback*;
|
||||
|
||||
class V8NXTBuilderErrorCallback;
|
||||
using NXTBuilderErrorCallback = V8NXTBuilderErrorCallback*;
|
||||
|
||||
class V8NXTBufferMapReadCallback;
|
||||
using NXTBufferMapReadCallback = V8NXTBufferMapReadCallback*;
|
||||
|
||||
using NXTCallbackUserdata = uint64_t;
|
||||
}
|
||||
|
||||
struct nxtProcTable_s;
|
||||
typedef struct nxtProcTable_s nxtProcTable;
|
||||
|
||||
{% for type in by_category["object"] %}
|
||||
typedef struct {{as_cType(type.name)}}Impl* {{as_cType(type.name)}};
|
||||
{% endfor %}
|
||||
|
||||
#endif //NXTForward_H
|
|
@ -1,101 +0,0 @@
|
|||
//* Copyright 2017 The NXT Authors
|
||||
//*
|
||||
//* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//* you may not use this file except in compliance with the License.
|
||||
//* You may obtain a copy of the License at
|
||||
//*
|
||||
//* http://www.apache.org/licenses/LICENSE-2.0
|
||||
//*
|
||||
//* Unless required by applicable law or agreed to in writing, software
|
||||
//* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//* See the License for the specific language governing permissions and
|
||||
//* limitations under the License.
|
||||
|
||||
{% macro blinkType(type) -%}
|
||||
{%- if type.category == "object" -%}
|
||||
NXT{{type.name.CamelCase()}}*
|
||||
{%- elif type.category == "enum" or type.category == "bitmask" -%}
|
||||
uint32_t
|
||||
{%- elif type.category == "natively defined" -%}
|
||||
NXT{{type.name.CamelCase()}}
|
||||
{%- else -%}
|
||||
{{as_cType(type.name)}}
|
||||
{%- endif -%}
|
||||
{%- endmacro %}
|
||||
|
||||
{% set Class = "NXT" + type.name.CamelCase() %}
|
||||
|
||||
#ifndef {{Class}}_H
|
||||
#define {{Class}}_H
|
||||
|
||||
#include "platform/bindings/ScriptWrappable.h"
|
||||
#include "platform/heap/GarbageCollected.h"
|
||||
#include "platform/wtf/text/WTFString.h"
|
||||
|
||||
#include "../NXTState.h"
|
||||
#include "Forward.h"
|
||||
|
||||
namespace blink {
|
||||
|
||||
class {{Class}} final :
|
||||
public GarbageCollectedFinalized<{{Class}}>,
|
||||
public ScriptWrappable {
|
||||
|
||||
WTF_MAKE_NONCOPYABLE({{Class}});
|
||||
USING_PRE_FINALIZER({{Class}}, Dispose);
|
||||
public:
|
||||
DEFINE_INLINE_TRACE() {
|
||||
visitor->Trace(state_);
|
||||
};
|
||||
|
||||
public:
|
||||
DEFINE_WRAPPERTYPEINFO();
|
||||
|
||||
public:
|
||||
{{Class}}({{as_cType(type.name)}} self, Member<NXTState> state);
|
||||
void Dispose();
|
||||
|
||||
{% for method in native_methods(type) %}
|
||||
{% if method.return_type.name.concatcase() == "void" %}
|
||||
{{Class}}*
|
||||
{%- else %}
|
||||
{{blinkType(method.return_type)}}
|
||||
{%- endif -%}
|
||||
{{" "}}{{method.name.camelCase()}}(
|
||||
{%- for arg in method.arguments -%}
|
||||
{%- if not loop.first %}, {% endif -%}
|
||||
{%- if arg.annotation == "value" -%}
|
||||
{{blinkType(arg.type)}} {{as_varName(arg.name)}}
|
||||
{%- elif arg.annotation == "const*" and arg.length == "strlen" -%}
|
||||
String {{as_varName(arg.name)}}
|
||||
{%- else -%}
|
||||
{%- if arg.type.category == "object" -%}
|
||||
const HeapVector<Member<NXT{{(arg.type.name.CamelCase())}}>>& {{as_varName(arg.name)}}
|
||||
{%- else -%}
|
||||
const Vector<{{blinkType(arg.type)}}>& {{as_varName(arg.name)}}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
);
|
||||
{% endfor %}
|
||||
|
||||
{{as_cType(type.name)}} GetNXT();
|
||||
|
||||
{% if type.name.canonical_case() == "device" %}
|
||||
{% for type in by_category["enum"] + by_category["bitmask"] %}
|
||||
{% for value in type.values %}
|
||||
static constexpr uint32_t k{{type.name.CamelCase()}}{{value.name.CamelCase()}} = 0x{{format(value.value, "08X")}};
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
private:
|
||||
{{as_cType(type.name)}} self_ = nullptr;
|
||||
Member<NXTState> state_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // {{Class}}_H
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
//* Copyright 2017 The NXT Authors
|
||||
//*
|
||||
//* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//* you may not use this file except in compliance with the License.
|
||||
//* You may obtain a copy of the License at
|
||||
//*
|
||||
//* http://www.apache.org/licenses/LICENSE-2.0
|
||||
//*
|
||||
//* Unless required by applicable law or agreed to in writing, software
|
||||
//* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//* See the License for the specific language governing permissions and
|
||||
//* limitations under the License.
|
||||
|
||||
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) -%}
|
||||
{%- if type.category == "object" -%}
|
||||
NXT{{type.name.CamelCase()}}
|
||||
{%- elif type.category == "enum" or type.category == "bitmask" -%}
|
||||
uint32_t
|
||||
{%- elif type.category == "natively defined" -%}
|
||||
NXT{{type.name.CamelCase()}}
|
||||
{%- else -%}
|
||||
{{as_cType(type.name)}}
|
||||
{%- endif -%}
|
||||
{%- endmacro %}
|
||||
|
||||
interface {{idlType(type)}} {
|
||||
{% if type.name.canonical_case() == "device" %}
|
||||
{% for type in by_category["enum"] + by_category["bitmask"] %}
|
||||
{% for value in type.values %}
|
||||
const uint32_t {{type.name.SNAKE_CASE()}}_{{value.name.SNAKE_CASE()}} = 0x{{format(value.value, "08X")}};
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% for method in native_methods(type) %}
|
||||
{% if method.return_type.name.concatcase() == "void" %}
|
||||
{{idlType(type)}}
|
||||
{%- else %}
|
||||
{{idlType(method.return_type)}}
|
||||
{%- endif -%}
|
||||
{{" "}}{{method.name.camelCase()}}(
|
||||
{%- for arg in method.arguments -%}
|
||||
{%- if not loop.first %}, {% endif -%}
|
||||
{%- if arg.annotation == "value" -%}
|
||||
{{idlType(arg.type)}} {{as_varName(arg.name)}}
|
||||
{%- elif arg.annotation == "const*" and arg.length == "strlen" -%}
|
||||
DOMString {{as_varName(arg.name)}}
|
||||
{%- else -%}
|
||||
sequence<{{idlType(arg.type)}}> {{as_varName(arg.name)}}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
);
|
||||
{% endfor %}
|
||||
};
|
|
@ -1,136 +0,0 @@
|
|||
//* Copyright 2017 The NXT Authors
|
||||
//*
|
||||
//* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//* you may not use this file except in compliance with the License.
|
||||
//* You may obtain a copy of the License at
|
||||
//*
|
||||
//* http://www.apache.org/licenses/LICENSE-2.0
|
||||
//*
|
||||
//* Unless required by applicable law or agreed to in writing, software
|
||||
//* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//* See the License for the specific language governing permissions and
|
||||
//* limitations under the License.
|
||||
|
||||
{% macro blinkType(type) -%}
|
||||
{%- if type.category == "object" -%}
|
||||
NXT{{type.name.CamelCase()}}*
|
||||
{%- elif type.category == "enum" or type.category == "bitmask" -%}
|
||||
uint32_t
|
||||
{%- elif type.category == "natively defined" -%}
|
||||
NXT{{type.name.CamelCase()}}
|
||||
{%- else -%}
|
||||
{{as_cType(type.name)}}
|
||||
{%- endif -%}
|
||||
{%- endmacro %}
|
||||
|
||||
{% for other_type in by_category["object"] %}
|
||||
#include "NXT{{other_type.name.CamelCase()}}.h"
|
||||
{% endfor %}
|
||||
|
||||
#include "nxt/nxt.h"
|
||||
#include "platform/wtf/text/StringUTF8Adaptor.h"
|
||||
|
||||
namespace blink {
|
||||
|
||||
{% for type in by_category["object"] %}
|
||||
{% set Class = "NXT" + type.name.CamelCase() %}
|
||||
{{Class}}::{{Class}}({{as_cType(type.name)}} self, Member<NXTState> state)
|
||||
: self_(self), state_(state) {
|
||||
}
|
||||
void {{Class}}::Dispose() {
|
||||
{% if type.name.canonical_case() != "device" %}
|
||||
state_->GetProcTable()->{{as_varName(type.name, Name("release"))}}(self_);
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
{% for method in type.methods %}
|
||||
{% if method.return_type.name.concatcase() == "void" %}
|
||||
{{Class}}*
|
||||
{%- else %}
|
||||
{{blinkType(method.return_type)}}
|
||||
{%- endif -%}
|
||||
{{" "}}{{Class}}::{{method.name.camelCase()}}(
|
||||
{%- for arg in method.arguments -%}
|
||||
{%- if not loop.first %}, {% endif -%}
|
||||
{%- if arg.annotation == "value" -%}
|
||||
{{blinkType(arg.type)}} {{as_varName(arg.name)}}_
|
||||
{%- elif arg.annotation == "const*" and arg.length == "strlen" -%}
|
||||
String {{as_varName(arg.name)}}_
|
||||
{%- else -%}
|
||||
{%- if arg.type.category == "object" -%}
|
||||
const HeapVector<Member<NXT{{(arg.type.name.CamelCase())}}>>& {{as_varName(arg.name)}}_
|
||||
{%- else -%}
|
||||
const Vector<{{blinkType(arg.type)}}>& {{as_varName(arg.name)}}_
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
) {
|
||||
{% for arg in method.arguments %}
|
||||
{% set argName = as_varName(arg.name) %}
|
||||
{% set cType = as_cType(arg.type.name) %}
|
||||
{% if arg.annotation == "value" %}
|
||||
{% if arg.type.category == "object" %}
|
||||
{{cType}} {{argName}} = {{argName}}_->GetNXT();
|
||||
{% else %}
|
||||
{{cType}} {{argName}} = static_cast<{{cType}}>({{argName}}_);
|
||||
{% endif %}
|
||||
{% elif arg.annotation == "const*" %}
|
||||
{% if arg.length == "strlen" %}
|
||||
WTF::StringUTF8Adaptor {{argName}}Adaptor({{argName}}_);
|
||||
std::string {{argName}}String({{argName}}Adaptor.Data(), {{argName}}Adaptor.length());
|
||||
const char* {{argName}} = {{argName}}String.c_str();
|
||||
{% elif arg.type.category == "object" %}
|
||||
//* TODO error on bad length
|
||||
auto {{argName}}Array = std::unique_ptr<{{cType}}[]>(new {{cType}}[{{argName}}_.size()]);
|
||||
for (size_t i = 0; i < {{argName}}_.size(); i++) {
|
||||
{{argName}}Array[i] = {{argName}}_[i]->GetNXT();
|
||||
}
|
||||
const {{cType}}* {{argName}} = &{{argName}}Array[0];
|
||||
{% else %}
|
||||
//* TODO error on bad length
|
||||
const {{cType}}* {{argName}} = {{argName}}_.data();
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if method.return_type.name.concatcase() != "void" %}
|
||||
auto result =
|
||||
{%- endif %}
|
||||
state_->GetProcTable()->{{as_varName(type.name, method.name)}}(self_
|
||||
{%- for arg in method.arguments -%}
|
||||
, {{as_varName(arg.name)}}
|
||||
{%- endfor -%}
|
||||
);
|
||||
|
||||
{% if method.return_type.name.concatcase() == "void" %}
|
||||
return this;
|
||||
{% else %}
|
||||
// TODO actually return the object given by the call to the procs
|
||||
return new NXT{{method.return_type.name.CamelCase()}}(result, state_);
|
||||
{% endif %}
|
||||
}
|
||||
{% endfor %}
|
||||
|
||||
{% if type.is_builder %}
|
||||
{{Class}}* {{Class}}::setErrorCallback(V8NXTBuilderErrorCallback*, unsigned long, unsigned long) {
|
||||
//TODO
|
||||
return this;
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
{{as_cType(type.name)}} {{Class}}::GetNXT() {
|
||||
return self_;
|
||||
}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
NXTDevice* NXTDevice::setErrorCallback(V8NXTDeviceErrorCallback*, unsigned long) {
|
||||
return this;
|
||||
}
|
||||
|
||||
NXTBuffer* NXTBuffer::mapReadAsync(unsigned int, unsigned int, V8NXTBufferMapReadCallback*, unsigned long) {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
//* Copyright 2017 The NXT Authors
|
||||
//*
|
||||
//* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//* you may not use this file except in compliance with the License.
|
||||
//* You may obtain a copy of the License at
|
||||
//*
|
||||
//* http://www.apache.org/licenses/LICENSE-2.0
|
||||
//*
|
||||
//* Unless required by applicable law or agreed to in writing, software
|
||||
//* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//* See the License for the specific language governing permissions and
|
||||
//* limitations under the License.
|
||||
|
||||
typedef unsigned long uint32_t;
|
||||
|
||||
{% macro idlType(type) -%}
|
||||
{%- if type.category == "object" -%}
|
||||
NXT{{type.name.CamelCase()}}
|
||||
{%- else -%}
|
||||
{{as_cType(type.name)}}
|
||||
{%- endif -%}
|
||||
{%- endmacro %}
|
||||
|
||||
interface {{as_idlType(type.name)}} {
|
||||
{% if type.name.canonical_case() == "device" %}
|
||||
{% for type in by_category["enum"] + by_category["bitmask"] %}
|
||||
{% for value in type.values %}
|
||||
const uint32_t {{type.name.SNAKE_CASE()}}_{{value.name.SNAKE_CASE()}} = 0x{{format(value.value, "08X")}};
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% for method in type.methods %}
|
||||
{% if method.return_type.name.concatcase() == "void" %}
|
||||
{{as_idlType(type.name)}}
|
||||
{%- else %}
|
||||
{{as_idlType(method.return_type.name)}}
|
||||
{%- endif -%}
|
||||
{{" "}}{{method.name.camelCase()}}(
|
||||
{%- for arg in method.arguments -%}
|
||||
{%- if not loop.first %}, {% endif -%}
|
||||
{%- if arg.annotation == "value" -%}
|
||||
{{as_idlType(arg.type.name)}} {{as_varName(arg.name)}}
|
||||
{%- elif arg.annotation == "const*" and arg.length == "strlen" -%}
|
||||
String {{as_varName(arg.name)}}
|
||||
{%- else -%}
|
||||
{{as_idlType(arg.type.name)}}[] {{as_varName(arg.name)}}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
);
|
||||
{% endfor %}
|
||||
};
|
|
@ -1,27 +0,0 @@
|
|||
//* Copyright 2017 The NXT Authors
|
||||
//*
|
||||
//* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//* you may not use this file except in compliance with the License.
|
||||
//* You may obtain a copy of the License at
|
||||
//*
|
||||
//* http://www.apache.org/licenses/LICENSE-2.0
|
||||
//*
|
||||
//* Unless required by applicable law or agreed to in writing, software
|
||||
//* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//* See the License for the specific language governing permissions and
|
||||
//* limitations under the License.
|
||||
|
||||
autogen_nxt_sources = [
|
||||
"gen/NXT.cpp",
|
||||
"gen/Forward.h",
|
||||
{% for type in by_category["object"] %}
|
||||
"gen/NXT{{type.name.CamelCase()}}.h",
|
||||
{% endfor %}
|
||||
]
|
||||
|
||||
autogen_nxt_idl = [
|
||||
{% for type in by_category["object"] %}
|
||||
"nxt/gen/NXT{{type.name.CamelCase()}}.idl",
|
||||
{% endfor %}
|
||||
]
|
Loading…
Reference in New Issue