Bug 86488

Summary: Web Inspector: use separate fields for storing HeapSnapshotLoaderProxy and HeapSnapshotProxy
Product: WebKit Reporter: Yury Semikhatsky <yurys>
Component: Web Inspector (Deprecated)Assignee: Yury Semikhatsky <yurys>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch pfeldman: review+

Description Yury Semikhatsky 2012-05-15 08:27:12 PDT
Heap snapshot may be in 3 states: not loaded, loading and loaded. At the present time there is HeapProfileHeader._proxy field which may be either HeapSnapshotLoaderProxy or HeapSnapshotProxy which complicates the code a lot.
Comment 1 Yury Semikhatsky 2012-05-15 08:33:24 PDT
Created attachment 141976 [details]
Patch
Comment 2 Yury Semikhatsky 2012-05-15 08:34:26 PDT
Created attachment 141977 [details]
Patch
Comment 3 Yury Semikhatsky 2012-05-15 08:36:42 PDT
Created attachment 141978 [details]
Patch
Comment 4 Yury Semikhatsky 2012-05-15 08:38:35 PDT
Created attachment 141979 [details]
Patch
Comment 5 Ilya Tikhonovsky 2012-05-15 09:07:42 PDT
View in context: https://bugs.webkit.org/attachment.cgi?id=141978&action=review

> Source/WebCore/inspector/front-end/HeapSnapshotView.js:530
>              this.baseSelectElement.removeStyleClass("hidden");
>              if (!this.dataGrid.snapshotView) {
>                  this._changeBase();
> -                this.dataGrid.setDataSource(this, this.profileWrapper);
> +                var snapshotProxy = this.profile.snapshotProxy();
> +                // If snapshot has not been loaded yet the data source will be set by the initial load
> +                // callback(called in HeapSnapshotView constructor)
> +                if (snapshotProxy)
> +                    this.dataGrid.setDataSource(this, snapshotProxy);
>              }
>          } else {
>              this.baseSelectElement.addStyleClass("hidden");
> -            if (!this.dataGrid.snapshotView)
> -                this.dataGrid.setDataSource(this, this.profileWrapper);
> +            if (!this.dataGrid.snapshotView) {
> +                var snapshotProxy = this.profile.snapshotProxy();
> +                // If snapshot has not been loaded yet the data source will be set by the initial load
> +                // callback(called in HeapSnapshotView constructor)
> +                if (snapshotProxy)
> +                    this.dataGrid.setDataSource(this, snapshotProxy);
> +            }
>          }

looks weird

> Source/WebCore/inspector/front-end/HeapSnapshotView.js:833
> +            ProfilerAgent.getProfile(this.typeId, this.uid, function() {});

please remove empty callback.
Comment 6 Yury Semikhatsky 2012-05-16 01:32:09 PDT
Created attachment 142189 [details]
Patch
Comment 7 Yury Semikhatsky 2012-05-16 01:32:38 PDT
(In reply to comment #5)
> View in context: https://bugs.webkit.org/attachment.cgi?id=141978&action=review
> 
> > Source/WebCore/inspector/front-end/HeapSnapshotView.js:530
> >              this.baseSelectElement.removeStyleClass("hidden");
> >              if (!this.dataGrid.snapshotView) {
> >                  this._changeBase();
> > -                this.dataGrid.setDataSource(this, this.profileWrapper);
> > +                var snapshotProxy = this.profile.snapshotProxy();
> > +                // If snapshot has not been loaded yet the data source will be set by the initial load
> > +                // callback(called in HeapSnapshotView constructor)
> > +                if (snapshotProxy)
> > +                    this.dataGrid.setDataSource(this, snapshotProxy);
> >              }
> >          } else {
> >              this.baseSelectElement.addStyleClass("hidden");
> > -            if (!this.dataGrid.snapshotView)
> > -                this.dataGrid.setDataSource(this, this.profileWrapper);
> > +            if (!this.dataGrid.snapshotView) {
> > +                var snapshotProxy = this.profile.snapshotProxy();
> > +                // If snapshot has not been loaded yet the data source will be set by the initial load
> > +                // callback(called in HeapSnapshotView constructor)
> > +                if (snapshotProxy)
> > +                    this.dataGrid.setDataSource(this, snapshotProxy);
> > +            }
> >          }
> 
> looks weird
> 
Fixed.

> > Source/WebCore/inspector/front-end/HeapSnapshotView.js:833
> > +            ProfilerAgent.getProfile(this.typeId, this.uid, function() {});
> 
> please remove empty callback.
Done.
Comment 8 Ilya Tikhonovsky 2012-05-16 01:39:27 PDT
Comment on attachment 142189 [details]
Patch

lgtm
Comment 9 Yury Semikhatsky 2012-05-16 01:47:19 PDT
Committed r117234: <http://trac.webkit.org/changeset/117234>