Skip to content

Commit

Permalink
Merge branch 'servo:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
captainhaddock18 committed Jul 5, 2023
2 parents 67fc6fe + f11c604 commit dbafb2f
Show file tree
Hide file tree
Showing 97 changed files with 54 additions and 7,084 deletions.
16 changes: 0 additions & 16 deletions .gitignore
Expand Up @@ -55,22 +55,6 @@ Sessionx.vim

/unminified-js

# Hololens artifacts
support/hololens/x64/
support/hololens/ARM/
support/hololens/ARM64/
support/hololens/ServoApp/x64/
support/hololens/ServoApp/ARM/
support/hololens/ServoApp/ARM64/
support/hololens/ServoApp/Generated Files/
support/hololens/ServoApp/BundleArtifacts/
support/hololens/ServoApp/support/
support/hololens/ServoApp/Debug/
support/hololens/ServoApp/Release/
support/hololens/packages/
support/hololens/AppPackages/
support/hololens/.vs/

# Layout debugger trace files
layout_trace*

Expand Down
23 changes: 0 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -44,7 +44,7 @@ manually, try the [manual build setup][manual-build].
- Download and run [`rustup-init.exe`](https://win.rustup.rs/) then follow the onscreen instructions.
- Install [chocolatey](https://chocolatey.org/)
- Run `mach bootstrap`
- *This will install CMake, Git, Ninja, NuGet, Python and the Visual Studio 2019 Build Tools
- *This will install CMake, Git, Ninja, Python and the Visual Studio 2019 Build Tools
via choco in an Administrator console. It can take quite a while.*
- *If you already have Visual Studio 2019 installed, this may not install all necessary components.
Please follow the Visual Studio 2019 installation instructions in the [manual setup][manual-build].*
Expand Down
7 changes: 0 additions & 7 deletions Xargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions components/config/Cargo.toml
Expand Up @@ -6,9 +6,6 @@ license = "MPL-2.0"
edition = "2018"
publish = false

[features]
uwp = []

[lib]
name = "servo_config"
path = "lib.rs"
Expand Down
7 changes: 1 addition & 6 deletions components/config/basedir.rs
Expand Up @@ -35,14 +35,9 @@ pub fn default_config_dir() -> Option<PathBuf> {
Some(config_dir)
}

#[cfg(all(target_os = "windows", not(feature = "uwp")))]
#[cfg(all(target_os = "windows"))]
pub fn default_config_dir() -> Option<PathBuf> {
let mut config_dir = ::dirs_next::config_dir().unwrap();
config_dir.push("Servo");
Some(config_dir)
}

#[cfg(all(target_os = "windows", feature = "uwp"))]
pub fn default_config_dir() -> Option<PathBuf> {
None
}
2 changes: 1 addition & 1 deletion components/config/tests/prefs.rs
Expand Up @@ -244,7 +244,7 @@ fn test_set_all_error_on_unknown_field() -> Result<(), Box<dyn Error>> {
Ok(())
}

#[cfg(not(any(target_os = "android", feature = "uwp")))]
#[cfg(not(target_os = "android"))]
#[test]
fn test_default_config_dir_create_read_write() {
let json_str = "{\
Expand Down
1 change: 0 additions & 1 deletion components/script/Cargo.toml
Expand Up @@ -21,7 +21,6 @@ default = ["unrooted_must_root_lint"]
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
js_backtrace = []
refcell_backtrace = ["accountable-refcell"]
uwp = ["js/uwp"]
xr-profile = ["webxr-api/profile"]

[build-dependencies]
Expand Down
1 change: 0 additions & 1 deletion components/servo/Cargo.toml
Expand Up @@ -26,7 +26,6 @@ no-wgl = ["canvas/no-wgl"]
no_static_freetype = ["webrender/no_static_freetype"]
profilemozjs = ["script/profilemozjs"]
refcell_backtrace = ["script/refcell_backtrace"]
uwp = ["servo_config/uwp", "script/uwp"]
webdriver = ["webdriver_server"]
webgl_backtrace = [
"script/webgl_backtrace",
Expand Down
49 changes: 5 additions & 44 deletions components/servo/lib.rs
Expand Up @@ -141,49 +141,14 @@ mod media_platform {
use super::ServoMedia;
use servo_media_gstreamer::GStreamerBackend;

#[cfg(feature = "uwp")]
fn set_gstreamer_log_handler() {
use gstreamer::{debug_add_log_function, DebugLevel};

debug_add_log_function(|cat, level, file, function, line, _, message| {
let message = format!(
"{:?} {:?} {:?}:{:?}:{:?} {:?}",
cat.get_name(),
level,
file,
line,
function,
message
);
match level {
DebugLevel::Debug => debug!("{}", message),
DebugLevel::Error => error!("{}", message),
DebugLevel::Warning => warn!("{}", message),
DebugLevel::Fixme | DebugLevel::Info => info!("{}", message),
DebugLevel::Memdump | DebugLevel::Count | DebugLevel::Trace => {
trace!("{}", message)
},
_ => (),
}
});
}

#[cfg(any(windows, target_os = "macos"))]
pub fn init() {
// UWP apps have the working directory set appropriately. Win32 apps
// do not and need some assistance finding the DLLs.
let plugin_dir = if cfg!(feature = "uwp") {
std::path::PathBuf::new()
} else {
let mut plugin_dir = std::env::current_exe().unwrap();
plugin_dir.pop();
let mut plugin_dir = std::env::current_exe().unwrap();
plugin_dir.pop();

if cfg!(target_os = "macos") {
plugin_dir.push("lib");
}

plugin_dir
};
if cfg!(target_os = "macos") {
plugin_dir.push("lib");
}

let backend = match GStreamerBackend::init_with_plugins(
plugin_dir,
Expand All @@ -196,10 +161,6 @@ mod media_platform {
},
};
ServoMedia::init_with_backend(backend);
#[cfg(feature = "uwp")]
{
set_gstreamer_log_handler();
}
}

#[cfg(not(any(windows, target_os = "macos")))]
Expand Down
1 change: 0 additions & 1 deletion ports/libsimpleservo/api/Cargo.toml
Expand Up @@ -48,7 +48,6 @@ no_static_freetype = ["libservo/no_static_freetype"]
no-wgl = ["libservo/no-wgl"]
profilemozjs = ["libservo/profilemozjs"]
refcell_backtrace = ["libservo/refcell_backtrace"]
uwp = ["libservo/uwp", "webxr/openxr-api"]
webdriver = ["libservo/webdriver"]
webgl_backtrace = ["libservo/webgl_backtrace"]
xr-profile = ["libservo/xr-profile"]
16 changes: 0 additions & 16 deletions ports/libsimpleservo/api/build.rs
Expand Up @@ -49,22 +49,6 @@ fn main() {
let mut pkg_prefs = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
pkg_prefs.push("../../../resources/package-prefs.json");
let pkg_prefs: Value = serde_json::from_reader(File::open(&pkg_prefs).unwrap()).unwrap();
if target.contains("uwp") {
// Assuming Hololens build
let to_merge = pkg_prefs
.as_object()
.unwrap()
.get("hololens")
.unwrap()
.as_object()
.unwrap();
for (key, value) in to_merge.iter() {
prefs
.as_object_mut()
.unwrap()
.insert(key.clone(), value.clone());
}
}
let file = File::create(&dest.join("prefs.json")).unwrap();
serde_json::to_writer(file, &prefs).unwrap();
}
92 changes: 3 additions & 89 deletions ports/libsimpleservo/api/src/lib.rs
Expand Up @@ -267,12 +267,9 @@ pub fn init(

// Initialize surfman
let connection = Connection::new().or(Err("Failed to create connection"))?;
let adapter = match create_adapter() {
Some(adapter) => adapter,
None => connection
.create_adapter()
.or(Err("Failed to create adapter"))?,
};
let adapter = connection
.create_adapter()
.or(Err("Failed to create adapter"))?;
let surface_type = match init_opts.surfman_integration {
SurfmanIntegration::Widget(native_widget) => {
let native_widget = unsafe {
Expand Down Expand Up @@ -824,79 +821,6 @@ struct ServoWindowCallbacks {
}

impl EmbedderMethods for ServoEmbedderCallbacks {
#[cfg(feature = "uwp")]
fn register_webxr(
&mut self,
registry: &mut webxr::MainThreadRegistry,
embedder_proxy: EmbedderProxy,
) {
use ipc_channel::ipc::{self, IpcReceiver};
use webxr::openxr;
debug!("EmbedderMethods::register_xr");
assert!(
self.xr_discovery.is_none(),
"UWP builds should not be initialized with a WebXR Discovery object"
);

#[derive(Clone)]
struct ContextMenuCallback(EmbedderProxy);

struct ContextMenuFuture(IpcReceiver<ContextMenuResult>);

impl openxr::ContextMenuProvider for ContextMenuCallback {
fn open_context_menu(&self) -> Box<dyn openxr::ContextMenuFuture> {
let (sender, receiver) = ipc::channel().unwrap();
self.0.send((
None,
EmbedderMsg::ShowContextMenu(
sender,
Some("Would you like to exit the XR session?".into()),
vec!["Exit".into()],
),
));

Box::new(ContextMenuFuture(receiver))
}
fn clone_object(&self) -> Box<dyn openxr::ContextMenuProvider> {
Box::new(self.clone())
}
}

impl openxr::ContextMenuFuture for ContextMenuFuture {
fn poll(&self) -> openxr::ContextMenuResult {
if let Ok(result) = self.0.try_recv() {
if let ContextMenuResult::Selected(0) = result {
openxr::ContextMenuResult::ExitSession
} else {
openxr::ContextMenuResult::Dismissed
}
} else {
openxr::ContextMenuResult::Pending
}
}
}

if openxr::create_instance(false, false).is_ok() {
let discovery =
openxr::OpenXrDiscovery::new(Box::new(ContextMenuCallback(embedder_proxy)));
registry.register(discovery);
} else {
let msg =
"Cannot initialize OpenXR - please ensure runtime is installed and enabled in \
the OpenXR developer portal app.\n\nImmersive mode will not function until \
this error is fixed.";
let (sender, _receiver) = ipc::channel().unwrap();
embedder_proxy.send((
None,
EmbedderMsg::Prompt(
PromptDefinition::Alert(msg.to_owned(), sender),
PromptOrigin::Trusted,
),
));
}
}

#[cfg(not(feature = "uwp"))]
fn register_webxr(
&mut self,
registry: &mut webxr::MainThreadRegistry,
Expand Down Expand Up @@ -1002,13 +926,3 @@ impl ResourceReaderMethods for ResourceReaderInstance {
vec![]
}
}

#[cfg(feature = "uwp")]
fn create_adapter() -> Option<Adapter> {
webxr::openxr::create_surfman_adapter()
}

#[cfg(not(feature = "uwp"))]
fn create_adapter() -> Option<Adapter> {
None
}
1 change: 0 additions & 1 deletion ports/libsimpleservo/capi/Cargo.toml
Expand Up @@ -43,7 +43,6 @@ native-bluetooth = ["simpleservo/native-bluetooth"]
no-wgl = ["simpleservo/no-wgl"]
profilemozjs = ["simpleservo/profilemozjs"]
refcell_backtrace = ["simpleservo/refcell_backtrace"]
uwp = ["simpleservo/uwp"]
webdriver = ["simpleservo/webdriver"]
webgl_backtrace = ["simpleservo/webgl_backtrace"]
xr-profile = ["simpleservo/xr-profile"]
3 changes: 0 additions & 3 deletions python/requirements.txt
Expand Up @@ -36,9 +36,6 @@ six == 1.15
# For sending build notifications.
notify-py == 0.3.42

# For formatting C++ files.
clang-format ~= 16.0.0

# A few more requirements for tidy.
voluptuous == 0.12.1
PyYAML == 5.4
Expand Down

0 comments on commit dbafb2f

Please sign in to comment.