Commit bea66367 authored by Wez's avatar Wez Committed by Commit Bot

[fuchsia] Remove fidlgen_js code, tests, build & bot rules.

The FIDL/JS generator is unused and would likely be re-implemented for
integration into the V8 repo, so remove it from Chromium. We can of
course refer to the removed implementation thanks to source control!

Bug: 1043093, fuchsia:44191
Change-Id: I93db91acef1a31e0e54ec1b9c4348963bd9e5f90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007393
Auto-Submit: Wez <wez@chromium.org>
Commit-Queue: David Dorwin <ddorwin@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Reviewed-by: default avatarDavid Dorwin <ddorwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732919}
parent 416fb111
...@@ -237,10 +237,6 @@ group("gn_all") { ...@@ -237,10 +237,6 @@ group("gn_all") {
} else if (is_fuchsia) { } else if (is_fuchsia) {
deps += [ deps += [
":d8_fuchsia", ":d8_fuchsia",
# TODO(https://bugs.fuchsia.dev/44191): Fix the build and re-instate this
# target.
# "//build/fuchsia/fidlgen_js:fidlgen_js_unittests",
"//fuchsia:gn_all", "//fuchsia:gn_all",
"//headless:headless_non_renderer", "//headless:headless_non_renderer",
] ]
......
...@@ -15,7 +15,7 @@ assert(is_fuchsia) ...@@ -15,7 +15,7 @@ assert(is_fuchsia)
# deps - (optional) List of other fidl_library() targets that this # deps - (optional) List of other fidl_library() targets that this
# FIDL library depends on. # FIDL library depends on.
# languages - Generate bindings for the given languages, defaults to # languages - Generate bindings for the given languages, defaults to
# [ "cpp" ]. "js" also supported. # [ "cpp" ]. Only "cpp" is currently supported.
# #
# $namespace.$library_name must match the the library name specified in the FIDL # $namespace.$library_name must match the the library name specified in the FIDL
# files. # files.
...@@ -45,16 +45,8 @@ template("fidl_library") { ...@@ -45,16 +45,8 @@ template("fidl_library") {
languages = [ "cpp" ] languages = [ "cpp" ]
} }
_define_cpp_action = false assert(languages == [ "cpp" ])
_define_js_action = false _define_cpp_action = true
foreach(language, languages) {
if (language == "cpp") {
_define_cpp_action = true
} else if (language == "js") {
_define_js_action = true
}
}
_response_file = "$target_gen_dir/$target_name.rsp" _response_file = "$target_gen_dir/$target_name.rsp"
_json_representation = "$target_gen_dir/${_library_name}.fidl.json" _json_representation = "$target_gen_dir/${_library_name}.fidl.json"
...@@ -182,38 +174,6 @@ template("fidl_library") { ...@@ -182,38 +174,6 @@ template("fidl_library") {
} }
} }
if (_define_js_action) {
_output_js_path = "$_output_gen_dir/${_library_path}/js/fidl.js"
action("${target_name}_js_gen") {
visibility = [ ":${invoker.target_name}" ]
forward_variables_from(invoker, [ "testonly" ])
deps = [ ":${invoker.target_name}_compile" ]
inputs = [
# Depend on the SDK hash, to ensure rebuild if the SDK tools change.
"${fuchsia_sdk}/.hash",
_json_representation,
"//build/fuchsia/fidlgen_js/fidl.py", # The schema helper file.
]
outputs = [ _output_js_path ]
script = "//build/fuchsia/fidlgen_js/gen.py"
args = [
rebase_path(_json_representation, root_build_dir),
"--output",
rebase_path("${_output_js_path}", root_build_dir),
]
data = []
foreach(o, outputs) {
data += [ o ]
}
}
}
config("${target_name}_config") { config("${target_name}_config") {
visibility = [ ":${invoker.target_name}" ] visibility = [ ":${invoker.target_name}" ]
include_dirs = [ _output_gen_dir ] include_dirs = [ _output_gen_dir ]
......
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/fuchsia/fidl_library.gni")
import("//testing/test.gni")
test("fidlgen_js_unittests") {
testonly = true
sources = [ "test/fidlgen_js_unittest.cc" ]
deps = [
":fidljstest",
":runtime",
"//base/test:test_support",
"//gin:gin_test",
"//testing/gtest",
"//v8",
]
configs += [
"//tools/v8_context_snapshot:use_v8_context_snapshot",
"//v8:external_startup_data",
]
data_deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
data = [ "runtime/fidl.mjs" ]
}
static_library("runtime") {
sources = [
"runtime/zircon.cc",
"runtime/zircon.h",
]
deps = [
"//base",
"//gin",
"//third_party/fuchsia-sdk/sdk:async",
"//third_party/fuchsia-sdk/sdk:async-default",
"//v8",
]
}
fidl_library("fidljstest") {
testonly = true
sources = [ "test/simple.fidl" ]
languages = [
"cpp",
"js",
]
}
include_rules = [
"+gin",
"+v8/include",
]
This diff is collapsed.
This diff is collapsed.
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is the JS runtime support library for code generated by fidlgen_js. It
// mostly consists of helpers to facilitate encoding and decoding of FIDL
// messages.
const $fidl_kInitialBufferSize = 1024;
const $fidl_kMessageHeaderSize = 16;
const $fidl_kMessageTxidOffset = 0;
const $fidl_kMessageOrdinalOffset = 8;
const $fidl__kAlignment = 8;
const $fidl__kAlignmentMask = 0x7;
const $fidl__kLE = true;
const $fidl__kUserspaceTxidMask = 0x7fffffff;
const $fidl__kHandlePresent = 0xffffffff;
const $fidl__kInvalidUnionTag = 0xffffffff;
var $fidl__nextTxid = 1;
function $fidl__align(size) {
return size + (($fidl__kAlignment - (size & $fidl__kAlignmentMask)) &
$fidl__kAlignmentMask);
}
function $fidl__setUint64LE(dataView, offset, value) {
var high_bits = Number(BigInt.asUintN(32, value >> 32n))
var low_bits = Number(BigInt.asUintN(32, value))
dataView.setUint32(offset+4, high_bits, $fidl__kLE);
dataView.setUint32(offset+0, low_bits, $fidl__kLE);
}
/**
* @constructor
* @param {number} ordinal
*/
function $fidl_Encoder(ordinal, has_response) {
var buf = new ArrayBuffer($fidl_kInitialBufferSize);
this.data = new DataView(buf);
this.extent = 0;
this.handles = [];
this._encodeMessageHeader(ordinal, has_response);
}
/**
* @param {number} ordinal
*/
$fidl_Encoder.prototype._encodeMessageHeader = function(ordinal, has_response) {
this.alloc($fidl_kMessageHeaderSize);
var txid = has_response ? ($fidl__nextTxid++ & $fidl__kUserspaceTxidMask) : 0;
this.data.setUint32($fidl_kMessageTxidOffset, txid, $fidl__kLE);
$fidl__setUint64LE(
this.data, $fidl_kMessageOrdinalOffset, ordinal, $fidl__kLE);
};
/**
* @param {number} size
*/
$fidl_Encoder.prototype.alloc = function(size) {
var offset = this.extent;
this._claimMemory($fidl__align(size));
return offset;
};
/**
* @param {number} claimSize
*/
$fidl_Encoder.prototype._claimMemory = function(claimSize) {
this.extent += claimSize;
if (this.extent > this.data.byteLength) {
var newSize = this.data.byteLength + claimSize;
newSize += newSize * 2;
this._grow(newSize);
}
};
/**
* @param {number} newSize
*/
$fidl_Encoder.prototype._grow = function(newSize) {
var newBuffer = new ArrayBuffer(newSize);
new Uint8Array(newBuffer).set(new Uint8Array(this.data.buffer));
this.data = new DataView(newBuffer);
};
/**
* @param {number} handle
*/
$fidl_Encoder.prototype.addHandle = function(handle) {
this.handles.push(handle);
};
$fidl_Encoder.prototype.messageData = function() {
return new DataView(this.data.buffer, 0, this.extent);
};
$fidl_Encoder.prototype.messageHandles = function() {
return this.handles;
};
/**
* @constructor
* @param {Array} data
* @param {Array} handles
*/
function $fidl_Decoder(data, handles) {
this.data = data;
this.handles = handles;
this.nextOffset = 0;
this.nextHandle = 0;
this.claimMemory($fidl_kMessageHeaderSize);
}
/**
* @param {number} size
*/
$fidl_Decoder.prototype.claimMemory = function(size) {
var result = this.nextOffset;
this.nextOffset = $fidl__align(this.nextOffset + size);
return result;
}
$fidl_Decoder.prototype.claimHandle = function() {
if (this.nextHandle >= this.handles.length)
throw "Attempt to claim more handles than are available";
return this.handles[this.nextHandle++];
}
// Type tables and encoding helpers for generated Proxy code.
const _kTT_bool = {
enc: function(e, o, v) { e.data.setInt8(o, v ? 1 : 0); },
dec: function(d, o) { return d.data.getInt8(o) != 0; },
};
const _kTT_float32 = {
enc: function(e, o, v) { e.data.setFloat32(o, v, $fidl__kLE); },
dec: function(d, o) { return d.data.getFloat32(o, $fidl__kLE); },
};
const _kTT_float64 = {
enc: function(e, o, v) { e.data.setFloat64(o, v, $fidl__kLE); },
dec: function(d, o) { return d.data.getFloat64(o, $fidl__kLE); },
};
const _kTT_int8 = {
enc: function(e, o, v) { e.data.setInt8(o, v); },
dec: function(d, o) { return d.data.getInt8(o); },
};
const _kTT_int16 = {
enc: function(e, o, v) { e.data.setInt16(o, v, $fidl__kLE); },
dec: function(d, o) { return d.data.getInt16(o, $fidl__kLE); },
};
const _kTT_int32 = {
enc: function(e, o, v) { e.data.setUint32(o, v, $fidl__kLE); },
dec: function(d, o) { return d.data.getInt32(o, $fidl__kLE); },
};
const _kTT_int64 = {
enc: function(e, o, v) {
var bi = BigInt.asIntN(64, BigInt(v));
var x = Number(bi & 0xffffffffn);
var y = Number((bi >> 32n) & 0xffffffffn);
e.data.setInt32(o, x, $fidl__kLE);
e.data.setInt32(o + 4, y, $fidl__kLE);
},
dec: function(d, o) {
var x = BigInt.asIntN(64, BigInt(d.data.getInt32(o, $fidl__kLE)));
var y = BigInt.asIntN(64, BigInt(d.data.getInt32(o + 4, $fidl__kLE)));
return x | (y << 32n);
},
};
const _kTT_uint8 = {
enc: function(e, o, v) { e.data.setUint8(o, v); },
dec: function(d, o) { return d.data.getUint8(o); },
};
const _kTT_uint16 = {
enc: function(e, o, v) { e.data.setUint16(o, v, $fidl__kLE); },
dec: function(d, o) { return d.data.getUint16(o, $fidl__kLE); },
};
const _kTT_uint32 = {
enc: function(e, o, v) { e.data.setUint32(o, v, $fidl__kLE); },
dec: function(d, o) { return d.data.getUint32(o, $fidl__kLE); },
};
const _kTT_uint64 = {
enc: function(e, o, v) {
var bi = BigInt.asUintN(64, BigInt(v));
var x = Number(bi & 0xffffffffn);
var y = Number((bi >> 32n) & 0xffffffffn);
e.data.setUint32(o, x, $fidl__kLE);
e.data.setUint32(o + 4, y, $fidl__kLE);
},
dec: function(d, o) {
var x = BigInt.asUintN(64, BigInt(d.data.getUint32(o, $fidl__kLE)));
var y = BigInt.asUintN(64, BigInt(d.data.getUint32(o + 4, $fidl__kLE)));
return x | (y << 32n);
},
};
const _kTT_Handle = {
enc: function(e, o, v) {
if (v === null || v === undefined) {
e.data.setUint32(o, 0, $fidl__kLE);
} else {
e.data.setUint32(o, $fidl__kHandlePresent, $fidl__kLE);
e.addHandle(v);
}
},
dec: function(d, o) {
var $present = d.data.getUint32(o, $fidl__kLE);
if ($present === 0) {
return 0;
} else {
if ($present !== $fidl__kHandlePresent)
throw "Expected UINT32_MAX to indicate handle presence";
return d.claimHandle();
}
},
};
const _kTT_String = {
enc: function(e, o, v) {
if (v === null || v === undefined) throw "non-null string required";
// Both size and data are uint64, but that's awkward in JS, so for now only
// support a maximum of 32b lengths. The maximum length of a FIDL message is
// shorter than 32b in any case.
var asUtf8 = $FidlJsStrToUtf8Array(v);
e.data.setUint32(o, asUtf8.length, $fidl__kLE);
e.data.setUint32(o + 4, 0, $fidl__kLE);
e.data.setUint32(o + 8, 0xffffffff, $fidl__kLE);
e.data.setUint32(o + 12, 0xffffffff, $fidl__kLE);
var body = e.alloc(asUtf8.length);
for (var i = 0; i < asUtf8.length; i++) {
e.data.setUint8(body + i, asUtf8[i], $fidl__kLE);
}
},
dec: function(d, o) {
var len = d.data.getUint32(o, $fidl__kLE);
var pointer = d.data.getUint32(o + 8, $fidl__kLE);
if (pointer === 0) throw "non-null string required";
var dataOffset = d.claimMemory(len);
return $FidlJsUtf8ArrayToStr(new DataView(d.data.buffer, dataOffset, len));
}
};
const _kTT_String_Nullable = {
enc: function(e, o, v) {
if (v === null || v === undefined) {
e.data.setUint32(o, 0, $fidl__kLE);
e.data.setUint32(o + 4, 0, $fidl__kLE);
e.data.setUint32(o + 8, 0, $fidl__kLE);
e.data.setUint32(o + 12, 0, $fidl__kLE);
} else {
_kTT_String.enc(e, o, v);
}
},
dec: function(d, o) {
if (v === null || v === undefined) {
var pointer = d.data.getUint32(o + 8, $fidl__kLE);
if (pointer === 0) {
return null;
}
} else {
return _kTT_String.dec(e, o, v);
}
}
};
This diff is collapsed.
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BUILD_FUCHSIA_FIDLGEN_JS_RUNTIME_ZIRCON_H_
#define BUILD_FUCHSIA_FIDLGEN_JS_RUNTIME_ZIRCON_H_
#include <memory>
#include "base/containers/flat_set.h"
#include "base/containers/unique_ptr_adapters.h"
#include "base/macros.h"
#include "v8/include/v8.h"
namespace fidljs {
class WaitPromiseImpl;
// A WaitSet is associated with each Isolate and represents all outstanding
// waits that are queued on the dispatcher.
//
// If the wait completes normally, the contained promise is resolved, the
// WaitPromiseImpl is marked as completed, and then deleted (by removing it from
// the pending set).
//
// If the caller shuts down with outstanding waits pending, the asynchronous
// waits are canceled by clearing the set (which deletes all the
// WaitPromiseImpls). If a WaitPromiseImpl has not completed when it is
// destroyed, it cancels the outstanding wait in its destructor.
//
// WaitPromiseImpl is responsible for resolving or rejecting promises. If the
// object was created, but a wait never started it will not have been added to
// the wait set, and so will reject the promise immediately. Otherwise, the
// promise will be resolved or rejected when the asynchronous wait is signaled
// or canceled.
using WaitSet =
base::flat_set<std::unique_ptr<WaitPromiseImpl>, base::UniquePtrComparator>;
class ZxBindings {
public:
// Adds Zircon APIs bindings to |global|, for use by JavaScript callers.
ZxBindings(v8::Isolate* isolate, v8::Local<v8::Object> global);
// Cleans up attached storage in the isolate added by the bindings, and
// cancels any pending asynchronous requests. It is important this this be
// done before the v8 context is torn down.
~ZxBindings();
private:
v8::Isolate* const isolate_;
std::unique_ptr<WaitSet> wait_set_;
DISALLOW_COPY_AND_ASSIGN(ZxBindings);
};
} // namespace fidljs
#endif // BUILD_FUCHSIA_FIDLGEN_JS_RUNTIME_ZIRCON_H_
This diff is collapsed.
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fidljstest;
enum Blorp : int8 {
ALPHA = 1;
BETA = 2;
GAMMA = 0x48;
};
// A struct of basic types, some with defaults and some without to test various
// paths of the generator.
struct BasicStruct {
bool b;
int8 i8;
int16 i16 = 18;
int32 i32;
uint8 u8;
uint16 u16;
uint32 u32 = 4000000000;
};
const uint64 ARRRR_SIZE = 32;
struct StuffAndThings {
int32 count;
string id;
vector<int32> a_vector;
BasicStruct basic;
string later_string;
array<int32>:ARRRR_SIZE arrrr;
vector<string>? nullable_vector_of_string0;
vector<string>? nullable_vector_of_string1;
vector<Blorp> vector_of_blorp;
};
struct StructWithBool {
bool some_bool = false;
};
struct StructWithUint {
uint32 num;
};
struct LargerStructWithArray {
array<int32>:32 components;
};
union UnionOfStructs {
1: StructWithBool swb;
2: StructWithUint swu;
3: LargerStructWithArray lswa;
};
struct StructOfMultipleUnions {
UnionOfStructs initial;
UnionOfStructs? optional;
UnionOfStructs trailing;
};
const int64 NO_TIMESTAMP = 0x7fffffffffffffff;
const int64 ANOTHER_COPY = NO_TIMESTAMP;
const string SOME_STRING = "a 你好 thing\" containing ' quotes";
struct VariousDefaults {
Blorp blorp_defaulting_to_beta = Blorp.BETA;
int64 int64_defaulting_to_no_timestamp = NO_TIMESTAMP;
int64 int64_defaulting_to_const = 0x7fffffffffffff11;
string string_with_default = "stuff";
};
struct VectorsOfPrimitives {
vector<bool> v_bool;
vector<uint8> v_uint8;
vector<uint16> v_uint16;
vector<uint32> v_uint32;
vector<uint64> v_uint64;
vector<int8> v_int8;
vector<int16> v_int16;
vector<int32> v_int32;
vector<int64> v_int64;
vector<float32> v_float32;
vector<float64> v_float64;
};
struct VectorOfHandleToVMO {
vector<handle<vmo>> vmos;
};
// This is a compile-only test for gen.py to ensure that the size of
// AfterPreviousReference is available before the vector<AfterPreviousReference>
// is compiled in this struct.
struct LaterReference {
vector<AfterPreviousReference>? later;
};
struct AfterPreviousReference {
int32 an_int;
};
protocol AnotherInterface {
TimesTwo(int32 a) -> (int32 b);
};
protocol Testola {
DoSomething();
PrintInt(int32 num);
PrintMsg(string msg);
VariousArgs(Blorp blorp, string:32 msg, vector<uint32> stuff);
WithResponse(int32 a, int32 b) -> (int32 sum);
SendAStruct(BasicStruct basic);
NestedStructsWithResponse(BasicStruct basic) -> (StuffAndThings resp);
PassHandles(handle<job> job) -> (handle<process> process);
ReceiveUnions(StructOfMultipleUnions somu);
SendUnions() -> (StructOfMultipleUnions somu);
SendVectorsOfString(vector<string> unsized,
vector<string?> nullable,
vector<string:10> max_strlen);
VectorOfStruct(vector<StructWithUint> stuff)
-> (vector<StructWithUint> result);
PassVectorOfPrimitives(VectorsOfPrimitives input)
-> (VectorsOfPrimitives output);
PassVectorOfVMO(VectorOfHandleToVMO input)
-> (VectorOfHandleToVMO output);
GetAnother(request<AnotherInterface> another);
};
Copyright (c) 2013, Ethan Furman.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
Neither the name Ethan Furman nor the names of any
contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Name: enum34
Short Name: enum34
URL: https://bitbucket.org/stoneleaf/enum34
License: BSD
License File: LICENSE
Revision: f24487b
Security Critical: no
Description:
'Enum' backported from Python 3.4 to earlier Python versions. Only LICENSE and
__init__.py are taken, other packaging files, documentation, etc. removed.
Only used at build time.
...@@ -793,12 +793,6 @@ ...@@ -793,12 +793,6 @@
"label": "//extensions:extensions_unittests", "label": "//extensions:extensions_unittests",
"type": "windowed_test_launcher", "type": "windowed_test_launcher",
}, },
# TODO(https://bugs.fuchsia.dev/44191): Fix the build and re-instate this
# target.
#"fidlgen_js_unittests": {
# "label": "//build/fuchsia/fidlgen_js:fidlgen_js_unittests",
# "type": "console_test_launcher",
#},
"filesystem_service_unittests": { "filesystem_service_unittests": {
"label": "//components/services/filesystem:filesystem_service_unittests", "label": "//components/services/filesystem:filesystem_service_unittests",
"type": "console_test_launcher", "type": "console_test_launcher",
......
...@@ -1248,9 +1248,6 @@ ...@@ -1248,9 +1248,6 @@
'cronet_tests': {}, 'cronet_tests': {},
'cronet_unittests': {}, 'cronet_unittests': {},
'crypto_unittests': {}, 'crypto_unittests': {},
# TODO(https://bugs.fuchsia.dev/44191): Fix the build and re-instate this
# target.
#'fidlgen_js_unittests': {},
'gfx_unittests': {}, 'gfx_unittests': {},
'gpu_unittests': {}, 'gpu_unittests': {},
'http_service_tests': {}, 'http_service_tests': {},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment