mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Extract canvas operations for reuse by OffscreenCanvas.
This commit is contained in:
parent
6fb7a8cdc7
commit
85c20db495
257 changed files with 1857 additions and 1870 deletions
|
@ -20,6 +20,7 @@ use crate::dom::errorevent::ErrorEvent;
|
|||
use crate::dom::event::{Event, EventBubbles, EventCancelable, EventStatus};
|
||||
use crate::dom::eventsource::EventSource;
|
||||
use crate::dom::eventtarget::EventTarget;
|
||||
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
|
||||
use crate::dom::performance::Performance;
|
||||
use crate::dom::window::Window;
|
||||
use crate::dom::workerglobalscope::WorkerGlobalScope;
|
||||
|
@ -51,6 +52,7 @@ use js::rust::{get_object_class, CompileOptionsWrapper, ParentRuntime, Runtime};
|
|||
use js::rust::{HandleValue, MutableHandleValue};
|
||||
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use net_traits::image_cache::ImageCache;
|
||||
use net_traits::{CoreResourceThread, IpcSend, ResourceThreads};
|
||||
use profile_traits::{mem as profile_mem, time as profile_time};
|
||||
use script_traits::{MsDuration, ScriptToConstellationChan, TimerEvent};
|
||||
|
@ -376,6 +378,19 @@ impl GlobalScope {
|
|||
&self.origin
|
||||
}
|
||||
|
||||
pub fn image_cache(&self) -> Arc<dyn ImageCache> {
|
||||
if let Some(window) = self.downcast::<Window>() {
|
||||
return window.image_cache();
|
||||
}
|
||||
if let Some(worker) = self.downcast::<DedicatedWorkerGlobalScope>() {
|
||||
return worker.image_cache();
|
||||
}
|
||||
if let Some(worker) = self.downcast::<PaintWorkletGlobalScope>() {
|
||||
return worker.image_cache();
|
||||
}
|
||||
unreachable!();
|
||||
}
|
||||
|
||||
/// Get the [base url](https://html.spec.whatwg.org/multipage/#api-base-url)
|
||||
/// for this global scope.
|
||||
pub fn api_base_url(&self) -> ServoUrl {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue