-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new package: carbonyl-host-tools (#23073)
- Loading branch information
Showing
89 changed files
with
17,046 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
angle-android | ||
bionic-host | ||
carbonyl-host-tools | ||
clvk | ||
dart | ||
dotnet8.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
x11-packages/carbonyl-host-tools/0001-override-build-target.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- a/src/browser/BUILD.gn | ||
+++ b/src/browser/BUILD.gn | ||
@@ -40,7 +40,7 @@ | ||
if (is_mac) { | ||
target += "apple-darwin" | ||
} else if (is_linux) { | ||
- target += "unknown-linux-gnu" | ||
+ target += "linux-android" | ||
} | ||
|
||
libs = ["carbonyl"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- a/chromium/src/carbonyl/src/browser/renderer.cc | ||
+++ b/chromium/src/carbonyl/src/browser/renderer.cc | ||
@@ -1,5 +1,6 @@ | ||
#include "carbonyl/src/browser/renderer.h" | ||
|
||
+#include <vector> | ||
#include <memory> | ||
#include <iostream> | ||
#include <stdio.h> |
11 changes: 11 additions & 0 deletions
11
x11-packages/carbonyl-host-tools/0003-properly-include-base-callback.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- a/src/browser/host_display_client.h | ||
+++ b/src/browser/host_display_client.h | ||
@@ -3,7 +3,7 @@ | ||
|
||
#include <memory> | ||
|
||
-#include "base/callback.h" | ||
+#include "base/functional/callback.h" | ||
#include "base/memory/shared_memory_mapping.h" | ||
#include "carbonyl/src/browser/export.h" | ||
#include "components/viz/host/host_display_client.h" |
23 changes: 23 additions & 0 deletions
23
x11-packages/carbonyl-host-tools/0004-add-support-for-putty.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
From 62d5b2d96bd8890d82ee5150fc4d0db76e68106d Mon Sep 17 00:00:00 2001 | ||
From: Boyi C <fanthos@live.com> | ||
Date: Tue, 28 Mar 2023 12:23:33 +0800 | ||
Subject: [PATCH] Update tty.rs to support putty | ||
|
||
Add mode 1002 to tts, to make mouse works in Putty. | ||
--- | ||
src/input/tty.rs | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/src/input/tty.rs b/src/input/tty.rs | ||
index 5cf491b..38dd3f6 100644 | ||
--- a/src/input/tty.rs | ||
+++ b/src/input/tty.rs | ||
@@ -65,7 +65,7 @@ enum TTY { | ||
File(File), | ||
} | ||
|
||
-const SEQUENCES: [(u32, bool); 4] = [(1049, true), (1003, true), (1006, true), (25, false)]; | ||
+const SEQUENCES: [(u32, bool); 5] = [(1049, true), (1002, true), (1003, true), (1006, true), (25, false)]; | ||
|
||
impl TTY { | ||
fn stdin() -> TTY { |
156 changes: 156 additions & 0 deletions
156
x11-packages/carbonyl-host-tools/0005-passing-args-from-c-main.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
|
||
--- a/src/browser/bridge.rs | ||
+++ b/src/browser/bridge.rs | ||
@@ -44,6 +44,11 @@ | ||
rect: CRect, | ||
color: CColor, | ||
} | ||
+#[repr(C)] | ||
+#[derive(Copy, Clone)] | ||
+pub struct InitArg { | ||
+ arg: *const c_char, | ||
+} | ||
|
||
#[repr(C)] | ||
pub struct RendererBridge { | ||
@@ -103,8 +108,8 @@ | ||
post_task: extern "C" fn(extern "C" fn(*mut c_void), *mut c_void), | ||
} | ||
|
||
-fn main() -> io::Result<Option<i32>> { | ||
- let cmd = match CommandLineProgram::parse_or_run() { | ||
+fn main(args: Vec<String>) -> io::Result<Option<i32>> { | ||
+ let cmd = match CommandLineProgram::parse_or_run(args) { | ||
None => return Ok(Some(0)), | ||
Some(cmd) => cmd, | ||
}; | ||
@@ -142,8 +147,22 @@ | ||
} | ||
|
||
#[no_mangle] | ||
-pub extern "C" fn carbonyl_bridge_main() { | ||
- if let Some(code) = main().unwrap() { | ||
+pub extern "C" fn carbonyl_bridge_main( | ||
+ args: *const InitArg, | ||
+ argc: size_t, | ||
+) { | ||
+ // Parse Vec<String> from params | ||
+ let args = unsafe { std::slice::from_raw_parts(args, argc) }; | ||
+ let args = args.iter() | ||
+ .skip(1) | ||
+ .map(|arg| { | ||
+ let str = unsafe { CStr::from_ptr(arg.arg) }; | ||
+ | ||
+ str.to_str().unwrap().to_owned() | ||
+ }) | ||
+ .collect::<Vec<String>>(); | ||
+ | ||
+ if let Some(code) = main(args).unwrap() { | ||
std::process::exit(code) | ||
} | ||
} | ||
--- a/src/cli/cli.rs | ||
+++ b/src/cli/cli.rs | ||
@@ -1,4 +1,5 @@ | ||
use std::{env, ffi::OsStr}; | ||
+use std::sync::OnceLock; | ||
|
||
use super::CommandLineProgram; | ||
|
||
@@ -35,7 +36,17 @@ | ||
} | ||
} | ||
|
||
+static INIT: OnceLock<Vec<String>> = OnceLock::new(); | ||
+ | ||
impl CommandLine { | ||
+ pub fn set_args(args: Vec<String>) { | ||
+ INIT.get_or_init(|| { args }); | ||
+ } | ||
+ | ||
+ pub fn get_args() -> Vec<String> { | ||
+ INIT.get_or_init(|| Vec::new()).to_vec() | ||
+ } | ||
+ | ||
pub fn parse() -> CommandLine { | ||
let mut fps = 60.0; | ||
let mut zoom = 1.0; | ||
@@ -43,7 +54,7 @@ | ||
let mut bitmap = false; | ||
let mut shell_mode = false; | ||
let mut program = CommandLineProgram::Main; | ||
- let args = env::args().skip(1).collect::<Vec<String>>(); | ||
+ let args = Self::get_args(); | ||
|
||
for arg in &args { | ||
let split: Vec<&str> = arg.split("=").collect(); | ||
--- a/src/cli/program.rs | ||
+++ b/src/cli/program.rs | ||
@@ -8,7 +8,8 @@ | ||
} | ||
|
||
impl CommandLineProgram { | ||
- pub fn parse_or_run() -> Option<CommandLine> { | ||
+ pub fn parse_or_run(args: Vec<String>) -> Option<CommandLine> { | ||
+ CommandLine::set_args(args); | ||
let cmd = CommandLine::parse(); | ||
|
||
match cmd.program { | ||
--- a/src/browser/renderer.h | ||
+++ b/src/browser/renderer.h | ||
@@ -47,7 +47,7 @@ | ||
|
||
class CARBONYL_RENDERER_EXPORT Renderer { | ||
public: | ||
- static void Main(); | ||
+ static void Main(int argc, const char** argv); | ||
static Renderer* GetCurrent(); | ||
|
||
gfx::Size GetSize(); | ||
--- a/src/browser/renderer.cc | ||
+++ b/src/browser/renderer.cc | ||
@@ -34,8 +34,14 @@ | ||
carbonyl_renderer_rect rect; | ||
carbonyl_renderer_color color; | ||
}; | ||
+struct carbonyl_init_arg { | ||
+ const char *arg; | ||
+}; | ||
|
||
-void carbonyl_bridge_main(); | ||
+void carbonyl_bridge_main( | ||
+ const struct carbonyl_init_arg* args, | ||
+ size_t argc | ||
+); | ||
bool carbonyl_bridge_bitmap_mode(); | ||
float carbonyl_bridge_get_dpi(); | ||
|
||
@@ -71,8 +77,15 @@ | ||
|
||
Renderer::Renderer(struct carbonyl_renderer* ptr): ptr_(ptr) {} | ||
|
||
-void Renderer::Main() { | ||
- carbonyl_bridge_main(); | ||
+void Renderer::Main(int argc, const char** argv) { | ||
+ if (argc < 0) { | ||
+ argc = 0; | ||
+ } | ||
+ struct carbonyl_init_arg args[argc]; | ||
+ for (int i = 0; i < argc; ++i) { | ||
+ args[i].arg = argv[i]; | ||
+ } | ||
+ carbonyl_bridge_main(args, (size_t) argc); | ||
|
||
Bridge::Configure( | ||
carbonyl_bridge_get_dpi(), | ||
--- a/chromium/src/headless/app/headless_shell_main.cc | ||
+++ b/chromium/src/headless/app/headless_shell_main.cc | ||
@@ -17,7 +17,7 @@ | ||
#include "carbonyl/src/browser/renderer.h" | ||
|
||
int main(int argc, const char** argv) { | ||
- carbonyl::Renderer::Main(); | ||
+ carbonyl::Renderer::Main(argc, argv); | ||
|
||
content::ContentMainParams params(nullptr); | ||
#if BUILDFLAG(IS_WIN) |
20 changes: 20 additions & 0 deletions
20
x11-packages/carbonyl-host-tools/9001-Add-Carbonyl-service.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- a/chromium/patches/chromium/0002-Add-Carbonyl-service.patch | ||
+++ b/chromium/patches/chromium/0002-Add-Carbonyl-service.patch | ||
@@ -590,7 +590,7 @@ | ||
+ base64.c_str(), | ||
+ PrimaryFont()-> | ||
+ PlatformData(). | ||
-+ CreateSkFont(false, &font_description_) | ||
++ CreateSkFont(&font_description_) | ||
+ ); | ||
+ | ||
+ if (node_id != cc::kInvalidNodeId) { | ||
@@ -622,7 +622,7 @@ | ||
+ base64.c_str(), | ||
+ PrimaryFont()-> | ||
+ PlatformData(). | ||
-+ CreateSkFont(false, &font_description_) | ||
++ CreateSkFont(&font_description_) | ||
+ ); | ||
+ | ||
+ if (node_id != cc::kInvalidNodeId) { |
34 changes: 34 additions & 0 deletions
34
x11-packages/carbonyl-host-tools/9002-Setup-browser-default-settings.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- a/chromium/patches/chromium/0004-Setup-browser-default-settings.patch | ||
+++ b/chromium/patches/chromium/0004-Setup-browser-default-settings.patch | ||
@@ -10,9 +10,9 @@ | ||
|
||
diff --git a/headless/public/headless_browser.cc b/headless/public/headless_browser.cc | ||
index b6c70ecb0fc23..c836a082d2e68 100644 | ||
---- a/headless/public/headless_browser.cc | ||
-+++ b/headless/public/headless_browser.cc | ||
-@@ -22,14 +22,14 @@ namespace headless { | ||
+--- a/headless/lib/browser/headless_browser_impl.cc | ||
++++ b/headless/lib/browser/headless_browser_impl.cc | ||
+@@ -25,7 +25,7 @@ | ||
|
||
namespace { | ||
// Product name for building the default user agent string. | ||
@@ -21,14 +21,15 @@ | ||
constexpr gfx::Size kDefaultWindowSize(800, 600); | ||
|
||
constexpr gfx::FontRenderParams::Hinting kDefaultFontRenderHinting = | ||
- gfx::FontRenderParams::Hinting::HINTING_FULL; | ||
+@@ -122,7 +122,7 @@ | ||
|
||
- std::string GetProductNameAndVersion() { | ||
+ /// static | ||
+ std::string HeadlessBrowser::GetProductNameAndVersion() { | ||
- return std::string(kHeadlessProductName) + "/" + PRODUCT_VERSION; | ||
+ return std::string(kHeadlessProductName) + "/" + PRODUCT_VERSION + " (Carbonyl)"; | ||
} | ||
- } // namespace | ||
|
||
+ HeadlessBrowserImpl::HeadlessBrowserImpl( | ||
diff --git a/headless/public/headless_browser.h b/headless/public/headless_browser.h | ||
index 48efaa7d57ca2..afc0236147519 100644 | ||
--- a/headless/public/headless_browser.h |
88 changes: 88 additions & 0 deletions
88
x11-packages/carbonyl-host-tools/9003-Bridge-browser-into-Carbonyl-library.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- a/chromium/patches/chromium/0009-Bridge-browser-into-Carbonyl-library.patch | ||
+++ b/chromium/patches/chromium/0009-Bridge-browser-into-Carbonyl-library.patch | ||
@@ -18,14 +18,14 @@ | ||
+++ b/headless/app/headless_shell.cc | ||
@@ -4,6 +4,8 @@ | ||
|
||
- #include "headless/app/headless_shell.h" | ||
+ #include "headless/public/headless_shell.h" | ||
|
||
+#include "carbonyl/src/browser/bridge.h" | ||
+ | ||
#include <memory> | ||
|
||
#include "base/base_switches.h" | ||
-@@ -90,6 +92,8 @@ void HeadlessShell::OnBrowserStart(HeadlessBrowser* browser) { | ||
+@@ -103,6 +105,8 @@ | ||
HeadlessBrowserContext::Builder context_builder = | ||
browser_->CreateBrowserContextBuilder(); | ||
|
||
@@ -34,15 +34,13 @@ | ||
// Retrieve the locale set by InitApplicationLocale() in | ||
// headless_content_main_delegate.cc in a way that is free of side-effects. | ||
context_builder.SetAcceptLanguage(base::i18n::GetConfiguredLocale()); | ||
-@@ -113,39 +117,14 @@ void HeadlessShell::OnBrowserStart(HeadlessBrowser* browser) { | ||
- | ||
- GURL target_url = ConvertArgumentToURL(args.front()); | ||
+@@ -133,35 +137,12 @@ | ||
+ HeadlessWebContents::Builder builder( | ||
+ browser_context->CreateWebContentsBuilder()); | ||
|
||
- // If driven by a debugger just open the target page and | ||
- // leave expecting the debugger will do what they need. | ||
-- if (IsRemoteDebuggingEnabled()) { | ||
-- HeadlessWebContents::Builder builder( | ||
-- browser_context_->CreateWebContentsBuilder()); | ||
+- if (devtools_enabled) { | ||
- HeadlessWebContents* web_contents = | ||
- builder.SetInitialURL(target_url).Build(); | ||
- if (!web_contents) { | ||
@@ -56,8 +54,6 @@ | ||
- // execute the commands against the target page. | ||
-#if defined(HEADLESS_ENABLE_COMMANDS) | ||
- GURL handler_url = HeadlessCommandHandler::GetHandlerUrl(); | ||
- HeadlessWebContents::Builder builder( | ||
- browser_context_->CreateWebContentsBuilder()); | ||
HeadlessWebContents* web_contents = | ||
- builder.SetInitialURL(handler_url).Build(); | ||
+ builder.SetInitialURL(target_url).Build(); | ||
@@ -71,7 +67,7 @@ | ||
- HeadlessCommandHandler::ProcessCommands( | ||
- HeadlessWebContentsImpl::From(web_contents)->web_contents(), | ||
- std::move(target_url), | ||
-- base::BindOnce(&HeadlessShell::ShutdownSoon, weak_factory_.GetWeakPtr())); | ||
+- base::BindOnce(&HeadlessShell::ShutdownSoon, base::Unretained(this))); | ||
-#endif | ||
} | ||
|
||
@@ -90,9 +86,9 @@ | ||
int main(int argc, const char** argv) { | ||
+ carbonyl_shell_main(); | ||
+ | ||
+ content::ContentMainParams params(nullptr); | ||
#if BUILDFLAG(IS_WIN) | ||
sandbox::SandboxInterfaceInfo sandbox_info = {nullptr}; | ||
- content::InitializeSandboxInfo(&sandbox_info); | ||
diff --git a/headless/lib/browser/headless_browser_impl.cc b/headless/lib/browser/headless_browser_impl.cc | ||
index 1a1223108be6d..fd45d215479ab 100644 | ||
--- a/headless/lib/browser/headless_browser_impl.cc | ||
@@ -550,7 +546,7 @@ | ||
|
||
#include "base/memory/weak_ptr.h" | ||
#include "base/task/single_thread_task_runner.h" | ||
-@@ -121,9 +122,24 @@ class HEADLESS_EXPORT HeadlessBrowserImpl : public HeadlessBrowser, | ||
+@@ -121,7 +122,22 @@ | ||
policy::PolicyService* GetPolicyService(); | ||
#endif | ||
|
||
@@ -566,9 +562,7 @@ | ||
+ void OnMouseDownInput(unsigned int x, unsigned int y); | ||
+ void OnMouseMoveInput(unsigned int x, unsigned int y); | ||
+ | ||
- bool did_shutdown() const { return did_shutdown_; } | ||
- | ||
- protected: | ||
+ private: | ||
+ // TODO: use base::TaskRunner | ||
+ std::thread input_thread_; | ||
+ |
20 changes: 20 additions & 0 deletions
20
x11-packages/carbonyl-host-tools/9004-Rename-carbonyl-Renderer-to-carbonyl-Bridge.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- a/chromium/patches/chromium/0011-Rename-carbonyl-Renderer-to-carbonyl-Bridge.patch | ||
+++ b/chromium/patches/chromium/0011-Rename-carbonyl-Renderer-to-carbonyl-Bridge.patch | ||
@@ -17,14 +17,14 @@ | ||
--- a/headless/app/headless_shell.cc | ||
+++ b/headless/app/headless_shell.cc | ||
@@ -12,6 +12,7 @@ | ||
- #include "base/bind.h" | ||
#include "base/command_line.h" | ||
#include "base/files/file_util.h" | ||
+ #include "base/functional/bind.h" | ||
+#include "base/functional/callback.h" | ||
#include "base/i18n/rtl.h" | ||
+ #include "base/logging.h" | ||
#include "base/task/thread_pool.h" | ||
- #include "build/branding_buildflags.h" | ||
-@@ -92,7 +93,9 @@ void HeadlessShell::OnBrowserStart(HeadlessBrowser* browser) { | ||
+@@ -105,7 +106,9 @@ | ||
HeadlessBrowserContext::Builder context_builder = | ||
browser_->CreateBrowserContextBuilder(); | ||
|
Oops, something went wrong.