summaryrefslogtreecommitdiffstats
path: root/webkit/glue/devtools/js/inject_dispatch.js
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-12 23:57:18 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-12 23:57:18 +0000
commit2f7f4d591192cfdebee227b72e3cf57c7c604450 (patch)
tree181fc0fc257b6203c3ca2affb33f4b143de5fd3c /webkit/glue/devtools/js/inject_dispatch.js
parent5a8459aa45b09a6cdcdd90ca190ba353799e3464 (diff)
downloadchromium_src-2f7f4d591192cfdebee227b72e3cf57c7c604450.zip
chromium_src-2f7f4d591192cfdebee227b72e3cf57c7c604450.tar.gz
chromium_src-2f7f4d591192cfdebee227b72e3cf57c7c604450.tar.bz2
Enables the sending of Timeline Agent and Resource messages to the devtools api in extensions.
Review URL: http://codereview.chromium.org/267013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28761 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/devtools/js/inject_dispatch.js')
-rw-r--r--webkit/glue/devtools/js/inject_dispatch.js27
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);
};