mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implement trait-based ResourceThreads and clean up related naming issues
Changes include: - Introduce an IpcSend trait to abstract over a collection of IpcSenders - Implement ResourceThreads collection to abstract the resource-related sub threads across the component - Rename original ResourceThread and ControlMsg into an unifed CoreResource__ to accommodate above changes and avoid confusions
This commit is contained in:
parent
051a749e0d
commit
a51db4cfa8
22 changed files with 213 additions and 179 deletions
|
@ -27,8 +27,8 @@ use js::jsapi::{JSAutoCompartment, RootedValue};
|
|||
use js::jsapi::{JS_GetArrayBufferData, JS_NewArrayBuffer};
|
||||
use js::jsval::UndefinedValue;
|
||||
use libc::{uint32_t, uint8_t};
|
||||
use net_traits::ControlMsg::{WebsocketConnect, SetCookiesForUrl};
|
||||
use net_traits::CookieSource::HTTP;
|
||||
use net_traits::CoreResourceMsg::{WebsocketConnect, SetCookiesForUrl};
|
||||
use net_traits::MessageData;
|
||||
use net_traits::hosts::replace_hosts;
|
||||
use net_traits::unwrap_websocket_protocol;
|
||||
|
@ -265,8 +265,7 @@ impl WebSocket {
|
|||
action_receiver: resource_action_receiver,
|
||||
};
|
||||
|
||||
let resource_thread = global.resource_thread();
|
||||
let _ = resource_thread.send(WebsocketConnect(connect, connect_data));
|
||||
let _ = global.core_resource_thread().send(WebsocketConnect(connect, connect_data));
|
||||
|
||||
*ws.sender.borrow_mut() = Some(dom_action_sender);
|
||||
|
||||
|
@ -493,7 +492,7 @@ impl Runnable for ConnectionEstablishedTask {
|
|||
if let Some(cookies) = self.headers.get_raw("set-cookie") {
|
||||
for cookie in cookies.iter() {
|
||||
if let Ok(cookie_value) = String::from_utf8(cookie.clone()) {
|
||||
let _ = ws.global().r().resource_thread().send(SetCookiesForUrl(ws.url.clone(),
|
||||
let _ = ws.global().r().core_resource_thread().send(SetCookiesForUrl(ws.url.clone(),
|
||||
cookie_value,
|
||||
HTTP));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue