diff options
author | Jonathan Schwender <55576758+jschwe@users.noreply.github.com> | 2024-09-24 06:29:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 04:29:53 +0000 |
commit | 88ffe9f7a56ef0981805a7b8264f870947cebcf5 (patch) | |
tree | be2cfad7fefaaea0b5f303c292f9fc6ff6462513 /ports/servoshell/egl/ohos/simpleservo.rs | |
parent | ff86771b481bb241d85a913ca923b5d31ed8352c (diff) | |
download | servo-88ffe9f7a56ef0981805a7b8264f870947cebcf5.tar.gz servo-88ffe9f7a56ef0981805a7b8264f870947cebcf5.zip |
ohos: Bundle resource files in hap (#33513)
Bundle resource files into the .hap, so they are available
as files in the application sandbox, instead of included
into the shared library.
This should slightly reduce the binary size in debug and
release mode.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Diffstat (limited to 'ports/servoshell/egl/ohos/simpleservo.rs')
-rw-r--r-- | ports/servoshell/egl/ohos/simpleservo.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ports/servoshell/egl/ohos/simpleservo.rs b/ports/servoshell/egl/ohos/simpleservo.rs index 226a5c18fc7..4dad52c0c75 100644 --- a/ports/servoshell/egl/ohos/simpleservo.rs +++ b/ports/servoshell/egl/ohos/simpleservo.rs @@ -23,8 +23,8 @@ use servo::{self, gl, Servo}; use surfman::{Connection, SurfaceType}; use crate::egl::host_trait::HostTrait; +use crate::egl::ohos::resources::ResourceReaderInstance; use crate::egl::ohos::InitOpts; -use crate::egl::resources::ResourceReaderInstance; use crate::egl::servo_glue::{ Coordinates, ServoEmbedderCallbacks, ServoGlue, ServoWindowCallbacks, }; @@ -41,7 +41,8 @@ pub fn init( ) -> Result<ServoGlue, &'static str> { info!("Entered simpleservo init function"); crate::init_tracing(); - resources::set(Box::new(ResourceReaderInstance::new())); + let resource_dir = PathBuf::from(&options.resource_dir).join("servo"); + resources::set(Box::new(ResourceReaderInstance::new(resource_dir))); gl.clear_color(1.0, 1.0, 1.0, 1.0); gl.clear(gl::COLOR_BUFFER_BIT); @@ -96,7 +97,12 @@ pub fn init( CompositeTarget::Window, ); - let mut servo_glue = ServoGlue::new(rendering_context, servo.servo, window_callbacks); + let mut servo_glue = ServoGlue::new( + rendering_context, + servo.servo, + window_callbacks, + Some(options.resource_dir), + ); let initial_url = ServoUrl::parse(options.url.as_str()) .inspect_err(|e| error!("Invalid initial Servo URL `{}`. Error: {e:?}", options.url)) |