Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web workers #1993

Merged
merged 27 commits into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6481082
Web workers pass 1
afinch7 Mar 23, 2019
368bbfd
Make linter happy
afinch7 Mar 23, 2019
d28a44d
fmt
afinch7 Mar 23, 2019
84e56d8
Refactored the way worker polling is scheduled and errors are handled.
afinch7 Mar 25, 2019
df12a00
Some cleanup and handle worker close on host end.
afinch7 Mar 26, 2019
99f6db1
Merge branch 'master' into web_workers
afinch7 Mar 26, 2019
a1b048c
Share the worker future as a Shared
afinch7 Mar 26, 2019
4f52d6b
Merge branch 'web_workers' of https://github.com/afinch7/deno into we…
afinch7 Mar 26, 2019
8d30513
Fixed some merge issues and added a worker test
afinch7 Mar 26, 2019
ec2149b
compile_sync returns errors now
afinch7 Mar 27, 2019
2103d32
Refactored compile_sync again
afinch7 Mar 27, 2019
1a6be92
fixed bugs and moved compiler error exit back to compile_sync
afinch7 Mar 27, 2019
4eb80ab
lots of comments for compile_sync
afinch7 Mar 28, 2019
1e2c184
refactored compile_sync again to use a future that is less blocking.
afinch7 Mar 28, 2019
cfd3289
Merge branch 'master' into web_workers
afinch7 Mar 28, 2019
e245db1
enable debug to find this problem
afinch7 Mar 28, 2019
58de310
remove old comments
afinch7 Mar 28, 2019
e6a3bab
maybe same tokio runtime for all compiler tasks?
afinch7 Mar 28, 2019
fa72bc9
remove debug from tests
afinch7 Mar 28, 2019
32d7ad4
worker ts lib
afinch7 Mar 30, 2019
a9c8271
requested change: workers test assert
afinch7 Mar 31, 2019
5b101a8
renamed WebWorkerBehavior to UserWorkerBehaivor and moved to workers.rs
afinch7 Mar 31, 2019
8388fa2
Merge remote-tracking branch 'upstream/master' into web_workers
afinch7 Mar 31, 2019
53fcd75
fixed remaining merge issues
afinch7 Mar 31, 2019
6e173b8
remove thread spawn from worker tests
afinch7 Mar 31, 2019
5815927
removed worker specific snapshot/bundle
afinch7 Apr 1, 2019
b0881d4
forgot to remove the startup data function
afinch7 Apr 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master' into web_workers
  • Loading branch information
afinch7 committed Mar 31, 2019
commit 8388fa24161915d1e4dc254659c7cb9873e8242b
331 changes: 1 addition & 330 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,176 +7,7 @@ group("default") {
"cli:deno",
"cli:test_rs",
"core:default",
"libdeno:test_cc",
]
}

main_extern = [
"core:deno_core",

"$rust_build:ansi_term",
"$rust_build:atty",
"$rust_build:dirs",
"$rust_build:flatbuffers",
"$rust_build:futures",
"$rust_build:getopts",
"$rust_build:http",
"$rust_build:hyper",
"$rust_build:hyper_rustls",
"$rust_build:lazy_static",
"$rust_build:libc",
"$rust_build:log",
"$rust_build:rand",
"$rust_build:regex",
"$rust_build:remove_dir_all",
"$rust_build:ring",
"$rust_build:rustyline",
"$rust_build:serde_json",
"$rust_build:source_map_mappings",
"$rust_build:tempfile",
"$rust_build:tokio",
"$rust_build:tokio_executor",
"$rust_build:tokio_fs",
"$rust_build:tokio_io",
"$rust_build:tokio_process",
"$rust_build:tokio_threadpool",
"$rust_build:url",
]
if (is_win) {
main_extern += [ "$rust_build:winapi" ]
}

ts_sources = [
"js/assets.ts",
"js/blob.ts",
"js/buffer.ts",
"js/build.ts",
"js/chmod.ts",
"js/console_table.ts",
"js/compiler.ts",
"js/console.ts",
"js/copy_file.ts",
"js/core.ts",
"js/custom_event.ts",
"js/deno.ts",
"js/dir.ts",
"js/dispatch.ts",
"js/dom_types.ts",
"js/errors.ts",
"js/event.ts",
"js/event_target.ts",
"js/fetch.ts",
"js/format_error.ts",
"js/dom_file.ts",
"js/file_info.ts",
"js/files.ts",
"js/flatbuffers.ts",
"js/form_data.ts",
"js/globals.ts",
"js/headers.ts",
"js/io.ts",
"js/lib.web_assembly.d.ts",
"js/location.ts",
"js/main.ts",
"js/make_temp_dir.ts",
"js/metrics.ts",
"js/mkdir.ts",
"js/mock_builtin.js",
"js/net.ts",
"js/os.ts",
"js/permissions.ts",
"js/plugins.d.ts",
"js/process.ts",
"js/read_dir.ts",
"js/read_file.ts",
"js/read_link.ts",
"js/remove.ts",
"js/rename.ts",
"js/repl.ts",
"js/resources.ts",
"js/stat.ts",
"js/symlink.ts",
"js/text_encoding.ts",
"js/timers.ts",
"js/truncate.ts",
"js/types.ts",
"js/url.ts",
"js/url_search_params.ts",
"js/util.ts",
"js/window.ts",
"js/workers_globals.ts",
"js/workers_guest.ts",
"js/workers_init.ts",
"js/workers.ts",
"js/write_file.ts",
"js/performance.ts",
"js/version.ts",
"tsconfig.json",

# Listing package.json and yarn.lock as sources ensures the bundle is rebuilt
# when npm packages are added/removed or their contents changes.
"package.json",
"third_party/yarn.lock",
]

# When Cargo is driving the build, GN/Ninja are used to produce these non-Rust
# targets. Cargo handles all Rust source files and the final linking step.
group("deno_deps") {
deps = [
":msg_rs",
":snapshot_compiler",
":snapshot_deno",
":snapshot_worker",
"libdeno:libdeno_static_lib",
]
}

# Optimized dependencies for cross compiled builds.
# This can be removed once we get snapshots into cross compiled builds.
group("deno_deps_cross") {
testonly = true
deps = [
":compiler_bundle",
":main_bundle",
":msg_rs",
":worker_bundle",
"libdeno:libdeno_static_lib",
"libdeno:test_cc",
]
}

# Reads the cargo info from Cargo.toml
deno_cargo_info = exec_script("build_extra/rust/get_cargo_info.py",
[ rebase_path("Cargo.toml", root_build_dir) ],
"json")

rust_executable("deno") {
source_root = "cli/main.rs"
extern = main_extern
deps = [
":deno_deps",
]

# Extract version from Cargo.toml
# TODO integrate this into rust.gni by allowing the rust_executable template
# to specify a cargo.toml from which it will extract a version.
crate_version = deno_cargo_info.version
inputs = [
"Cargo.toml",
]
}

rust_test("test_rs") {
source_root = "cli/main.rs"
extern = main_extern
deps = [
":deno_deps",
]

# Extract version from Cargo.toml
crate_version = deno_cargo_info.version
inputs = [
"Cargo.toml",
"core/libdeno:test_cc",
]
}

Expand All @@ -187,163 +18,3 @@ rust_executable("hyper_hello") {
"$rust_build:ring",
]
}

# Generates the core TypeScript type library for deno that will be
# included in the runtime bundle
run_node("deno_runtime_declaration") {
out_dir = target_gen_dir
sources = ts_sources
outputs = [
"$out_dir/lib/lib.deno_runtime.d.ts",
]
deps = [
":msg_ts",
]
inputs = ts_sources + [
"tools/ts_library_builder/tsconfig.json",
"tools/ts_library_builder/main.ts",
"tools/ts_library_builder/build_library.ts",
"tools/ts_library_builder/ast_util.ts",
]
args = [
rebase_path("node_modules/ts-node/dist/bin.js", root_build_dir),
"--project",
rebase_path("tools/ts_library_builder/tsconfig.json"),
"--skip-ignore",
rebase_path("tools/ts_library_builder/main.ts", root_build_dir),
"--basePath",
rebase_path(".", root_build_dir),
"--inline",
rebase_path("js/lib.web_assembly.d.ts", root_build_dir),
"--buildPath",
rebase_path(root_build_dir, root_build_dir),
"--outFile",
rebase_path(outputs[0], root_build_dir),
"--silent",
]
if (is_debug) {
args += [ "--debug" ]
}
}

# Generates the worker TypeScript type library for deno that will be
# included in the worker runtime bundle
run_node("deno_worker_runtime_declaration") {
out_dir = target_gen_dir
sources = ts_sources
outputs = [
"$out_dir/lib/lib.deno_worker_runtime.d.ts",
]
deps = [
":msg_ts",
]
inputs = ts_sources + [
"tools/ts_library_builder/tsconfig.json",
"tools/ts_library_builder/main.ts",
"tools/ts_library_builder/build_library.ts",
"tools/ts_library_builder/ast_util.ts",
]
args = [
rebase_path("node_modules/ts-node/dist/bin.js", root_build_dir),
"--project",
rebase_path("tools/ts_library_builder/tsconfig.json"),
"--skip-ignore",
rebase_path("tools/ts_library_builder/main.ts", root_build_dir),
"--basePath",
rebase_path(".", root_build_dir),
"--inline",
rebase_path("js/lib.web_assembly.d.ts", root_build_dir),
"--buildPath",
rebase_path(root_build_dir, root_build_dir),
"--outFile",
rebase_path(outputs[0], root_build_dir),
"--silent",
"--worker",
]
if (is_debug) {
args += [ "--debug" ]
}
}

bundle("main_bundle") {
out_dir = "$target_gen_dir/bundle/"
out_name = "main"
deps = [
":deno_runtime_declaration",
":msg_ts",
":write_gn_args",
]
data = [
"$target_gen_dir/gn_args.txt",
]
}

bundle("worker_bundle") {
out_dir = "$target_gen_dir/bundle/"
out_name = "workers_init"
deps = [
":deno_runtime_declaration",
":msg_ts",
":write_gn_args",
]
data = [
"$target_gen_dir/gn_args.txt",
]
}

bundle("compiler_bundle") {
out_dir = "$target_gen_dir/bundle/"
out_name = "compiler"
deps = [
":deno_runtime_declaration",
":deno_worker_runtime_declaration",
":msg_ts",
":write_gn_args",
]
data = [
"$target_gen_dir/gn_args.txt",
]
}

ts_flatbuffer("msg_ts") {
sources = [
"cli/msg.fbs",
]
}

rust_flatbuffer("msg_rs") {
sources = [
"cli/msg.fbs",
]
}

# Generates $target_gen_dir/snapshot_deno.bin
snapshot("snapshot_deno") {
source_root = "$target_gen_dir/bundle/main.js"
deps = [
":main_bundle",
]
}

snapshot("snapshot_worker") {
source_root = "$target_gen_dir/bundle/workers_init.js"
deps = [
":worker_bundle",
]
}

# Generates $target_gen_dir/snapshot_compiler.bin
snapshot("snapshot_compiler") {
source_root = "$target_gen_dir/bundle/compiler.js"
deps = [
":compiler_bundle",
]
}

action("write_gn_args") {
script = "//tools/write_gn_args.py"
outputs = [
"$target_gen_dir/gn_args.txt",
]
args = [ rebase_path(outputs[0], root_build_dir) ]
}
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.