Created attachment 43869 [details]
[DIAGRAM] Proposed design.
This is going to be a large refactoring that would split InspectorBackend into three IDLs: one for the frontend, one for the injected script and one for the frontend host. See diagram attached:
- InspectorController exposes public API and wires others together
- InspectorFrontend determines the interface to the frontend. It is semi-serializes all the calls into JSON-stringifiable objects
- The calls made via InspectorFrontend are dispatched by the WebInspector and delegated to appropriate frontend objects
- InspectorController seeds InspectorBackend.idl-based wrapper into the fron-end
- InspectorController global object gets renamed to InspectorBackend in the front-end
- InspectorController seeds another InjectedScriptHost.idl-based wrapper into the InjectedScript context. This idl has methods that are used from within injected script only. Most of them are IDL [Custom] since they operate Nodes, Databases, etc. (this is new)
- InspectorController seeds yet another InspectorFrontendHost.idl-based wrapper into the front-end that has methods not related to inspected page, but that are going straight to the inspector client (attach, detach, setheight, addSourceToFrame, searchSourceView, etc).
- All calls to InspectorBackend in front-end are going through the semi-serialization into JSON-stringifiable objects.
- This is a nice first step towards running InjectedScript in its context.
- InspectorBackend loses all the [Custom] methods, they get into InjectedScriptHost
- Interaction between back-end and front-end is clear and serializable. There is no problem in putting socket in between.
- Extracting InspectorFrontendHost allows running self-contained front-end that is capable of showing sources in frames, etc. on another machine
- And many nice internal cleanups such as highlightDOMNode that does not need to be [Custom] for a while already.
This looks good to me. Should WebInspector.InspectorBackend just be WebInspector.Backend?
Created attachment 43927 [details]
[PATCH] The patch
Created attachment 43952 [details]
[PATCH] Now splits IDL into 3 parts as in design proposal.
Since the patch is fairly large, I uploaded it to http://codereview.appspot.com/162045.
Note that it won't show side-by-side diff for large files, so when you iterate over the files you sometimes need to get back to side-by-side explicitly via choosing it in top right corner. You can leave comments in place given you have google account.
Committing to http://svn.webkit.org/repository/webkit/trunk ...
C WebCore/inspector/front-end/TestController.js => WebCore/inspector/InjectedScriptHost.idl
C WebCore/inspector/front-end/Database.js => WebCore/inspector/InspectorFrontendHost.h
C WebCore/inspector/front-end/TestController.js => WebCore/inspector/InspectorFrontendHost.idl
C WebCore/inspector/front-end/InspectorControllerStub.js => WebCore/inspector/front-end/InspectorBackendStub.js
C WebCore/inspector/front-end/TestController.js => WebCore/inspector/front-end/InspectorFrontendHostStub.js