mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Switch most crates to the 2018 edition
This commit is contained in:
parent
76e59a46d3
commit
9f9bf8f6bc
57 changed files with 82 additions and 28 deletions
|
@ -321,9 +321,8 @@ impl AudioBufferMethods for AudioBuffer {
|
|||
typedarray!(in(cx) let js_channel: Float32Array = js_channel);
|
||||
if let Ok(mut js_channel) = js_channel {
|
||||
let bytes_to_copy = min(self.length - start_in_channel, source.len() as u32) as usize;
|
||||
let mut js_channel_data = unsafe { js_channel.as_mut_slice() };
|
||||
let (_, mut js_channel_data) =
|
||||
js_channel_data.split_at_mut(start_in_channel as usize);
|
||||
let js_channel_data = unsafe { js_channel.as_mut_slice() };
|
||||
let (_, js_channel_data) = js_channel_data.split_at_mut(start_in_channel as usize);
|
||||
unsafe {
|
||||
js_channel_data[0..bytes_to_copy].copy_from_slice(&source.as_slice()[0..bytes_to_copy])
|
||||
};
|
||||
|
|
|
@ -5686,7 +5686,11 @@ class CGInterfaceTrait(CGThing):
|
|||
yield name, arguments, rettype
|
||||
|
||||
def fmt(arguments):
|
||||
return "".join(", %s: %s" % argument for argument in arguments)
|
||||
keywords = {"async"}
|
||||
return "".join(
|
||||
", %s: %s" % (name if name not in keywords else "r#" + name, type_)
|
||||
for name, type_ in arguments
|
||||
)
|
||||
|
||||
def contains_unsafe_arg(arguments):
|
||||
if not arguments or len(arguments) == 0:
|
||||
|
@ -6250,7 +6254,7 @@ class CGDictionary(CGThing):
|
|||
d = self.dictionary
|
||||
if d.parent:
|
||||
initParent = ("{\n"
|
||||
" match try!(%s::%s::new(cx, val)) {\n"
|
||||
" match r#try!(%s::%s::new(cx, val)) {\n"
|
||||
" ConversionResult::Success(v) => v,\n"
|
||||
" ConversionResult::Failure(error) => {\n"
|
||||
" throw_type_error(cx, &error);\n"
|
||||
|
@ -6396,7 +6400,7 @@ class CGDictionary(CGThing):
|
|||
conversion = (
|
||||
"{\n"
|
||||
" rooted!(in(cx) let mut rval = UndefinedValue());\n"
|
||||
" match try!(get_dictionary_property(cx, object.handle(), \"%s\", rval.handle_mut())) {\n"
|
||||
" match r#try!(get_dictionary_property(cx, object.handle(), \"%s\", rval.handle_mut())) {\n"
|
||||
" true => {\n"
|
||||
"%s\n"
|
||||
" },\n"
|
||||
|
@ -7167,7 +7171,7 @@ class CallbackOperationBase(CallbackMethod):
|
|||
"methodName": self.methodName
|
||||
}
|
||||
getCallableFromProp = string.Template(
|
||||
'try!(self.parent.get_callable_property(cx, "${methodName}"))'
|
||||
'r#try!(self.parent.get_callable_property(cx, "${methodName}"))'
|
||||
).substitute(replacements)
|
||||
if not self.singleOperation:
|
||||
return 'rooted!(in(cx) let callable =\n' + getCallableFromProp + ');\n'
|
||||
|
|
|
@ -53,7 +53,7 @@ use js::rust::wrappers::Evaluate2;
|
|||
use libc;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use net_traits::{CoreResourceThread, ResourceThreads, IpcSend};
|
||||
use profile_traits::{mem, time};
|
||||
use profile_traits::{mem as profile_mem, time as profile_time};
|
||||
use script_traits::{MsDuration, ScriptToConstellationChan, TimerEvent};
|
||||
use script_traits::{TimerEventId, TimerSchedulerMsg, TimerSource};
|
||||
use servo_url::{MutableOrigin, ServoUrl};
|
||||
|
@ -97,11 +97,11 @@ pub struct GlobalScope {
|
|||
|
||||
/// For sending messages to the memory profiler.
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
mem_profiler_chan: mem::ProfilerChan,
|
||||
mem_profiler_chan: profile_mem::ProfilerChan,
|
||||
|
||||
/// For sending messages to the time profiler.
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
time_profiler_chan: time::ProfilerChan,
|
||||
time_profiler_chan: profile_time::ProfilerChan,
|
||||
|
||||
/// A handle for communicating messages to the constellation thread.
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
|
@ -160,8 +160,8 @@ impl GlobalScope {
|
|||
pub fn new_inherited(
|
||||
pipeline_id: PipelineId,
|
||||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||
mem_profiler_chan: mem::ProfilerChan,
|
||||
time_profiler_chan: time::ProfilerChan,
|
||||
mem_profiler_chan: profile_mem::ProfilerChan,
|
||||
time_profiler_chan: profile_time::ProfilerChan,
|
||||
script_to_constellation_chan: ScriptToConstellationChan,
|
||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||
resource_threads: ResourceThreads,
|
||||
|
@ -337,12 +337,12 @@ impl GlobalScope {
|
|||
}
|
||||
|
||||
/// Get a sender to the memory profiler thread.
|
||||
pub fn mem_profiler_chan(&self) -> &mem::ProfilerChan {
|
||||
pub fn mem_profiler_chan(&self) -> &profile_mem::ProfilerChan {
|
||||
&self.mem_profiler_chan
|
||||
}
|
||||
|
||||
/// Get a sender to the time profiler thread.
|
||||
pub fn time_profiler_chan(&self) -> &time::ProfilerChan {
|
||||
pub fn time_profiler_chan(&self) -> &profile_time::ProfilerChan {
|
||||
&self.time_profiler_chan
|
||||
}
|
||||
|
||||
|
@ -513,17 +513,17 @@ impl GlobalScope {
|
|||
rval: MutableHandleValue,
|
||||
line_number: u32,
|
||||
) -> bool {
|
||||
let metadata = time::TimerMetadata {
|
||||
let metadata = profile_time::TimerMetadata {
|
||||
url: if filename.is_empty() {
|
||||
self.get_url().as_str().into()
|
||||
} else {
|
||||
filename.into()
|
||||
},
|
||||
iframe: time::TimerMetadataFrameType::RootWindow,
|
||||
incremental: time::TimerMetadataReflowType::FirstReflow,
|
||||
iframe: profile_time::TimerMetadataFrameType::RootWindow,
|
||||
incremental: profile_time::TimerMetadataReflowType::FirstReflow,
|
||||
};
|
||||
time::profile(
|
||||
time::ProfilerCategory::ScriptEvaluate,
|
||||
profile_time::profile(
|
||||
profile_time::ProfilerCategory::ScriptEvaluate,
|
||||
Some(metadata),
|
||||
self.time_profiler_chan().clone(),
|
||||
|| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue