diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-12 09:11:11 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-12 09:11:11 +0000 |
commit | d9b19f85e2abd19c62e5885c2a1d001273aa910c (patch) | |
tree | f2236153dc9a5c12d49dbca2ea1260d114f0c777 /webkit/glue | |
parent | 4bb33630869981809c47c36c3c18813d6b005d34 (diff) | |
download | chromium_src-d9b19f85e2abd19c62e5885c2a1d001273aa910c.zip chromium_src-d9b19f85e2abd19c62e5885c2a1d001273aa910c.tar.gz chromium_src-d9b19f85e2abd19c62e5885c2a1d001273aa910c.tar.bz2 |
DevTools: enable databases panel.
Review URL: http://codereview.chromium.org/265015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28697 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/devtools/debugger_agent_impl.cc | 10 | ||||
-rw-r--r-- | webkit/glue/devtools/debugger_agent_impl.h | 2 | ||||
-rw-r--r-- | webkit/glue/devtools/js/devtools.js | 2 | ||||
-rw-r--r-- | webkit/glue/devtools/js/devtools_callback.js | 57 | ||||
-rw-r--r-- | webkit/glue/devtools/js/inspector_controller_impl.js | 12 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.cc | 16 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsclient_impl.cc | 11 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsclient_impl.h | 2 |
8 files changed, 43 insertions, 69 deletions
diff --git a/webkit/glue/devtools/debugger_agent_impl.cc b/webkit/glue/devtools/debugger_agent_impl.cc index 5c1bfd8..d0e0460 100644 --- a/webkit/glue/devtools/debugger_agent_impl.cc +++ b/webkit/glue/devtools/debugger_agent_impl.cc @@ -147,9 +147,11 @@ void DebuggerAgentImpl::CreateUtilityContext( String DebuggerAgentImpl::ExecuteUtilityFunction( v8::Handle<v8::Context> context, + int call_id, const char* object, const String &function_name, const String& json_args, + bool async, String* exception) { v8::HandleScope scope; ASSERT(!context.IsEmpty()); @@ -173,13 +175,17 @@ String DebuggerAgentImpl::ExecuteUtilityFunction( v8::String::New(function_name.utf8().data())); v8::Handle<v8::String> json_args_wrapper = v8::Handle<v8::String>( v8::String::New(json_args.utf8().data())); + v8::Handle<v8::Number> call_id_wrapper = v8::Handle<v8::Number>( + v8::Number::New(async ? call_id : 0)); + v8::Handle<v8::Value> args[] = { function_name_wrapper, - json_args_wrapper + json_args_wrapper, + call_id_wrapper }; v8::TryCatch try_catch; - v8::Handle<v8::Value> res_obj = function->Call(context->Global(), 2, args); + v8::Handle<v8::Value> res_obj = function->Call(context->Global(), 3, args); if (try_catch.HasCaught()) { *exception = WebCore::toWebCoreString(try_catch.Message()->Get()); return ""; diff --git a/webkit/glue/devtools/debugger_agent_impl.h b/webkit/glue/devtools/debugger_agent_impl.h index c03d3cc..d64bd49 100644 --- a/webkit/glue/devtools/debugger_agent_impl.h +++ b/webkit/glue/devtools/debugger_agent_impl.h @@ -53,9 +53,11 @@ class DebuggerAgentImpl : public DebuggerAgent { // implemented in the inject_dispatch.js file. WebCore::String ExecuteUtilityFunction( v8::Handle<v8::Context> context, + int call_id, const char* object, const WebCore::String& function_name, const WebCore::String& json_args, + bool async, WebCore::String* exception); // Executes a no-op function in the utility context. We don't use diff --git a/webkit/glue/devtools/js/devtools.js b/webkit/glue/devtools/js/devtools.js index ce25791..e572a77 100644 --- a/webkit/glue/devtools/js/devtools.js +++ b/webkit/glue/devtools/js/devtools.js @@ -36,7 +36,7 @@ devtools$$dispatch = function(remoteName, methodName, param1, param2, param3) { devtools.ToolsAgent = function() { RemoteToolsAgent.DidDispatchOn = - devtools.Callback.processCallback; + WebInspector.Callback.processCallback; RemoteToolsAgent.FrameNavigate = goog.bind(this.frameNavigate_, this); RemoteToolsAgent.DispatchOnClient = diff --git a/webkit/glue/devtools/js/devtools_callback.js b/webkit/glue/devtools/js/devtools_callback.js deleted file mode 100644 index f252861..0000000 --- a/webkit/glue/devtools/js/devtools_callback.js +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * @fileoverview Generic callback manager. - */ -goog.provide('devtools.Callback'); - - -/** - * Generic callback support as a singleton object. - * @constructor - */ -devtools.Callback = function() { - this.lastCallbackId_ = 1; - this.callbacks_ = {}; -}; - - -/** - * Assigns id to a callback. - * @param {Function} callback Callback to assign id to. - * @return {number} Callback id. - */ -devtools.Callback.prototype.wrap = function(callback) { - var callbackId = this.lastCallbackId_++; - this.callbacks_[callbackId] = callback || function() {}; - return callbackId; -}; - - -/** - * Executes callback with the given id. - * @param {callbackId} callbackId Id of a callback to call. - */ -devtools.Callback.prototype.processCallback = function(callbackId, - opt_vararg) { - var args = Array.prototype.slice.call(arguments, 1); - var callback = this.callbacks_[callbackId]; - callback.apply(null, args); - delete this.callbacks_[callbackId]; -}; - - -/** - * @type {devtools.Callback} Callback support singleton. - * @private - */ -devtools.Callback.INSTANCE_ = new devtools.Callback(); - -devtools.Callback.wrap = goog.bind( - devtools.Callback.INSTANCE_.wrap, - devtools.Callback.INSTANCE_); -devtools.Callback.processCallback = goog.bind( - devtools.Callback.INSTANCE_.processCallback, - devtools.Callback.INSTANCE_); diff --git a/webkit/glue/devtools/js/inspector_controller_impl.js b/webkit/glue/devtools/js/inspector_controller_impl.js index 766c33d..4b83196 100644 --- a/webkit/glue/devtools/js/inspector_controller_impl.js +++ b/webkit/glue/devtools/js/inspector_controller_impl.js @@ -19,6 +19,8 @@ devtools.InspectorControllerImpl = function() { this.installInspectorControllerDelegate_('enableResourceTracking'); this.installInspectorControllerDelegate_('enableTimeline'); this.installInspectorControllerDelegate_('getChildNodes'); + this.installInspectorControllerDelegate_('getDatabaseTableNames'); + this.installInspectorControllerDelegate_('getDOMStorageEntries'); this.installInspectorControllerDelegate_('getEventListenersForNode'); this.installInspectorControllerDelegate_('highlightDOMNode'); this.installInspectorControllerDelegate_('hideDOMNodeHighlight'); @@ -70,7 +72,7 @@ devtools.InspectorControllerImpl.prototype.detach = function() { * {@inheritDoc}. */ devtools.InspectorControllerImpl.prototype.hiddenPanels = function() { - return ''; + return DevToolsHost.hiddenPanels(); }; @@ -252,13 +254,13 @@ devtools.InspectorControllerImpl.prototype.takeHeapSnapshot = function() { * @override */ devtools.InspectorControllerImpl.prototype.dispatchOnInjectedScript = function( - callId, methodName, argsString) { + callId, methodName, argsString, async) { var callback = function(result, isException) { WebInspector.didDispatchOnInjectedScript(callId, result, isException); }; RemoteToolsAgent.DispatchOnInjectedScript( - devtools.Callback.wrap(callback), - methodName, + WebInspector.Callback.wrap(callback), + async ? methodName + "_async" : methodName, argsString); }; @@ -282,7 +284,7 @@ devtools.InspectorControllerImpl.prototype.callInspectorController_ = function(methodName, var_arg) { var args = Array.prototype.slice.call(arguments, 1); RemoteToolsAgent.DispatchOnInspectorController( - devtools.Callback.wrap(function(){}), + WebInspector.Callback.wrap(function(){}), methodName, JSON.stringify(args)); }; diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc index 8902227..a96143a 100644 --- a/webkit/glue/webdevtoolsagent_impl.cc +++ b/webkit/glue/webdevtoolsagent_impl.cc @@ -169,7 +169,8 @@ void WebDevToolsAgentImpl::DispatchOnInspectorController( String result; String exception; result = debugger_agent_impl_->ExecuteUtilityFunction(utility_context_, - "InspectorControllerDispatcher", function_name, json_args, &exception); + call_id, "InspectorControllerDispatcher", function_name, json_args, + false /* is sync */, &exception); tools_agent_delegate_stub_->DidDispatchOn(call_id, result, exception); } @@ -180,10 +181,17 @@ void WebDevToolsAgentImpl::DispatchOnInjectedScript( const String& json_args) { String result; String exception; + String fname = function_name; + bool async = function_name.endsWith("_async"); + if (async) { + fname = fname.substring(0, fname.length() - 6); + } result = debugger_agent_impl_->ExecuteUtilityFunction(utility_context_, - "InjectedScript", function_name, json_args, &exception); - tools_agent_delegate_stub_->DidDispatchOn(call_id, - result, exception); + call_id, "InjectedScript", fname, json_args, async, &exception); + if (!async) { + tools_agent_delegate_stub_->DidDispatchOn(call_id, + result, exception); + } } void WebDevToolsAgentImpl::ExecuteVoidJavaScript() { diff --git a/webkit/glue/webdevtoolsclient_impl.cc b/webkit/glue/webdevtoolsclient_impl.cc index d580d65..774e07b 100644 --- a/webkit/glue/webdevtoolsclient_impl.cc +++ b/webkit/glue/webdevtoolsclient_impl.cc @@ -15,6 +15,7 @@ #include "Page.h" #include "PlatformString.h" #include "SecurityOrigin.h" +#include "Settings.h" #include "V8Binding.h" #include "V8CustomBinding.h" #include "V8Proxy.h" @@ -167,6 +168,9 @@ WebDevToolsClientImpl::WebDevToolsClientImpl( dev_tools_host_->AddProtoFunction( "getApplicationLocale", WebDevToolsClientImpl::JsGetApplicationLocale); + dev_tools_host_->AddProtoFunction( + "hiddenPanels", + WebDevToolsClientImpl::JsHiddenPanels); dev_tools_host_->Build(); } @@ -386,6 +390,13 @@ v8::Handle<v8::Value> WebDevToolsClientImpl::JsGetApplicationLocale( } // static +v8::Handle<v8::Value> WebDevToolsClientImpl::JsHiddenPanels( + const v8::Arguments& args) { + Page* page = V8Proxy::retrieveFrameForEnteredContext()->page(); + return v8String(page->settings()->databasesEnabled() ? "" : "databases"); +} + +// static v8::Handle<v8::Value> WebDevToolsClientImpl::JsDebuggerCommand( const v8::Arguments& args) { WebDevToolsClientImpl* client = static_cast<WebDevToolsClientImpl*>( diff --git a/webkit/glue/webdevtoolsclient_impl.h b/webkit/glue/webdevtoolsclient_impl.h index b817a23..ee8d6a1 100644 --- a/webkit/glue/webdevtoolsclient_impl.h +++ b/webkit/glue/webdevtoolsclient_impl.h @@ -73,6 +73,8 @@ class WebDevToolsClientImpl : public WebDevToolsClient, const v8::Arguments& args); static v8::Handle<v8::Value> JsGetApplicationLocale( const v8::Arguments& args); + static v8::Handle<v8::Value> JsHiddenPanels( + const v8::Arguments& args); static v8::Handle<v8::Value> JsDebuggerCommand( const v8::Arguments& args); |