提交 03e39488 编写于 作者: A Adam Barth

Remove Path.idl

This patch removes the last IDL file from the build and unhooks the bulk
of the IDL compiler from the build system. A later patch will actually
delete the IDL compiler.
上级 b714feca
......@@ -40,7 +40,6 @@ source_set("bindings") {
"//sky/engine/platform:platform",
"//sky/engine/tonic",
"//sky/engine/wtf",
":generated_bindings",
]
# On iOS (device), precompiled snapshots contain the instruction buffer.
......@@ -147,188 +146,6 @@ source_set("snapshot_cc") {
]
}
action("compute_interfaces_info_individual") {
sources = core_idl_files
script = "$bindings_scripts_dir/compute_interfaces_info_individual.py"
output_file = "$bindings_output_dir/InterfacesInfoIndividual.pickle"
# TODO(eseidel): This is no longer needed, could pass these as args.
file_list = "$target_gen_dir/${target_name}_file_list.txt"
write_file(file_list, rebase_path(sources, root_build_dir))
# TODO(eseidel): Use depfile instead of this manual list.
inputs = [ "$bindings_scripts_dir/utilities.py" ] + sources
outputs = [
file_list,
output_file,
]
args = [
# TODO(eseidel): Remove component-dir, it is meaningless in sky.
"--component-dir",
"ignored",
"--idl-files-list",
rebase_path(file_list, root_build_dir),
"--interfaces-info-file",
rebase_path(output_file, root_build_dir),
# TODO(eseidel): only-if-changed is always true, remove
"--write-file-only-if-changed=1",
]
}
interfaces_info_individual_path =
"$bindings_output_dir/InterfacesInfoIndividual.pickle"
interfaces_info_overall_path =
"$bindings_output_dir/InterfacesInfoOverall.pickle"
action("compute_interfaces_info_overall") {
script = "$bindings_scripts_dir/compute_interfaces_info_overall.py"
inputs = [
interfaces_info_individual_path,
]
outputs = [
interfaces_info_overall_path,
]
args = [
# TODO(eseidel): only-if-changed is always true, remove
"--write-file-only-if-changed=1",
"--",
]
args += rebase_path(inputs, root_build_dir)
args += rebase_path(outputs, root_build_dir)
deps = [
":compute_interfaces_info_individual",
]
}
# This separate pre-caching step is required to use lex/parse table
# caching in PLY, since PLY itself does not check if the cache is
# valid, and thus may end up using a stale cache if this step hasn"t
# been run to update it.
#
# This action"s dependencies *is* the cache validation.
#
# GYP version: scripts.gyp:cached_lex_yacc_tables
action("cached_lex_yacc_tables") {
script = "scripts/blink_idl_parser.py"
inputs = idl_lexer_parser_files
outputs = [
"$bindings_output_dir/lextab.py",
"$bindings_output_dir/parsetab.pickle",
]
args = [ rebase_path(bindings_output_dir, root_build_dir) ]
}
# Runs the idl_compiler script over a list of sources.
#
# Parameters:
# sources = list of IDL files to compile
# output_dir = string containing the directory to put the output files.
template("idl_compiler") {
output_dir = invoker.output_dir
action_foreach(target_name) {
# TODO(brettw) GYP adds a "-S before the script name to skip "import site" to
# speed up startup. Figure out if we need this and do something similar (not
# really expressible in GN now).
script = "$bindings_scripts_dir/compiler.py"
inputs = idl_lexer_parser_files + idl_compiler_files
inputs += [
"scripts/templates/attributes_cpp.template",
"scripts/templates/callback_interface_cpp.template",
"scripts/templates/callback_interface_dart.template",
"scripts/templates/callback_interface_h.template",
"scripts/templates/interface_base_cpp.template",
"scripts/templates/interface_cpp.template",
"scripts/templates/interface_dart.template",
"scripts/templates/interface_h.template",
"scripts/templates/methods_cpp.template",
]
inputs += [
"$bindings_output_dir/lextab.py",
"$bindings_output_dir/parsetab.pickle",
# "$bindings_output_dir/cached_jinja_templates.stamp",
"//sky/engine/bindings/IDLExtendedAttributes.txt",
# If the dependency structure or public interface info (e.g.,
# [ImplementedAs]) changes, we rebuild all files, since we"re not
# computing dependencies file-by-file in the build.
# This data is generally stable.
interfaces_info_overall_path,
]
sources = invoker.sources
outputs = [
"$output_dir/Dart{{source_name_part}}.cpp",
"$output_dir/Dart{{source_name_part}}.h",
"$output_dir/{{source_name_part}}.dart",
]
args = [
"--output-dir",
rebase_path(output_dir, root_build_dir),
"--interfaces-info",
rebase_path(interfaces_info_overall_path, root_build_dir),
"--write-file-only-if-changed=1", # Always true for Ninja.
"{{source}}",
]
deps = [
":compute_interfaces_info_overall",
":cached_lex_yacc_tables",
# ":cached_jinja_templates",
]
}
}
idl_compiler("compile_idls") {
sources = core_idl_files
output_dir = bindings_output_dir
}
action("generate_dart_globals") {
sources = core_idl_files
script = "$bindings_scripts_dir/compiler.py"
file_list = "$target_gen_dir/${target_name}_file_list.txt"
write_file(file_list, rebase_path(sources, root_build_dir))
inputs = sources + idl_compiler_files
inputs += [
"scripts/templates/global_cpp.template",
"scripts/templates/global_h.template",
]
outputs = [
file_list,
"$bindings_output_dir/DartGlobal.h",
"$bindings_output_dir/DartGlobal.cpp",
]
args = [
"--output-directory",
rebase_path(bindings_output_dir, root_build_dir),
"--generate-globals",
rebase_path(bindings_output_dir, root_build_dir),
rebase_path(file_list, root_build_dir),
]
deps = [
":compile_idls",
]
}
copy("copy_core_dart_files") {
sources = core_dart_files
outputs = [
......@@ -337,14 +154,13 @@ copy("copy_core_dart_files") {
}
action("generate_dart_ui") {
sources = core_idl_files + core_dart_files
sources = core_dart_files
script = "$bindings_scripts_dir/compiler.py"
file_list = "$target_gen_dir/${target_name}_file_list.txt"
write_file(file_list, rebase_path(sources, root_build_dir))
inputs =
sources + idl_compiler_files + [ "scripts/templates/dart_blink.template" ]
inputs = sources + [ "scripts/templates/dart_blink.template" ]
outputs = [
file_list,
......@@ -361,36 +177,5 @@ action("generate_dart_ui") {
deps = [
":copy_core_dart_files",
":compile_idls",
]
}
source_set("generated_bindings") {
deps = [
"//base",
"//dart/runtime:libdart",
"//dart/runtime/vm:libdart_platform",
"//mojo/application",
"//mojo/public/c/system",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/system",
"//mojo/public/cpp/utility",
"//mojo/public/interfaces/application",
"//skia",
"//sky/engine/wtf",
"//third_party/iccjpeg",
"//third_party/libpng",
"//third_party/qcms",
"//third_party/zlib",
":compile_idls",
":generate_dart_globals",
]
include_dirs = [
"..",
"$root_build_dir",
]
sources = get_target_outputs(":compile_idls")
sources += get_target_outputs(":generate_dart_globals")
}
......@@ -7,50 +7,6 @@ import("//mojo/dart/packages/mojo/sdk_ext_sources.gni")
bindings_scripts_dir = "//sky/engine/bindings/scripts"
bindings_output_dir = "$root_gen_dir/sky/bindings"
idl_lexer_parser_files = [
# PLY (Python Lex-Yacc)
"//third_party/ply/lex.py",
"//third_party/ply/yacc.py",
# Web IDL lexer/parser (base parser)
"//tools/idl_parser/idl_lexer.py",
"//tools/idl_parser/idl_node.py",
"//tools/idl_parser/idl_parser.py",
# Blink IDL lexer/parser/constructor
"scripts/blink_idl_lexer.py",
"scripts/blink_idl_parser.py",
]
idl_compiler_files = [
"scripts/compiler.py",
# Blink IDL front end (ex-lexer/parser)
"scripts/idl_definitions.py",
"scripts/idl_reader.py",
"scripts/idl_types.py",
"scripts/idl_validator.py",
"scripts/interface_dependency_resolver.py",
# Dart Code gen goes here.
"scripts/dart_attributes.py",
"scripts/dart_callback_interface.py",
"scripts/dart_compiler.py",
"scripts/dart_interface.py",
"scripts/dart_methods.py",
"scripts/dart_types.py",
"scripts/dart_utilities.py",
"scripts/code_generator_dart.py",
# The dart files depend on the v8 files. :(
"scripts/v8_attributes.py",
"scripts/v8_globals.py",
"scripts/v8_interface.py",
"scripts/v8_methods.py",
"scripts/v8_types.py",
"scripts/v8_utilities.py",
]
dart_host_toolchain = host_toolchain
if (target_os == "ios" && !use_ios_simulator) {
# During precompilation, a 64 bit Dart VM cannot generate code for a 32 bit
......
......@@ -4,13 +4,13 @@
#include "sky/engine/bindings/dart_ui.h"
#include "gen/sky/bindings/DartGlobal.h"
#include "sky/engine/bindings/dart_runtime_hooks.h"
#include "sky/engine/core/compositing/Scene.h"
#include "sky/engine/core/compositing/SceneBuilder.h"
#include "sky/engine/core/painting/Canvas.h"
#include "sky/engine/core/painting/CanvasGradient.h"
#include "sky/engine/core/painting/CanvasImage.h"
#include "sky/engine/core/painting/CanvasPath.h"
#include "sky/engine/core/painting/ColorFilter.h"
#include "sky/engine/core/painting/DrawLooperLayerInfo.h"
#include "sky/engine/core/painting/ImageShader.h"
......@@ -33,17 +33,11 @@ static DartLibraryNatives* g_natives;
Dart_NativeFunction GetNativeFunction(Dart_Handle name,
int argument_count,
bool* auto_setup_scope) {
if (auto result = g_natives->GetNativeFunction(name,
argument_count,
auto_setup_scope))
return result;
return skySnapshotResolver(name, argument_count, auto_setup_scope);
return g_natives->GetNativeFunction(name, argument_count, auto_setup_scope);
}
const uint8_t* GetSymbol(Dart_NativeFunction native_function) {
if (auto result = g_natives->GetSymbol(native_function))
return result;
return skySnapshotSymbolizer(native_function);
return g_natives->GetSymbol(native_function);
}
} // namespace
......@@ -54,6 +48,7 @@ void DartUI::InitForIsolate() {
Canvas::RegisterNatives(g_natives);
CanvasGradient::RegisterNatives(g_natives);
CanvasImage::RegisterNatives(g_natives);
CanvasPath::RegisterNatives(g_natives);
ColorFilter::RegisterNatives(g_natives);
DartRuntimeHooks::RegisterNatives(g_natives);
DrawLooperLayerInfo::RegisterNatives(g_natives);
......
......@@ -232,11 +232,6 @@ sky_core_files = [
"window/window.h",
]
core_idl_files = get_path_info([
"painting/Path.idl",
],
"abspath")
core_dart_files = get_path_info([
"dart/compositing.dart",
"dart/hash_codes.dart",
......
......@@ -19,6 +19,30 @@ void decodeImageFromDataPipe(int handle, _ImageDecoderCallback callback)
void decodeImageFromList(Uint8List list, _ImageDecoderCallback callback)
native "decodeImageFromList";
class Path extends NativeFieldWrapperClass2 {
void _constructor() native "Path_constructor";
Path() { _constructor(); }
void moveTo(double x, double y) native "Path_moveTo";
void relativeMoveTo(double dx, double dy) native "Path_relativeMoveTo";
void lineTo(double x, double y) native "Path_lineTo";
void relativeLineTo(double dx, double dy) native "Path_relativeLineTo";
void quadraticBezierTo(double x1, double y1, double x2, double y2) native "Path_quadraticBezierTo";
void relativeQuadraticBezierTo(double x1, double y1, double x2, double y2) native "Path_relativeQuadraticBezierTo";
void cubicTo(double x1, double y1, double x2, double y2, double x3, double y3) native "Path_cubicTo";
void relativeCubicTo(double x1, double y1, double x2, double y2, double x3, double y3) native "Path_relativeCubicTo";
void conicTo(double x1, double y1, double x2, double y2, double w) native "Path_conicTo";
void relativeConicTo(double x1, double y1, double x2, double y2, double w) native "Path_relativeConicTo";
void arcTo(Rect rect, double startAngle, double sweepAngle, bool forceMoveTo) native "Path_arcTo";
void addRect(Rect rect) native "Path_addRect";
void addOval(Rect oval) native "Path_addOval";
void addArc(Rect oval, double startAngle, double sweepAngle) native "Path_addArc";
void addRRect(RRect rrect) native "Path_addRRect";
void close() native "Path_close";
void reset() native "Path_reset";
Path shift(Offset offset) native "Path_shift";
}
abstract class DrawLooper extends NativeFieldWrapperClass2 {
}
......
......@@ -4,8 +4,50 @@
#include "sky/engine/core/painting/CanvasPath.h"
#include "sky/engine/tonic/dart_args.h"
#include "sky/engine/tonic/dart_binding_macros.h"
#include "sky/engine/tonic/dart_converter.h"
#include "sky/engine/tonic/dart_library_natives.h"
namespace blink {
typedef CanvasPath Path;
static void Path_constructor(Dart_NativeArguments args) {
DartCallConstructor(&CanvasPath::create, args);
}
IMPLEMENT_WRAPPERTYPEINFO(Path);
#define FOR_EACH_BINDING(V) \
V(Path, moveTo) \
V(Path, relativeMoveTo) \
V(Path, lineTo) \
V(Path, relativeLineTo) \
V(Path, quadraticBezierTo) \
V(Path, relativeQuadraticBezierTo) \
V(Path, cubicTo) \
V(Path, relativeCubicTo) \
V(Path, conicTo) \
V(Path, relativeConicTo) \
V(Path, arcTo) \
V(Path, addRect) \
V(Path, addOval) \
V(Path, addArc) \
V(Path, addRRect) \
V(Path, close) \
V(Path, reset) \
V(Path, shift)
FOR_EACH_BINDING(DART_NATIVE_CALLBACK)
void CanvasPath::RegisterNatives(DartLibraryNatives* natives) {
natives->Register({
{ "Path_constructor", Path_constructor, 1, true },
FOR_EACH_BINDING(DART_REGISTER_NATIVE)
});
}
CanvasPath::CanvasPath()
{
}
......
......@@ -20,6 +20,7 @@
// (The existence of that class is why this is CanvasPath and not just Path.)
namespace blink {
class DartLibraryNatives;
class CanvasPath : public RefCounted<CanvasPath>, public DartWrappable {
DEFINE_WRAPPERTYPEINFO();
......@@ -64,6 +65,8 @@ public:
PassRefPtr<CanvasPath> shift(const Offset& offset);
static void RegisterNatives(DartLibraryNatives* natives);
private:
CanvasPath();
......
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "sky/engine/core/painting/DrawLooperLayerInfo.h"
#include "sky/engine/tonic/dart_args.h"
#include "sky/engine/tonic/dart_binding_macros.h"
#include "sky/engine/tonic/dart_converter.h"
......
// Copyright 2015 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.
[
Constructor(),
ImplementedAs=CanvasPath,
] interface Path {
void moveTo(float x, float y);
void relativeMoveTo(float dx, float dy);
void lineTo(float x, float y);
void relativeLineTo(float dx, float dy);
void quadraticBezierTo(float x1, float y1, float x2, float y2);
void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
void cubicTo(float x1, float y1, float x2, float y2, float x3, float y3);
void relativeCubicTo(float x1, float y1, float x2, float y2, float x3, float y3);
void conicTo(float x1, float y1, float x2, float y2, float w);
void relativeConicTo(float x1, float y1, float x2, float y2, float w);
void arcTo(Rect rect, float startAngle, float sweepAngle, boolean forceMoveTo); // angles in radians
void addRect(Rect rect);
void addOval(Rect oval);
void addArc(Rect oval, float startAngle, float sweepAngle); // angles in radians
void addRRect(RRect rrect);
void close();
void reset();
Path shift(Offset offset);
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册