Skip to content

Add Wrench to WebRender #585

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

Merged
merged 2 commits into from
Nov 29, 2016
Merged

Add Wrench to WebRender #585

merged 2 commits into from
Nov 29, 2016

Conversation

vvuk
Copy link
Contributor

@vvuk vvuk commented Nov 22, 2016

This moves Wrench to WebRender. It can now replay binary recordings (replaces the wr-replay tool, though I haven't removed that one), show frames from YAML, and write YAML while replaying a binary recording. The YAML stuff is very much WIP, but what's there works and can be built on top of.


This change is Reviewable

Copy link
Member

@glennw glennw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, otherwise r=me

]

[profile.release]
debug = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this have any effect on runtime performance? Should we just enable it when profiling?

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got a few questions/comments, otherwise looks good!

panic!("Can't layout simple ascii on this platform");
}

pub trait WrenchThing {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd call it Player


impl WrenchThing for BinaryFrameReader {
fn do_frame(&mut self, wrench: &mut Wrench) -> u32 {
if self.do_frame(wrench) == false {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we check for frame_num == 0 here as well?

use webrender_traits::*;

mod wrench;
use wrench::{Wrench, WrenchThing};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is against rust style guidelines, where you are supposed to have all the use to follow all the mod things

static ref BLACK_COLOR: ColorF = ColorF::new(0.0, 0.0, 0.0, 1.0);
}

pub static mut CURRENT_FRAME_NUMBER: u32 = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this getting used? I only see assignment.


pub static mut CURRENT_FRAME_NUMBER: u32 = 0;

enum ThingKind {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, I wish it had a more descriptive name, like FrameSource

}

pub struct Wrench {
pub window: glutin::Window,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it all have to be public?
I know this is not much important, given that it's not a used API but just a tool
wondering just out of interest

.build().unwrap();

unsafe {
window.make_current().ok();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be using unwrap() here, because ok() will not crash, and our behavior would be undefined later on

}

let gl_version = unsafe {
let data = CStr::from_ptr(gl::GetString(gl::VERSION) as *const _).to_bytes().to_vec();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can borrow some ideas from #584

}

fn handle_rect(&self, wrench: &mut Wrench, clip_region: &ClipRegion, item: &Yaml)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opening bracket - against the code guidelines (sorry to be pedantic!)

}

fn handle_image(&self, wrench: &mut Wrench, clip_region: &ClipRegion, item: &Yaml)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here and for handle_text

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #592) made this pull request unmergeable. Please resolve the merge conflicts.

@glennw
Copy link
Member

glennw commented Nov 28, 2016

@vvuk Happy to merge this when you are ready - let me know when it's good to go.

@glennw
Copy link
Member

glennw commented Nov 29, 2016

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 7be8661 has been approved by glennw

@bors-servo
Copy link
Contributor

⚡ Test exempted - status

@bors-servo bors-servo merged commit 7be8661 into servo:master Nov 29, 2016
bors-servo pushed a commit that referenced this pull request Nov 29, 2016
Add Wrench to WebRender

This moves Wrench to WebRender.  It can now replay binary recordings (replaces the wr-replay tool, though I haven't removed that one), show frames from YAML, and write YAML while replaying a binary recording.  The YAML stuff is very much WIP, but what's there works and can be built on top of.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/585)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants