WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
31699
Web Inspector: Should Cache Values of InspectorController.platform() and port
https://bugs.webkit.org/show_bug.cgi?id=31699
Summary
Web Inspector: Should Cache Values of InspectorController.platform() and port
Brian Weinstein
Reported
2009-11-19 18:58:02 PST
These functions have to call into C++, they are being used more and more (keyboard shortcuts need to call it), and the values shouldn't change.
Attachments
[PATCH] Fix
(7.06 KB, patch)
2009-11-19 18:59 PST
,
Brian Weinstein
bweinstein
: commit-queue-
Details
Formatted Diff
Diff
[PATCH] Use getters instead of WebInspector.function
(7.02 KB, patch)
2009-11-19 19:10 PST
,
Brian Weinstein
timothy
: review+
bweinstein
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Brian Weinstein
Comment 1
2009-11-19 18:59:48 PST
Created
attachment 43539
[details]
[PATCH] Fix
Brian Weinstein
Comment 2
2009-11-19 19:10:50 PST
Created
attachment 43540
[details]
[PATCH] Use getters instead of WebInspector.function
Timothy Hatcher
Comment 3
2009-11-19 20:36:25 PST
Comment on
attachment 43540
[details]
[PATCH] Use getters instead of WebInspector.function
> + if (!this._platform)
A better idiom we use is: if (!("_platform" in this)) It is semi faster. It only checks if the property exists, not the value.
> + if (!this._port)
Ditto.
Pavel Feldman
Comment 4
2009-11-19 21:49:42 PST
Given that we are 100% sure platform and port are needed for rendering, it does not really make sense to load them lazily. I'd rather push them into the frontend as soon as script object for it is available. Furthermore, I think we should do the same to inspector settings. Generic approach would be to create Preferences object (the one from inspector.js or its override) in InspectorController and push it into the frontend from within InspectorController::scriptObjectReady.
Patrick Mueller
Comment 5
2009-11-20 04:03:21 PST
(In reply to
comment #4
)
> I think we > should do the same to inspector settings. Generic approach would be to create > Preferences object (the one from inspector.js or its override) in > InspectorController and push it into the frontend from within > InspectorController::scriptObjectReady.
I didn't realize we already had a Preferences object; sounds like a good place to put the pre-load of the settings from InspectorController. Do we create a method per setting, or two - a getter and setter - or a generic getter and setter? Even though it gets busy, I like having method-per-setting, because then it's easy to figure out what all the possible settings actually are.
Pavel Feldman
Comment 6
2009-11-20 04:55:37 PST
(In reply to
comment #5
)
> (In reply to
comment #4
) > > I think we > > should do the same to inspector settings. Generic approach would be to create > > Preferences object (the one from inspector.js or its override) in > > InspectorController and push it into the frontend from within > > InspectorController::scriptObjectReady. > > I didn't realize we already had a Preferences object; sounds like a good place > to put the pre-load of the settings from InspectorController. Do we create a > method per setting, or two - a getter and setter - or a generic getter and > setter? > > Even though it gets busy, I like having method-per-setting, because then it's > easy to figure out what all the possible settings actually are.
I think we should have named settings with shared getter and single setter in order not to bloat cache-related code. We could have constants for names of the known settings to address your argument.
Brian Weinstein
Comment 7
2009-11-20 10:32:50 PST
(In reply to
comment #4
)
> Given that we are 100% sure platform and port are needed for rendering, it does > not really make sense to load them lazily. I'd rather push them into the > frontend as soon as script object for it is available. Furthermore, I think we > should do the same to inspector settings. Generic approach would be to create > Preferences object (the one from inspector.js or its override) in > InspectorController and push it into the frontend from within > InspectorController::scriptObjectReady.
I'm going to land this optimization in the patch, because it will clean up code a good amount, but if we want to figure out future optimizations (like not loading this lazily), we can do that in the future.
Brian Weinstein
Comment 8
2009-11-20 10:43:24 PST
Landed in
r51242
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug