mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Move profiler code from util
into a new crate profile
.
- Most of util::memory has been moved into profile::mem, though the `SizeOf` trait and related things remain in util::memory. The `SystemMemoryReporter` code is now in a submodule profile::mem::system_reporter. - util::time has been moved entirely into profile::time.
This commit is contained in:
parent
cad58b3bec
commit
52447ccd9b
36 changed files with 850 additions and 726 deletions
|
@ -22,6 +22,9 @@ path = "../msg"
|
|||
[dependencies.net]
|
||||
path = "../net"
|
||||
|
||||
[dependencies.profile]
|
||||
path = "../profile"
|
||||
|
||||
[dependencies.util]
|
||||
path = "../util"
|
||||
|
||||
|
@ -52,4 +55,4 @@ git = "https://github.com/servo/gleam"
|
|||
[dependencies]
|
||||
url = "0.2.16"
|
||||
time = "0.1.17"
|
||||
libc = "*"
|
||||
libc = "*"
|
||||
|
|
|
@ -11,8 +11,6 @@ use scrolling::ScrollingTimerProxy;
|
|||
use windowing;
|
||||
use windowing::{MouseWindowEvent, WindowEvent, WindowMethods, WindowNavigateMsg};
|
||||
|
||||
use std::cmp;
|
||||
use std::mem;
|
||||
use geom::point::{Point2D, TypedPoint2D};
|
||||
use geom::rect::{Rect, TypedRect};
|
||||
use geom::size::{Size2D, TypedSize2D};
|
||||
|
@ -35,20 +33,23 @@ use msg::constellation_msg::{ConstellationChan, NavigationDirection};
|
|||
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
|
||||
use msg::constellation_msg::{PipelineId, WindowSizeData};
|
||||
use util::geometry::{PagePx, ScreenPx, ViewportPx};
|
||||
use util::memory::MemoryProfilerChan;
|
||||
use util::opts;
|
||||
use util::time::{TimeProfilerCategory, profile, TimeProfilerChan};
|
||||
use util::{memory, time};
|
||||
use profile::mem;
|
||||
use profile::mem::{MemoryProfilerChan};
|
||||
use profile::time;
|
||||
use profile::time::{TimeProfilerCategory, profile, TimeProfilerChan};
|
||||
use std::cmp;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||
use std::old_path::Path;
|
||||
use std::mem::replace;
|
||||
use std::num::Float;
|
||||
use std::rc::Rc;
|
||||
use std::slice::bytes::copy_memory;
|
||||
use std::sync::mpsc::Sender;
|
||||
use time::{precise_time_ns, precise_time_s};
|
||||
use url::Url;
|
||||
use util::geometry::{PagePx, ScreenPx, ViewportPx};
|
||||
use util::opts;
|
||||
|
||||
/// NB: Never block on the constellation, because sometimes the constellation blocks on us.
|
||||
pub struct IOCompositor<Window: WindowMethods> {
|
||||
|
@ -869,7 +870,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
|
||||
fn process_pending_scroll_events(&mut self) {
|
||||
let had_scroll_events = self.pending_scroll_events.len() > 0;
|
||||
for scroll_event in mem::replace(&mut self.pending_scroll_events, Vec::new()).into_iter() {
|
||||
for scroll_event in replace(&mut self.pending_scroll_events, Vec::new()).into_iter() {
|
||||
let delta = scroll_event.delta / self.scene.scale;
|
||||
let cursor = scroll_event.cursor.as_f32() / self.scene.scale;
|
||||
|
||||
|
@ -1356,7 +1357,7 @@ impl<Window> CompositorEventListener for IOCompositor<Window> where Window: Wind
|
|||
|
||||
// Tell the profiler, memory profiler, and scrolling timer to shut down.
|
||||
self.time_profiler_chan.send(time::TimeProfilerMsg::Exit);
|
||||
self.memory_profiler_chan.send(memory::MemoryProfilerMsg::Exit);
|
||||
self.memory_profiler_chan.send(mem::MemoryProfilerMsg::Exit);
|
||||
self.scrolling_timer.shutdown();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ use msg::compositor_msg::{Epoch, LayerId, LayerMetadata, ReadyState};
|
|||
use msg::compositor_msg::{PaintListener, PaintState, ScriptListener, ScrollPolicy};
|
||||
use msg::constellation_msg::{ConstellationChan, PipelineId};
|
||||
use msg::constellation_msg::{Key, KeyState, KeyModifiers};
|
||||
use url::Url;
|
||||
use util::cursor::Cursor;
|
||||
use util::memory::MemoryProfilerChan;
|
||||
use util::time::TimeProfilerChan;
|
||||
use profile::mem::MemoryProfilerChan;
|
||||
use profile::time::TimeProfilerChan;
|
||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
||||
use std::fmt::{Error, Formatter, Debug};
|
||||
use std::rc::Rc;
|
||||
use url::Url;
|
||||
use util::cursor::Cursor;
|
||||
|
||||
/// Sends messages to the compositor. This is a trait supplied by the port because the method used
|
||||
/// to communicate with the compositor may have to kick OS event loops awake, communicate cross-
|
||||
|
|
|
@ -25,12 +25,12 @@ use msg::constellation_msg::Msg as ConstellationMsg;
|
|||
use net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
|
||||
use net::resource_task::{self, ResourceTask};
|
||||
use net::storage_task::{StorageTask, StorageTaskMsg};
|
||||
use profile::mem::MemoryProfilerChan;
|
||||
use profile::time::TimeProfilerChan;
|
||||
use util::cursor::Cursor;
|
||||
use util::geometry::PagePx;
|
||||
use util::memory::MemoryProfilerChan;
|
||||
use util::opts;
|
||||
use util::task::spawn_named;
|
||||
use util::time::TimeProfilerChan;
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::HashMap;
|
||||
use std::old_io as io;
|
||||
|
|
|
@ -9,10 +9,10 @@ use geom::scale_factor::ScaleFactor;
|
|||
use geom::size::TypedSize2D;
|
||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||
use msg::constellation_msg::{ConstellationChan, WindowSizeData};
|
||||
use util::memory::MemoryProfilerChan;
|
||||
use util::memory;
|
||||
use util::time::TimeProfilerChan;
|
||||
use util::time;
|
||||
use profile::mem;
|
||||
use profile::mem::MemoryProfilerChan;
|
||||
use profile::time;
|
||||
use profile::time::TimeProfilerChan;
|
||||
|
||||
/// Starts the compositor, which listens for messages on the specified port.
|
||||
///
|
||||
|
@ -121,7 +121,7 @@ impl CompositorEventListener for NullCompositor {
|
|||
while self.port.try_recv_compositor_msg().is_some() {}
|
||||
|
||||
self.time_profiler_chan.send(time::TimeProfilerMsg::Exit);
|
||||
self.memory_profiler_chan.send(memory::MemoryProfilerMsg::Exit);
|
||||
self.memory_profiler_chan.send(mem::MemoryProfilerMsg::Exit);
|
||||
}
|
||||
|
||||
fn pinch_zoom_level(&self) -> f32 {
|
||||
|
|
|
@ -23,6 +23,7 @@ extern crate png;
|
|||
extern crate script_traits;
|
||||
extern crate msg;
|
||||
extern crate net;
|
||||
extern crate profile;
|
||||
#[macro_use]
|
||||
extern crate util;
|
||||
extern crate gleam;
|
||||
|
|
|
@ -19,11 +19,11 @@ use msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType};
|
|||
use net::image_cache_task::ImageCacheTask;
|
||||
use net::resource_task::ResourceTask;
|
||||
use net::storage_task::StorageTask;
|
||||
use profile::mem::MemoryProfilerChan;
|
||||
use profile::time::TimeProfilerChan;
|
||||
use std::sync::mpsc::{Receiver, channel};
|
||||
use url::Url;
|
||||
use util::geometry::{PagePx, ViewportPx};
|
||||
use util::memory::MemoryProfilerChan;
|
||||
use util::time::TimeProfilerChan;
|
||||
use std::sync::mpsc::{Receiver, channel};
|
||||
|
||||
/// A uniquely-identifiable pipeline of script task, layout task, and paint task.
|
||||
pub struct Pipeline {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue