servo: Merge #11189 - Refactor resource thread code (from izgzhen:refactor-resource-thread); r=nox

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

- [x] These changes do not require tests because it is refactoring

Source-Repo: https://github.com/servo/servo
Source-Revision: bcea0ada27de694cd0c465d04fd35eba70503d62
This commit is contained in:
Zhen Zhang
2016-05-19 19:15:08 -07:00
parent b09c93e2d3
commit 87ef24d5ce
22 changed files with 213 additions and 179 deletions

View File

@@ -9,7 +9,7 @@ use dom::bindings::js::JS;
use dom::document::Document;
use msg::constellation_msg::PipelineId;
use net_traits::AsyncResponseTarget;
use net_traits::{PendingAsyncLoad, ResourceThread, LoadContext};
use net_traits::{PendingAsyncLoad, CoreResourceThread, LoadContext};
use std::sync::Arc;
use std::thread;
use url::Url;
@@ -93,10 +93,10 @@ impl Drop for LoadBlocker {
#[derive(JSTraceable, HeapSizeOf)]
pub struct DocumentLoader {
/// We use an `Arc<ResourceThread>` here in order to avoid file descriptor exhaustion when there
/// We use an `Arc<CoreResourceThread>` here in order to avoid file descriptor exhaustion when there
/// are lots of iframes.
#[ignore_heap_size_of = "channels are hard"]
pub resource_thread: Arc<ResourceThread>,
pub resource_thread: Arc<CoreResourceThread>,
pipeline: Option<PipelineId>,
blocking_loads: Vec<LoadType>,
events_inhibited: bool,
@@ -107,9 +107,9 @@ impl DocumentLoader {
DocumentLoader::new_with_thread(existing.resource_thread.clone(), None, None)
}
/// We use an `Arc<ResourceThread>` here in order to avoid file descriptor exhaustion when there
/// We use an `Arc<CoreResourceThread>` here in order to avoid file descriptor exhaustion when there
/// are lots of iframes.
pub fn new_with_thread(resource_thread: Arc<ResourceThread>,
pub fn new_with_thread(resource_thread: Arc<CoreResourceThread>,
pipeline: Option<PipelineId>,
initial_load: Option<Url>)
-> DocumentLoader {