mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add file backend support for Blob and related
Changes include: - Add BlobImpl to Blob, and related caching mechanism - Expose ResourceThreads to document_loader, workerglobalscope, worker, and global - Fix encode_multipart_form_data - Other small fixes to accommodate the above changes
This commit is contained in:
parent
d53507f747
commit
43ad4ba585
18 changed files with 253 additions and 152 deletions
|
@ -19,7 +19,8 @@ use js::jsapi::{CurrentGlobalOrNull, GetGlobalForObjectCrossCompartment};
|
|||
use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue};
|
||||
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
|
||||
use msg::constellation_msg::{PipelineId, PanicMsg};
|
||||
use net_traits::{CoreResourceThread, RequestSource};
|
||||
use net_traits::filemanager_thread::FileManagerThreadMsg;
|
||||
use net_traits::{ResourceThreads, CoreResourceThread, RequestSource, IpcSend};
|
||||
use profile_traits::{mem, time};
|
||||
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
|
||||
use script_thread::{MainThreadScriptChan, ScriptThread};
|
||||
|
@ -122,19 +123,29 @@ impl<'a> GlobalRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Get the `CoreResourceThread` for this global scope.
|
||||
pub fn core_resource_thread(&self) -> CoreResourceThread {
|
||||
/// Get the `ResourceThreads` for this global scope.
|
||||
pub fn resource_threads(&self) -> ResourceThreads {
|
||||
match *self {
|
||||
GlobalRef::Window(ref window) => {
|
||||
let doc = window.Document();
|
||||
let doc = doc.r();
|
||||
let loader = doc.loader();
|
||||
(*loader.resource_thread).clone()
|
||||
loader.resource_threads().clone()
|
||||
}
|
||||
GlobalRef::Worker(ref worker) => worker.core_resource_thread().clone(),
|
||||
GlobalRef::Worker(ref worker) => worker.resource_threads().clone(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the `CoreResourceThread` for this global scope
|
||||
pub fn core_resource_thread(&self) -> CoreResourceThread {
|
||||
self.resource_threads().sender()
|
||||
}
|
||||
|
||||
/// Get the port to file manager for this global scope
|
||||
pub fn filemanager_thread(&self) -> IpcSender<FileManagerThreadMsg> {
|
||||
self.resource_threads().sender()
|
||||
}
|
||||
|
||||
/// Get the worker's id.
|
||||
pub fn get_worker_id(&self) -> Option<WorkerId> {
|
||||
match *self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue