diff options
Diffstat (limited to 'webkit/glue/devtools/js/inject_dispatch.js')
-rw-r--r-- | webkit/glue/devtools/js/inject_dispatch.js | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/webkit/glue/devtools/js/inject_dispatch.js b/webkit/glue/devtools/js/inject_dispatch.js index 16dd56f..96c3fac 100644 --- a/webkit/glue/devtools/js/inject_dispatch.js +++ b/webkit/glue/devtools/js/inject_dispatch.js @@ -9,7 +9,6 @@ var InspectorControllerDispatcher = {}; - /** * Main dispatch method, all calls from the host to InspectorController go * through this one. @@ -22,6 +21,27 @@ InspectorControllerDispatcher.dispatch = function(functionName, json_args) { InspectorController[functionName].apply(InspectorController, params); }; +/** + * Special controller object for APU related messages. Outgoing messages + * are sent to this object if the ApuAgentDispatcher is enabled. + **/ +var ApuAgentDispatcher = { enabled : false }; + +/** + * Dispatches messages to APU. This filters and transforms + * outgoing messages that are used by APU. + * @param {string} method name of the dispatch method. + **/ +ApuAgentDispatcher.dispatchToApu = function(method, args) { + if (method != 'addItemToTimeline' && + method != 'updateResource' && + method != 'addResource') { + return; + } + // TODO(knorton): Transform args so they can be used + // by APU. + DevToolsAgentHost.dispatchToApu(JSON.stringify(args)); +}; /** * This is called by the InspectorFrontend for serialization. @@ -41,6 +61,11 @@ function dispatch(method, var_args) { return; } + if (ApuAgentDispatcher.enabled) { + ApuAgentDispatcher.dispatchToApu(method, args); + return; + } + var call = JSON.stringify(args); DevToolsAgentHost.dispatch(call); }; |