Bug 183326

Summary: CoordinatedGraphicsScene: properly limit data specific to state commit operation
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, svillar, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Zan Dobersek 2018-03-05 02:41:13 PST
CoordinatedGraphicsScene: properly limit data specific to state commit operation
Comment 1 Zan Dobersek 2018-03-05 02:47:28 PST
Created attachment 334993 [details]
Patch
Comment 2 Sergio Villar Senin 2018-03-06 01:05:44 PST
Comment on attachment 334993 [details]
Patch

Why not using a RAII approach? CommitScope could be a class and the cleanups could be done in the destructor which would be called once the variable gets out of scope.
Comment 3 Zan Dobersek 2018-03-06 03:32:24 PST
(In reply to Sergio Villar Senin from comment #2)
> Comment on attachment 334993 [details]
> Patch
> 
> Why not using a RAII approach? CommitScope could be a class and the cleanups
> could be done in the destructor which would be called once the variable gets
> out of scope.

Structs are same as classes, just the default member accessibility is public.

As such, the default destructor ivokes destructors of both containers, effectively cleaning up every object that's been stored there during the state commit op.
Comment 4 Zan Dobersek 2018-03-06 03:34:22 PST
Comment on attachment 334993 [details]
Patch

Clearing flags on attachment: 334993

Committed r229315: <https://trac.webkit.org/changeset/229315>
Comment 5 Zan Dobersek 2018-03-06 03:34:26 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2018-03-06 03:35:31 PST
<rdar://problem/38174962>
Comment 7 Sergio Villar Senin 2018-03-06 03:42:38 PST
(In reply to Zan Dobersek from comment #3)
> (In reply to Sergio Villar Senin from comment #2)
> > Comment on attachment 334993 [details]
> > Patch
> > 
> > Why not using a RAII approach? CommitScope could be a class and the cleanups
> > could be done in the destructor which would be called once the variable gets
> > out of scope.
> 
> Structs are same as classes, just the default member accessibility is public.
> 
> As such, the default destructor ivokes destructors of both containers,
> effectively cleaning up every object that's been stored there during the
> state commit op.

Not sure if you're getting my point, what I wanted is to get rid of the explicit .clear()
Comment 8 Zan Dobersek 2018-03-06 04:13:07 PST
(In reply to Sergio Villar Senin from comment #7)
> (In reply to Zan Dobersek from comment #3)
> > (In reply to Sergio Villar Senin from comment #2)
> > > Comment on attachment 334993 [details]
> > > Patch
> > > 
> > > Why not using a RAII approach? CommitScope could be a class and the cleanups
> > > could be done in the destructor which would be called once the variable gets
> > > out of scope.
> > 
> > Structs are same as classes, just the default member accessibility is public.
> > 
> > As such, the default destructor ivokes destructors of both containers,
> > effectively cleaning up every object that's been stored there during the
> > state commit op.
> 
> Not sure if you're getting my point, what I wanted is to get rid of the
> explicit .clear()

Right, it's not necessary for those to be explicitly called, I'll remove them.