Bug 105438 - Web Inspector: Provide an isolated InspectorState instance rather than the shared one for each Agent
Summary: Web Inspector: Provide an isolated InspectorState instance rather than the sh...
Status: RESOLVED DUPLICATE of bug 105722
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on: 105723
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-19 08:15 PST by Alexander Pavlov (apavlov)
Modified: 2012-12-28 23:56 PST (History)
9 users (show)

See Also:


Attachments
Patch (4.57 KB, patch)
2012-12-20 06:59 PST, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
Patch (56.46 KB, patch)
2012-12-21 07:13 PST, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
Patch (56.56 KB, patch)
2012-12-21 07:37 PST, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
Patch (56.55 KB, patch)
2012-12-23 23:31 PST, Alexander Pavlov (apavlov)
yurys: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pavlov (apavlov) 2012-12-19 08:15:32 PST
Patch to follow.
Comment 1 Alexander Pavlov (apavlov) 2012-12-20 06:59:37 PST
Created attachment 180336 [details]
Patch
Comment 2 Andrey Kosyakov 2012-12-20 07:08:27 PST
Comment on attachment 180336 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=180336&action=review

> Source/WebCore/inspector/InspectorPageAgent.cpp:-417
> -    if (!scripts) {

Why is this gone?
Comment 3 Alexander Pavlov (apavlov) 2012-12-20 07:12:53 PST
Comment on attachment 180336 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=180336&action=review

>> Source/WebCore/inspector/InspectorPageAgent.cpp:-417
>> -    if (!scripts) {
> 
> Why is this gone?

Please see the changelog entry for this method and getObject() implementation :)
Comment 4 Andrey Kosyakov 2012-12-20 07:30:50 PST
Comment on attachment 180336 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=180336&action=review

>>> Source/WebCore/inspector/InspectorPageAgent.cpp:-417
>>> -    if (!scripts) {
>> 
>> Why is this gone?
> 
> Please see the changelog entry for this method and getObject() implementation :)

Ok, I see. I did not know the fact that getObject() creates object if field is missing. The sad fact is that it sort of counters the effect of remove upon the first check of this property. Looks like we might be better off with replacing a call to remove() with setting the field to an empty object.
Comment 5 Pavel Feldman 2012-12-20 07:39:03 PST
Comment on attachment 180336 [details]
Patch

I'd suggest the following refactoring that would make things even better: structure state so that instead of holding all agents' states in a single flat m_properties map, it would have an object property per agent. The resetting the state of a particular agent would be as simple as resetting its state object (or replacing it with new blank object). Such refactoring would require InspectorController to shard state object and pass individual InspectorState into each of the agents.
Comment 6 Alexander Pavlov (apavlov) 2012-12-21 07:13:15 PST
Created attachment 180516 [details]
Patch
Comment 7 Build Bot 2012-12-21 07:20:34 PST
Comment on attachment 180516 [details]
Patch

Attachment 180516 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/15445493
Comment 8 Alexander Pavlov (apavlov) 2012-12-21 07:37:17 PST
Created attachment 180522 [details]
Patch
Comment 9 Yury Semikhatsky 2012-12-21 08:01:30 PST
Comment on attachment 180522 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=180522&action=review

> Source/WebCore/inspector/InspectorState.cpp:118
> +    InspectorState* result = new InspectorState(this, stateProperties);

This should be OwnPtr<InspectorState> or you can inline this.

> Source/WebCore/inspector/InspectorState.cpp:123
> +void InspectorCompositeState::loadFromCookie(const String& InspectorCompositeStateCookie)

InspectorCompositeStateCookie -> inspectorCompositeStateCookie
Comment 10 Alexander Pavlov (apavlov) 2012-12-23 23:31:05 PST
Created attachment 180649 [details]
Patch
Comment 11 Yury Semikhatsky 2012-12-24 00:31:58 PST
Comment on attachment 180649 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=180649&action=review

> Source/WebCore/ChangeLog:3
> +        Web Inspector: Make use of the new InspectorState::remove() in inspector agents

The main part of this change is about introduction of a composite state that allows to avoid name collisions, we should probably rename the bug.
Comment 12 Alexander Pavlov (apavlov) 2012-12-24 00:50:06 PST
The change in its current variation allows to get rid of agent-specific prefix hacks for state property names.
Comment 13 Alexander Pavlov (apavlov) 2012-12-24 01:08:44 PST
Committed r138436: <http://trac.webkit.org/changeset/138436>
Comment 14 WebKit Review Bot 2012-12-24 08:41:16 PST
Re-opened since this is blocked by bug 105723
Comment 15 Alexander Pavlov (apavlov) 2012-12-28 23:56:25 PST
Re-implemented in bug 105722.

*** This bug has been marked as a duplicate of bug 105722 ***