Auto merge of #10961 - creativcoder:custom_response_iface, r=jdm

adding interface for custom responses

Fixes #10960

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10961)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-21 01:12:54 -07:00
commit 1a34137ac4
17 changed files with 663 additions and 146 deletions

View file

@ -47,10 +47,10 @@ use libc;
use msg::constellation_msg::{LoadData, PanicMsg, PipelineId, SubpageId};
use msg::constellation_msg::{WindowSizeData, WindowSizeType};
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
use net_traits::ResourceThreads;
use net_traits::bluetooth_thread::BluetoothMethodMsg;
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
use net_traits::storage_thread::StorageType;
use net_traits::{ResourceThreads, CustomResponseSender};
use num_traits::ToPrimitive;
use profile_traits::mem;
use profile_traits::time::{ProfilerCategory, TimerMetadata, TimerMetadataFrameType};
@ -150,6 +150,8 @@ pub struct Window {
image_cache_thread: ImageCacheThread,
#[ignore_heap_size_of = "channels are hard"]
image_cache_chan: ImageCacheChan,
#[ignore_heap_size_of = "channels are hard"]
custom_message_chan: IpcSender<CustomResponseSender>,
#[ignore_heap_size_of = "TODO(#6911) newtypes containing unmeasurable types are hard"]
compositor: IpcSender<ScriptToCompositorMsg>,
browsing_context: MutNullableHeap<JS<BrowsingContext>>,
@ -305,6 +307,10 @@ impl Window {
self.image_cache_chan.clone()
}
pub fn custom_message_chan(&self) -> IpcSender<CustomResponseSender> {
self.custom_message_chan.clone()
}
pub fn get_next_worker_id(&self) -> WorkerId {
let worker_id = self.next_worker_id.get();
let WorkerId(id_num) = worker_id;
@ -1442,6 +1448,7 @@ impl Window {
history_task_source: HistoryTraversalTaskSource,
file_task_source: FileReadingTaskSource,
image_cache_chan: ImageCacheChan,
custom_message_chan: IpcSender<CustomResponseSender>,
compositor: IpcSender<ScriptToCompositorMsg>,
image_cache_thread: ImageCacheThread,
resource_threads: ResourceThreads,
@ -1479,6 +1486,7 @@ impl Window {
history_traversal_task_source: history_task_source,
file_reading_task_source: file_task_source,
image_cache_chan: image_cache_chan,
custom_message_chan: custom_message_chan,
console: Default::default(),
crypto: Default::default(),
compositor: compositor,