Bug 24524 - Introduce ScriptFunctionCall and ScriptObject abstractions
Summary: Introduce ScriptFunctionCall and ScriptObject abstractions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Dimitri Glazkov (Google)
URL:
Keywords:
Depends on:
Blocks: 24590 24623 24989
  Show dependency treegraph
 
Reported: 2009-03-11 15:24 PDT by Dimitri Glazkov (Google)
Modified: 2009-03-13 14:32 PDT (History)
2 users (show)

See Also:


Attachments
Introduce ScriptObject and ScriptFunctionCall abstractions, v1. (37.28 KB, text/plain)
2009-03-11 15:30 PDT, Dimitri Glazkov (Google)
no flags Details
Introduce ScriptObject and ScriptFunctionCall abstractions, v2. (37.03 KB, patch)
2009-03-12 10:35 PDT, Dimitri Glazkov (Google)
no flags Details | Formatted Diff | Diff
Introduce ScriptObject and ScriptFunctionCall abstractions, v2.1. (37.41 KB, patch)
2009-03-13 10:37 PDT, Dimitri Glazkov (Google)
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitri Glazkov (Google) 2009-03-11 15:24:51 PDT
The reason for this change is two-fold:

1) Unfork Inspector controller by reducing and eventually removing JSC-specific code using lightweight abstractions.

2) Refactor InspectorController to reduce its complexity

I intentionally limited the scope of the change to InspectorDatabaseResource, because it seemed like a good starting point.
Comment 1 Dimitri Glazkov (Google) 2009-03-11 15:30:06 PDT
Created attachment 28496 [details]
Introduce ScriptObject and ScriptFunctionCall abstractions, v1.

 WebCore/ChangeLog                               |   29 ++++++
 WebCore/GNUmakefile.am                          |    5 +
 WebCore/WebCore.pro                             |    2 +
 WebCore/WebCore.vcproj/WebCore.vcproj           |   20 ++++
 WebCore/WebCore.xcodeproj/project.pbxproj       |   20 ++++
 WebCore/WebCoreSources.bkl                      |    2 +
 WebCore/bindings/js/ScriptFunctionCall.cpp      |  122 +++++++++++++++++++++++
 WebCore/bindings/js/ScriptFunctionCall.h        |   63 ++++++++++++
 WebCore/bindings/js/ScriptObject.cpp            |   63 ++++++++++++
 WebCore/bindings/js/ScriptObject.h              |   57 +++++++++++
 WebCore/bindings/js/ScriptObjectQuarantine.h    |   62 ++++++++++++
 WebCore/inspector/InspectorController.cpp       |   87 +---------------
 WebCore/inspector/InspectorController.h         |    4 -
 WebCore/inspector/InspectorDatabaseResource.cpp |   53 +++++++---
 WebCore/inspector/InspectorDatabaseResource.h   |   18 ++--
 15 files changed, 496 insertions(+), 111 deletions(-)
Comment 2 Sam Weinig 2009-03-11 15:44:07 PDT
Why does ScriptObject contain an ExecState?
Comment 3 Dimitri Glazkov (Google) 2009-03-11 15:46:42 PDT
(In reply to comment #2)
> Why does ScriptObject contain an ExecState?
> 

I struggled with this and open to ideas. Current InspectorController holds on to both ContextRef and ObjectRef, and it seemed really appealing to keep them coupled in one object.

But I understand that if we view ScriptObject as a more general abstraction, it seems less logical.

I am very open to ideas here.
Comment 4 Dimitri Glazkov (Google) 2009-03-11 16:00:42 PDT
Comment on attachment 28496 [details]
Introduce ScriptObject and ScriptFunctionCall abstractions, v1.

Taking this out of review queue and marking obsolete. weinig schooled me and I am now on the right path.
Comment 5 Dimitri Glazkov (Google) 2009-03-12 10:35:14 PDT
Created attachment 28533 [details]
Introduce ScriptObject and ScriptFunctionCall abstractions, v2.

 WebCore/ChangeLog                               |   29 ++++++
 WebCore/GNUmakefile.am                          |    5 +
 WebCore/WebCore.pro                             |    2 +
 WebCore/WebCore.vcproj/WebCore.vcproj           |   20 ++++
 WebCore/WebCore.xcodeproj/project.pbxproj       |   20 ++++
 WebCore/WebCoreSources.bkl                      |    2 +
 WebCore/bindings/js/ScriptFunctionCall.cpp      |  121 +++++++++++++++++++++++
 WebCore/bindings/js/ScriptFunctionCall.h        |   64 ++++++++++++
 WebCore/bindings/js/ScriptObject.cpp            |   43 ++++++++
 WebCore/bindings/js/ScriptObject.h              |   52 ++++++++++
 WebCore/bindings/js/ScriptObjectQuarantine.h    |   62 ++++++++++++
 WebCore/inspector/InspectorController.cpp       |   87 +----------------
 WebCore/inspector/InspectorController.h         |    4 -
 WebCore/inspector/InspectorDatabaseResource.cpp |   54 +++++++---
 WebCore/inspector/InspectorDatabaseResource.h   |   19 ++--
 15 files changed, 473 insertions(+), 111 deletions(-)
Comment 6 Dimitri Glazkov (Google) 2009-03-12 10:38:18 PDT
Sam, what do you think? Did I learn my ABCs? :)
Comment 7 Dimitri Glazkov (Google) 2009-03-13 10:37:27 PDT
Created attachment 28584 [details]
Introduce ScriptObject and ScriptFunctionCall abstractions, v2.1.

 WebCore/ChangeLog                               |   29 ++++++
 WebCore/GNUmakefile.am                          |    5 +
 WebCore/WebCore.pro                             |    2 +
 WebCore/WebCore.vcproj/WebCore.vcproj           |   20 ++++
 WebCore/WebCore.xcodeproj/project.pbxproj       |   20 ++++
 WebCore/WebCoreSources.bkl                      |    2 +
 WebCore/bindings/js/ScriptFunctionCall.cpp      |  121 +++++++++++++++++++++++
 WebCore/bindings/js/ScriptFunctionCall.h        |   64 ++++++++++++
 WebCore/bindings/js/ScriptObject.cpp            |   43 ++++++++
 WebCore/bindings/js/ScriptObject.h              |   50 +++++++++
 WebCore/bindings/js/ScriptObjectQuarantine.h    |   62 ++++++++++++
 WebCore/bindings/js/ScriptValue.h               |    1 +
 WebCore/inspector/InspectorController.cpp       |   87 +----------------
 WebCore/inspector/InspectorController.h         |    4 -
 WebCore/inspector/InspectorDatabaseResource.cpp |   54 +++++++---
 WebCore/inspector/InspectorDatabaseResource.h   |   19 ++--
 16 files changed, 472 insertions(+), 111 deletions(-)
Comment 8 Dimitri Glazkov (Google) 2009-03-13 10:45:02 PDT
New patch up, addressing some of the comments on IRC:

* ScriptObject now inherits from ScriptValue. Pretty.
* I thought about changing "bind/unbind" method names, but couldn't come up with anything that's not verbose. I am open to ideas here, but I think this is pretty intuitive already.
* Going away from JSC API. I understand the dogfoodiness aspect of it, and I appreciate the desire. In fact, my using bindings functions was merely an attempt to homogenize the code base, not a direct desire to get rid of it.

So, here's my idea: perhaps we could convert all Script* objects to use JSC API? This could be a nice little GSoC project? :)
Comment 9 Timothy Hatcher 2009-03-13 13:49:38 PDT
Comment on attachment 28584 [details]
Introduce ScriptObject and ScriptFunctionCall abstractions, v2.1.

Looks good, only two comments.

Don't indent the functions in the .cpp files inside the namespace block.

And getQuarantinedScriptObject seems a little large to be an inline function, so that should likely have a .cpp file to contain the implementation.
Comment 10 Dimitri Glazkov (Google) 2009-03-13 14:32:03 PDT
Comments addressed, landed as http://trac.webkit.org/changeset/41684.