On Wednesday, March 21, 2018 at 6:17:25 PM UTC-4, Josh Bowman-Matthews wrote:
> On 3/21/18 5:54 PM, Praneet Mocherla wrote:
> > On Wednesday, March 21, 2018 at 5:30:36 PM UTC-4, Josh Bowman-Matthews 
> > wrote:
> >> On 3/21/18 4:43 PM, Praneet Mocherla wrote:
> >>> Hi all,
> >>>
> >>> Brody and I are working on the canvas rendering project: 
> >>> https://github.com/servo/servo/wiki/Canvas-rendering-project
> >>>
> >>> We've been working on this for a couple of days, and it's our first time 
> >>> contributing to an open source project. We are currently stuck at this 
> >>> initial step:
> >>>
> >>> "make the response_sender argument of handle_create_canvas_paint_thread 
> >>> also include the new CanvasId value, and pass it as an argument to 
> >>> CanvasPaintThread::start. Store the id when it is received for use in all 
> >>> canvas messages"
> >>>
> >>> We're confused on how to associate the response sender with the CanvasId. 
> >>> Any help would be appreciated!
> >>>
> >>> Thanks,
> >>> Praneet and Brody
> >>>
> >>
> >> Welcome! A sender has a type T associated with it, so it looks like
> >> Sender<T> (or IpcSender<T>). This means you'll see something like
> >> Sender<Whatever>; but T can also be a tuple like (SomeType,
> >> AnotherType). I would recommend turning it into a Sender<(CanvasId,
> >> Whatever)> so that all users will have to send a CanvasId value along
> >> with the existing value.
> >>
> >> Cheers,
> >> Josh
> > 
> > Thanks for the quick reply! How do we make sure that each user gets a 
> > particular CanvasId? In other words, how do we make the layout get the 
> > CanvasId from an html fragment and how does CanvasRenderingContext2D get 
> > the id from starting the thread?
> > 
> > We've also added the CanvasId to each member of the enum. We are able to 
> > generate the CanvasId in the constellation while starting threads and we 
> > are able to use the CanvasId whenever we're making/decoding canvas messages.
> > 
> 
> The sender that handle_create_canvas_paint_thread_msg accepts is an 
> IpcSender<IpcSender<CanvasMsg>>. The code that initially kicks off the 
> canvas creation is sitting waiting on a response from the outer sender, 
> which is provide it with a sender communicate with the new thread. This 
> means that we can modify the outer sender to also include the new ID 
> that is generated, so the creator receives both the ID and the new 
> sender at the same. Does that make sense?
> 
> As for the layout, you can add an API to LayoutHTMLCanvasElementHelpers 
> that returns the stored ID value from a field of HTMLCanvasElement.
> 
> Cheers,
> Josh

We seemed to have figured out all f the initial steps. We made a pull request! 
Here it is: https://github.com/servo/servo/pull/20447.
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to