Skip to content

Commit f3993d9

Browse files
author
Alan Jeffrey
committed
Lookup frames by frame_id, not pipeline_id.
1 parent 4984a83 commit f3993d9

File tree

13 files changed

+187
-164
lines changed

13 files changed

+187
-164
lines changed

components/compositing/compositor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
739739
fn set_frame_tree(&mut self,
740740
frame_tree: &SendableFrameTree,
741741
response_chan: IpcSender<()>) {
742+
debug!("Setting the frame tree for pipeline {}", frame_tree.pipeline.id);
742743
if let Err(e) = response_chan.send(()) {
743744
warn!("Sending reponse to set frame tree failed ({}).", e);
744745
}

components/constellation/constellation.rs

Lines changed: 80 additions & 80 deletions
Large diffs are not rendered by default.

components/constellation/pipeline.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ pub struct Pipeline {
6969
/// Whether this pipeline should be treated as visible for the purposes of scheduling and
7070
/// resource management.
7171
pub visible: bool,
72-
/// Whether this pipeline is has matured or not.
73-
/// A pipeline is considered mature when it has an associated frame.
74-
pub is_mature: bool,
7572
}
7673

7774
/// Initial setup data needed to construct a pipeline.
@@ -152,6 +149,7 @@ impl Pipeline {
152149
let new_layout_info = NewLayoutInfo {
153150
parent_pipeline_id: parent_pipeline_id,
154151
new_pipeline_id: state.id,
152+
frame_id: state.frame_id,
155153
frame_type: frame_type,
156154
load_data: state.load_data.clone(),
157155
pipeline_port: pipeline_port,
@@ -203,6 +201,7 @@ impl Pipeline {
203201

204202
let unprivileged_pipeline_content = UnprivilegedPipelineContent {
205203
id: state.id,
204+
frame_id: state.frame_id,
206205
parent_info: state.parent_info,
207206
constellation_chan: state.constellation_chan,
208207
scheduler_chan: state.scheduler_chan,
@@ -281,7 +280,6 @@ impl Pipeline {
281280
running_animations: false,
282281
visible: visible,
283282
is_private: is_private,
284-
is_mature: false,
285283
}
286284
}
287285

@@ -348,7 +346,7 @@ impl Pipeline {
348346
}
349347

350348
pub fn trigger_mozbrowser_event(&self,
351-
child_id: Option<PipelineId>,
349+
child_id: Option<FrameId>,
352350
event: MozBrowserEvent) {
353351
assert!(PREFS.is_mozbrowser_enabled());
354352

@@ -380,6 +378,7 @@ impl Pipeline {
380378
#[derive(Deserialize, Serialize)]
381379
pub struct UnprivilegedPipelineContent {
382380
id: PipelineId,
381+
frame_id: FrameId,
383382
parent_info: Option<(PipelineId, FrameType)>,
384383
constellation_chan: IpcSender<ScriptMsg>,
385384
layout_to_constellation_chan: IpcSender<LayoutMsg>,
@@ -414,6 +413,7 @@ impl UnprivilegedPipelineContent {
414413
{
415414
let layout_pair = STF::create(InitialScriptState {
416415
id: self.id,
416+
frame_id: self.frame_id,
417417
parent_info: self.parent_info,
418418
control_chan: self.script_chan.clone(),
419419
control_port: self.script_port,

components/net/http_loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ pub fn obtain_response<A>(request_factory: &HttpRequestFactory<R=A>,
784784
}
785785

786786
if log_enabled!(log::LogLevel::Info) {
787-
info!("{}", method);
787+
info!("{} {}", method, connection_url);
788788
for header in headers.iter() {
789789
info!(" - {}", header);
790790
}

components/script/document_loader.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ impl DocumentLoader {
9494

9595
pub fn new_with_threads(resource_threads: ResourceThreads,
9696
initial_load: Option<Url>) -> DocumentLoader {
97+
debug!("Initial blocking load {:?}.", initial_load);
9798
let initial_loads = initial_load.into_iter().map(LoadType::PageSource).collect();
9899

99100
DocumentLoader {
@@ -105,6 +106,7 @@ impl DocumentLoader {
105106

106107
/// Add a load to the list of blocking loads.
107108
fn add_blocking_load(&mut self, load: LoadType) {
109+
debug!("Adding blocking load {:?} ({}).", load, self.blocking_loads.len());
108110
self.blocking_loads.push(load);
109111
}
110112

@@ -119,6 +121,7 @@ impl DocumentLoader {
119121

120122
/// Mark an in-progress network request complete.
121123
pub fn finish_load(&mut self, load: &LoadType) {
124+
debug!("Removing blocking load {:?} ({}).", load, self.blocking_loads.len());
122125
let idx = self.blocking_loads.iter().position(|unfinished| *unfinished == *load);
123126
self.blocking_loads.remove(idx.expect(&format!("unknown completed load {:?}", load)));
124127
}

components/script/dom/document.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ use ipc_channel::ipc::{self, IpcSender};
9696
use js::jsapi::{JSContext, JSObject, JSRuntime};
9797
use js::jsapi::JS_GetRuntime;
9898
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
99+
use msg::constellation_msg::{FrameId, ReferrerPolicy};
99100
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
100-
use msg::constellation_msg::{PipelineId, ReferrerPolicy};
101101
use net_traits::{FetchResponseMsg, IpcSend};
102102
use net_traits::CookieSource::NonHTTP;
103103
use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl};
@@ -1400,7 +1400,7 @@ impl Document {
14001400
if let Some((parent_pipeline_id, _)) = self.window.parent_info() {
14011401
let global_scope = self.window.upcast::<GlobalScope>();
14021402
let event = ConstellationMsg::MozBrowserEvent(parent_pipeline_id,
1403-
Some(global_scope.pipeline_id()),
1403+
global_scope.pipeline_id(),
14041404
event);
14051405
global_scope.constellation_chan().send(event).unwrap();
14061406
}
@@ -1513,8 +1513,10 @@ impl Document {
15131513
}
15141514
}
15151515

1516-
let loader = self.loader.borrow();
1517-
if !loader.is_blocked() && !loader.events_inhibited() {
1516+
if !self.loader.borrow().is_blocked() && !self.loader.borrow().events_inhibited() {
1517+
// Schedule a task to fire a "load" event (if no blocking loads have arrived in the mean time)
1518+
// NOTE: we can end up executing this code more than once, in case more blocking loads arrive.
1519+
debug!("Document loads are complete.");
15181520
let win = self.window();
15191521
let msg = MainThreadScriptMsg::DocumentLoadsComplete(
15201522
win.upcast::<GlobalScope>().pipeline_id());
@@ -1630,11 +1632,11 @@ impl Document {
16301632
}
16311633

16321634
/// Find an iframe element in the document.
1633-
pub fn find_iframe(&self, pipeline: PipelineId) -> Option<Root<HTMLIFrameElement>> {
1635+
pub fn find_iframe(&self, frame_id: FrameId) -> Option<Root<HTMLIFrameElement>> {
16341636
self.upcast::<Node>()
16351637
.traverse_preorder()
16361638
.filter_map(Root::downcast::<HTMLIFrameElement>)
1637-
.find(|node| node.pipeline_id() == Some(pipeline))
1639+
.find(|node| node.frame_id() == frame_id)
16381640
}
16391641

16401642
pub fn get_dom_loading(&self) -> u64 {

components/script/dom/htmliframeelement.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ impl HTMLIFrameElement {
207207
self.pipeline_id.get()
208208
}
209209

210+
#[inline]
211+
pub fn frame_id(&self) -> FrameId {
212+
self.frame_id
213+
}
214+
210215
pub fn change_visibility_status(&self, visibility: bool) {
211216
if self.visibility.get() != visibility {
212217
self.visibility.set(visibility);

0 commit comments

Comments
 (0)