Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename the content task to the script task #451

Merged
merged 1 commit into from May 16, 2013
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Rename the content task to the script task

  • Loading branch information
pcwalton committed May 15, 2013
commit ad5bfd5297f45e1ee1ca2be68abc74ceecfa9c7e
@@ -112,7 +112,7 @@ fn mainloop(po: Port<Msg>, dom_event_chan: SharedChan<Event>, opts: &Opts) {
let done = @mut false;
let resize_rate_limiter = @mut ResizeRateLimiter(dom_event_chan);
let check_for_messages: @fn() = || {
// Periodically check if content responded to our last resize event
// Periodically check if the script task responded to our last resize event
resize_rate_limiter.check_resize_response();

// Handle messages
@@ -3,8 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/*!
A little class that rate limits the number of resize events sent to the content task
based on how fast content dispatches those events. It waits until each event is handled
A little class that rate limits the number of resize events sent to the script task
based on how fast script dispatches those events. It waits until each event is handled
before sending the next. If the window is resized multiple times before an event is handled
then some events will never be sent.
*/
@@ -41,7 +41,7 @@ pub impl ResizeRateLimiter {
self.next_resize_event = None;
} else {
if self.next_resize_event.is_some() {
warn!("osmain: content can't keep up. skipping resize event");
warn!("osmain: script task can't keep up. skipping resize event");
}
self.next_resize_event = Some((width, height));
}

This file was deleted.

@@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use content::content_task::{task_from_context, global_content};
use dom::bindings::utils::{CacheableWrapper, WrapperCache, BindingObject, DerivedWrapper};
use dom::bindings::codegen::ClientRectBinding;
use dom::clientrect::ClientRect;
use js::jsapi::{JSObject, JSContext, JSVal};
use js::glue::bindgen::RUST_OBJECT_TO_JSVAL;
use scripting::script_task::{task_from_context, global_script_context};

pub impl ClientRect {
pub fn init_wrapper(@mut self) {
let content = global_content();
let cx = content.compartment.get().cx.ptr;
let owner = content.window.get();
let script_context = global_script_context();
let cx = script_context.compartment.get().cx.ptr;
let owner = script_context.window.get();
let cache = owner.get_wrappercache();
let scope = cache.get_wrapper();
self.wrap_object_shared(cx, scope);
@@ -22,7 +22,9 @@ pub impl ClientRect {

impl CacheableWrapper for ClientRect {
fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { cast::transmute(&self.wrapper) }
unsafe {
cast::transmute(&self.wrapper)
}
}

fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject {
@@ -33,8 +35,10 @@ impl CacheableWrapper for ClientRect {

impl BindingObject for ClientRect {
fn GetParentObject(&self, cx: *JSContext) -> @mut CacheableWrapper {
let content = task_from_context(cx);
unsafe { (*content).window.get() as @mut CacheableWrapper }
let script_context = task_from_context(cx);
unsafe {
(*script_context).window.get() as @mut CacheableWrapper
}
}
}

@@ -2,17 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use content::content_task::{task_from_context, global_content};
use dom::bindings::codegen::ClientRectListBinding;
use dom::bindings::utils::{WrapperCache, CacheableWrapper, BindingObject};
use dom::clientrectlist::ClientRectList;
use js::jsapi::{JSObject, JSContext};
use scripting::script_task::{task_from_context, global_script_context};

pub impl ClientRectList {
fn init_wrapper(@mut self) {
let content = global_content();
let cx = content.compartment.get().cx.ptr;
let owner = content.window.get();
let script_context = global_script_context();
let cx = script_context.compartment.get().cx.ptr;
let owner = script_context.window.get();
let cache = owner.get_wrappercache();
let scope = cache.get_wrapper();
self.wrap_object_shared(cx, scope);
@@ -32,7 +32,7 @@ impl CacheableWrapper for ClientRectList {

impl BindingObject for ClientRectList {
fn GetParentObject(&self, cx: *JSContext) -> @mut CacheableWrapper {
let content = task_from_context(cx);
unsafe { (*content).window.get() as @mut CacheableWrapper }
let script_context = task_from_context(cx);
unsafe { (*script_context).window.get() as @mut CacheableWrapper }
}
}
@@ -2435,8 +2435,8 @@ def CreateBindingJSObject(descriptor, parent):
if descriptor.proxy:
handler = """ //let cache = ptr::to_unsafe_ptr(aObject.get_wrappercache());
let content = task_from_context(aCx);
let handler = (*content).dom_static.proxy_handlers.get(&(prototypes::id::%s as uint));
let script_context = task_from_context(aCx);
let handler = (*script_context).dom_static.proxy_handlers.get(&(prototypes::id::%s as uint));
""" % descriptor.name
create = handler + """ let obj = NewProxyObject(aCx, *handler,
ptr::to_unsafe_ptr(&RUST_PRIVATE_TO_JSVAL(squirrel_away(aObject) as *libc::c_void)),
@@ -2606,8 +2606,8 @@ def definition_body(self):
elif props.hasNonChromeOnly():
idsToInit.append(props.variableName(False))
if len(idsToInit) > 0:
setup = CGList([CGGeneric("let content = task_from_context(aCx);"),
CGList([CGGeneric("let %s_ids_mut = (*content).dom_static.attribute_ids.get(&(prototypes::id::%s as uint));" % (varname, self.descriptor.name)) for varname in idsToInit], '\n')], '\n')
setup = CGList([CGGeneric("let script_context = task_from_context(aCx);"),
CGList([CGGeneric("let %s_ids_mut = (*script_context).dom_static.attribute_ids.get(&(prototypes::id::%s as uint));" % (varname, self.descriptor.name)) for varname in idsToInit], '\n')], '\n')
initIds = CGList(
[CGGeneric("!InitIds(aCx, %s, *%s_ids_mut)" % (varname, varname)) for
varname in idsToInit], ' ||\n')
@@ -2795,7 +2795,7 @@ def definition_body(self):
else:
getter = "GetConstructorObject"

body = " let content = task_from_context(aCx);\n"
body = " let script_context = task_from_context(aCx);\n"
#XXXjdm This self.descriptor.concrete check shouldn't be necessary
if not self.descriptor.concrete or self.descriptor.proxy:
body += """ let traps = ProxyTraps {
@@ -2828,12 +2828,12 @@ def definition_body(self):
getElementIfPresent: ptr::null(),
getPrototypeOf: ptr::null()
};
(*content).dom_static.proxy_handlers.insert(prototypes::id::%s as uint,
(*script_context).dom_static.proxy_handlers.insert(prototypes::id::%s as uint,
CreateProxyHandler(ptr::to_unsafe_ptr(&traps)));
""" % self.descriptor.name
else:
body += """ (*content).dom_static.attribute_ids.insert(prototypes::id::%s as uint,
body += """ (*script_context).dom_static.attribute_ids.insert(prototypes::id::%s as uint,
vec::cast_to_mut(vec::from_slice(sAttributes_ids)));
""" % self.descriptor.name
body = "" #XXXjdm xray stuff isn't necessary yet
@@ -3308,28 +3308,28 @@ def __init__(self, descriptor, name, args, properties):
def definition_body(self):
varNames = self.properties.variableNames(True)

setup = "let content = task_from_context(cx);\n"
setup = "let script_context = task_from_context(cx);\n"

methods = self.properties.methods
if methods.hasNonChromeOnly() or methods.hasChromeOnly():
methodArgs = "Some(vec::zip_slice(%(methods)s, *method_ids))" % varNames
setup += "let method_ids = (*content).dom_static.method_ids.get(&(prototypes::id::ClientRect as uint));\n"
setup += "let method_ids = (*script_context).dom_static.method_ids.get(&(prototypes::id::ClientRect as uint));\n"
else:
methodArgs = "None"
methodArgs = CGGeneric(methodArgs)

attrs = self.properties.attrs
if attrs.hasNonChromeOnly() or attrs.hasChromeOnly():
attrArgs = "Some(vec::zip_slice(%(attrs)s, *attr_ids))" % varNames
setup += "let attr_ids = (*content).dom_static.attribute_ids.get(&(prototypes::id::ClientRect as uint));\n"
setup += "let attr_ids = (*script_context).dom_static.attribute_ids.get(&(prototypes::id::ClientRect as uint));\n"
else:
attrArgs = "None"
attrArgs = CGGeneric(attrArgs)

consts = self.properties.consts
if consts.hasNonChromeOnly() or consts.hasChromeOnly():
constArgs = "Some(vec::zip_slice(%(consts)s, *const_ids))" % varNames
setup += "let const_ids = (*content).dom_static.constant_ids.get(&(prototypes::id::ClientRect as uint));\n"
setup += "let const_ids = (*script_context).dom_static.constant_ids.get(&(prototypes::id::ClientRect as uint));\n"
else:
constArgs = "None"
constArgs = CGGeneric(constArgs)
@@ -3614,8 +3614,8 @@ def generate_code(self):
//XXXjdm Gecko obtains a GlobalObject from the global (maybe from the private value,
// or through unwrapping a slot or something). We'll punt and get the Window
// from the context for now.
let content = task_from_context(cx);
let global = (*content).window.get();
let script_context = task_from_context(cx);
let global = (*script_context).window.get();
let obj = global.get_wrappercache().get_wrapper();
"""
preArgs = ["global"]
@@ -4147,7 +4147,7 @@ def makeEnumTypedef(e):
'dom::domparser::*', #XXXjdm
'dom::event::*', #XXXjdm
'dom::eventtarget::*', #XXXjdm
'content::content_task::task_from_context',
'scripting::script_task::task_from_context',
'dom::bindings::utils::EnumEntry',
],
[],
@@ -2,26 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use js::rust::{Compartment, jsobj};
use js::{JS_ARGV, JSPROP_ENUMERATE, JSPROP_SHARED,
JSVAL_NULL, JS_THIS_OBJECT, JS_SET_RVAL, JSPROP_NATIVE_ACCESSORS};
use js::jsapi::{JSContext, JSVal, JSObject, JSBool, JSFreeOp,
JSPropertySpec, JSPropertyOpWrapper, JSStrictPropertyOpWrapper,
JSNativeWrapper, JSFunctionSpec};
use js::jsapi::bindgen::{JS_GetReservedSlot, JS_SetReservedSlot,
JS_DefineFunctions, JS_DefineProperties};
use js::glue::bindgen::*;
use js::glue::{PROPERTY_STUB, STRICT_PROPERTY_STUB};
use core::ptr::null;
use core::libc::c_uint;
use content::content_task::task_from_context;
use dom::bindings::utils::{DOMString, rust_box, squirrel_away, str};
use dom::bindings::utils::{jsval_to_str, WrapNewBindingObject, CacheableWrapper};
use dom::bindings::utils::{WrapperCache, DerivedWrapper};

use dom::bindings::utils::{jsval_to_str, WrapNewBindingObject, CacheableWrapper};
use dom::bindings::utils;
use dom::document::Document;
use dom::htmlcollection::HTMLCollection;
use dom::bindings::utils;
use js::glue::bindgen::*;
use js::glue::{PROPERTY_STUB, STRICT_PROPERTY_STUB};
use js::jsapi::bindgen::{JS_DefineProperties};
use js::jsapi::bindgen::{JS_GetReservedSlot, JS_SetReservedSlot, JS_DefineFunctions};
use js::jsapi::{JSContext, JSVal, JSObject, JSBool, JSFreeOp, JSPropertySpec, JSPropertyOpWrapper};
use js::jsapi::{JSStrictPropertyOpWrapper, JSNativeWrapper, JSFunctionSpec};
use js::rust::{Compartment, jsobj};
use js::{JSPROP_NATIVE_ACCESSORS};
use js::{JS_ARGV, JSPROP_ENUMERATE, JSPROP_SHARED, JSVAL_NULL, JS_THIS_OBJECT, JS_SET_RVAL};
use scripting::script_task::task_from_context;

use core::libc::c_uint;
use core::ptr::null;

extern fn getDocumentElement(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe {
@@ -146,7 +145,7 @@ impl CacheableWrapper for Document {
}

fn wrap_object_shared(@mut self, cx: *JSContext, _scope: *JSObject) -> *JSObject {
let content = task_from_context(cx);
unsafe { create((*content).compartment.get(), self) }
let script_context = task_from_context(cx);
unsafe { create((*script_context).compartment.get(), self) }
}
}
@@ -2,23 +2,23 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use content::content_task::task_from_context;
use dom::bindings::node::unwrap;
use dom::bindings::utils::jsval_to_str;
use dom::bindings::utils::{domstring_to_jsval, WrapNewBindingObject};
use dom::bindings::utils::{str, CacheableWrapper, DOM_OBJECT_SLOT, DOMString};
use dom::bindings::utils::jsval_to_str;
use dom::element::*;
use dom::node::{AbstractNode, Element, ElementNodeTypeId};
use layout::layout_task;
use scripting::script_task::task_from_context;
use super::utils;

use core::libc::c_uint;
use core::ptr::null;
use js::glue::bindgen::*;
use js::jsapi::bindgen::*;
use js::jsapi::{JSContext, JSVal, JSObject, JSBool, JSFreeOp, JSPropertySpec};
use js::jsapi::{JSPropertyOpWrapper, JSStrictPropertyOpWrapper, JSFunctionSpec};
use js::jsapi::{JSNativeWrapper, JSTracer, JSTRACE_OBJECT};
use js::jsapi::{JSPropertyOpWrapper, JSStrictPropertyOpWrapper, JSFunctionSpec};
use js::rust::{Compartment, jsobj};
use js::{JS_ARGV, JSPROP_ENUMERATE, JSPROP_SHARED, JSVAL_NULL};
use js::{JS_THIS_OBJECT, JS_SET_RVAL, JSPROP_NATIVE_ACCESSORS};
@@ -215,8 +215,8 @@ extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa
let node = unwrap(obj);
let width = match node.type_id() {
ElementNodeTypeId(HTMLImageElementTypeId) => {
let content = task_from_context(cx);
match (*content).query_layout(layout_task::ContentBox(node)) {
let script_context = task_from_context(cx);
match (*script_context).query_layout(layout_task::ContentBox(node)) {
Ok(rect) => {
match rect {
layout_task::ContentRect(rect) => rect.size.width.to_px(),
@@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use content::content_task::{task_from_context, global_content};
use dom::bindings::utils::{CacheableWrapper, WrapperCache, BindingObject, DerivedWrapper};
use dom::bindings::codegen::EventBinding;
use dom::bindings::utils::{CacheableWrapper, WrapperCache, BindingObject, DerivedWrapper};
use dom::event::Event_;
use js::jsapi::{JSObject, JSContext, JSVal};
use js::glue::bindgen::RUST_OBJECT_TO_JSVAL;
use js::jsapi::{JSObject, JSContext, JSVal};
use scripting::script_task::{task_from_context, global_script_context};

pub impl Event_ {
pub fn init_wrapper(@mut self) {
let content = global_content();
let cx = content.compartment.get().cx.ptr;
let owner = content.window.get();
let script_context = global_script_context();
let cx = script_context.compartment.get().cx.ptr;
let owner = script_context.window.get();
let cache = owner.get_wrappercache();
let scope = cache.get_wrapper();
self.wrap_object_shared(cx, scope);
@@ -33,8 +33,8 @@ impl CacheableWrapper for Event_ {

impl BindingObject for Event_ {
fn GetParentObject(&self, cx: *JSContext) -> @mut CacheableWrapper {
let content = task_from_context(cx);
unsafe { (*content).window.get() as @mut CacheableWrapper }
let script_context = task_from_context(cx);
unsafe { (*script_context).window.get() as @mut CacheableWrapper }
}
}

@@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use content::content_task::{task_from_context, global_content};
use dom::bindings::utils::{CacheableWrapper, WrapperCache, BindingObject, DerivedWrapper};
use dom::bindings::codegen::EventTargetBinding;
use dom::bindings::utils::{CacheableWrapper, WrapperCache, BindingObject, DerivedWrapper};
use dom::eventtarget::EventTarget;
use js::jsapi::{JSObject, JSContext, JSVal};
use js::glue::bindgen::RUST_OBJECT_TO_JSVAL;
use js::jsapi::{JSObject, JSContext, JSVal};
use scripting::script_task::{task_from_context, global_script_context};

pub impl EventTarget {
pub fn init_wrapper(@mut self) {
let content = global_content();
let cx = content.compartment.get().cx.ptr;
let owner = content.window.get();
let script_context = global_script_context();
let cx = script_context.compartment.get().cx.ptr;
let owner = script_context.window.get();
let cache = owner.get_wrappercache();
let scope = cache.get_wrapper();
self.wrap_object_shared(cx, scope);
@@ -33,8 +33,8 @@ impl CacheableWrapper for EventTarget {

impl BindingObject for EventTarget {
fn GetParentObject(&self, cx: *JSContext) -> @mut CacheableWrapper {
let content = task_from_context(cx);
unsafe { (*content).window.get() as @mut CacheableWrapper }
let script_context = task_from_context(cx);
unsafe { (*script_context).window.get() as @mut CacheableWrapper }
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.