Diff
Modified: trunk/Source/WebCore/ChangeLog (108076 => 108077)
--- trunk/Source/WebCore/ChangeLog 2012-02-17 16:17:45 UTC (rev 108076)
+++ trunk/Source/WebCore/ChangeLog 2012-02-17 16:25:15 UTC (rev 108077)
@@ -1,3 +1,30 @@
+2012-02-17 Peter Rybin <[email protected]>
+
+ Web Inspector: Switch Debugger agent to TypeBuilder
+ https://bugs.webkit.org/show_bug.cgi?id=78390
+
+ Reviewed by Vsevolod Vlasov.
+
+ Client code is switched to TypeBuilder.
+
+ * inspector/CodeGeneratorInspector.py:
+ * inspector/InjectedScript.cpp:
+ (WebCore::InjectedScript::evaluateOnCallFrame):
+ (WebCore::InjectedScript::getFunctionDetails):
+ (WebCore::InjectedScript::getProperties):
+ (WebCore::InjectedScript::wrapCallFrames):
+ * inspector/InjectedScript.h:
+ (InjectedScript):
+ * inspector/InspectorDebuggerAgent.cpp:
+ (WebCore::InspectorDebuggerAgent::setBreakpointByUrl):
+ (WebCore::InspectorDebuggerAgent::resolveBreakpoint):
+ (WebCore::InspectorDebuggerAgent::getFunctionDetails):
+ (WebCore::InspectorDebuggerAgent::evaluateOnCallFrame):
+ (WebCore::InspectorDebuggerAgent::currentCallFrames):
+ (WebCore::InspectorDebuggerAgent::didParseSource):
+ * inspector/InspectorDebuggerAgent.h:
+ (InspectorDebuggerAgent):
+
2012-02-17 Pavel Feldman <[email protected]>
Web Inspector: hide color picker on selected node update.
Modified: trunk/Source/WebCore/inspector/CodeGeneratorInspector.py (108076 => 108077)
--- trunk/Source/WebCore/inspector/CodeGeneratorInspector.py 2012-02-17 16:17:45 UTC (rev 108076)
+++ trunk/Source/WebCore/inspector/CodeGeneratorInspector.py 2012-02-17 16:25:15 UTC (rev 108077)
@@ -56,7 +56,8 @@
}
-TYPES_WITH_RUNTIME_CAST_SET = frozenset([])
+TYPES_WITH_RUNTIME_CAST_SET = frozenset(["Runtime.RemoteObject", "Runtime.PropertyDescriptor",
+ "Debugger.FunctionDetails", "Debugger.CallFrame"])
cmdline_parser = optparse.OptionParser()
Modified: trunk/Source/WebCore/inspector/InjectedScript.cpp (108076 => 108077)
--- trunk/Source/WebCore/inspector/InjectedScript.cpp 2012-02-17 16:17:45 UTC (rev 108076)
+++ trunk/Source/WebCore/inspector/InjectedScript.cpp 2012-02-17 16:25:15 UTC (rev 108077)
@@ -43,6 +43,12 @@
#include "PlatformString.h"
#include "ScriptFunctionCall.h"
+using WebCore::TypeBuilder::Array;
+using WebCore::TypeBuilder::Debugger::CallFrame;
+using WebCore::TypeBuilder::Runtime::PropertyDescriptor;
+using WebCore::TypeBuilder::Debugger::FunctionDetails;
+using WebCore::TypeBuilder::Runtime::RemoteObject;
+
namespace WebCore {
InjectedScript::InjectedScript()
@@ -76,7 +82,7 @@
makeEvalCall(errorString, function, result, wasThrown);
}
-void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, const String& _expression_, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, RefPtr<InspectorObject>* result, bool* wasThrown)
+void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, const String& _expression_, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, RefPtr<RemoteObject>* result, bool* wasThrown)
{
ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnCallFrame");
function.appendArgument(callFrames);
@@ -85,10 +91,12 @@
function.appendArgument(objectGroup);
function.appendArgument(includeCommandLineAPI);
function.appendArgument(returnByValue);
- makeEvalCall(errorString, function, result, wasThrown);
+ RefPtr<InspectorObject> resultRaw;
+ makeEvalCall(errorString, function, &resultRaw, wasThrown);
+ *result = RemoteObject::runtimeCast(resultRaw);
}
-void InjectedScript::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<InspectorObject>* result)
+void InjectedScript::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<FunctionDetails>* result)
{
ScriptFunctionCall function(m_injectedScriptObject, "getFunctionDetails");
function.appendArgument(functionId);
@@ -99,7 +107,7 @@
*errorString = "Internal error";
return;
}
- *result = resultValue->asObject();
+ *result = FunctionDetails::runtimeCast(resultValue);
}
void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ownProperties, RefPtr<InspectorArray>* properties)
@@ -114,7 +122,7 @@
*errorString = "Internal error";
return;
}
- *properties = result->asArray();
+ *properties = Array<PropertyDescriptor>::runtimeCast(result);
}
Node* InjectedScript::nodeForObjectId(const String& objectId)
@@ -141,7 +149,7 @@
}
#if ENABLE(_javascript__DEBUGGER)
-PassRefPtr<InspectorArray> InjectedScript::wrapCallFrames(const ScriptValue& callFrames)
+PassRefPtr<Array<CallFrame> > InjectedScript::wrapCallFrames(const ScriptValue& callFrames)
{
ASSERT(!hasNoValue());
ScriptFunctionCall function(m_injectedScriptObject, "wrapCallFrames");
@@ -151,8 +159,8 @@
ASSERT(!hadException);
RefPtr<InspectorValue> result = callFramesValue.toInspectorValue(m_injectedScriptObject.scriptState());
if (result->type() == InspectorValue::TypeArray)
- return result->asArray();
- return InspectorArray::create();
+ return Array<CallFrame>::runtimeCast(result);
+ return Array<CallFrame>::create();
}
#endif
Modified: trunk/Source/WebCore/inspector/InjectedScript.h (108076 => 108077)
--- trunk/Source/WebCore/inspector/InjectedScript.h 2012-02-17 16:17:45 UTC (rev 108076)
+++ trunk/Source/WebCore/inspector/InjectedScript.h 2012-02-17 16:25:15 UTC (rev 108077)
@@ -32,6 +32,7 @@
#define InjectedScript_h
#include "InjectedScriptManager.h"
+#include "InspectorTypeBuilder.h"
#include "ScriptObject.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
@@ -76,15 +77,15 @@
const String& objectGroup,
bool includeCommandLineAPI,
bool returnByValue,
- RefPtr<InspectorObject>* result,
+ RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
bool* wasThrown);
- void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<InspectorObject>* result);
+ void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>* result);
void getProperties(ErrorString*, const String& objectId, bool ownProperties, RefPtr<InspectorArray>* result);
Node* nodeForObjectId(const String& objectId);
void releaseObject(const String& objectId);
#if ENABLE(_javascript__DEBUGGER)
- PassRefPtr<InspectorArray> wrapCallFrames(const ScriptValue&);
+ PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > wrapCallFrames(const ScriptValue&);
#endif
PassRefPtr<InspectorObject> wrapObject(ScriptValue, const String& groupName) const;
Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (108076 => 108077)
--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp 2012-02-17 16:17:45 UTC (rev 108076)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp 2012-02-17 16:25:15 UTC (rev 108077)
@@ -44,6 +44,11 @@
#include "ScriptObject.h"
#include <wtf/text/WTFString.h>
+using WebCore::TypeBuilder::Array;
+using WebCore::TypeBuilder::Debugger::FunctionDetails;
+using WebCore::TypeBuilder::Runtime::RemoteObject;
+using WebCore::TypeBuilder::Debugger::CallFrame;
+
namespace WebCore {
namespace DebuggerAgentState {
@@ -210,8 +215,10 @@
return url == pattern;
}
-void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const String* const optionalCondition, String* outBreakpointId, RefPtr<InspectorArray>& locations)
+void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const String* const optionalCondition, String* outBreakpointId, RefPtr<InspectorArray>& locationsRaw)
{
+ RefPtr<Array<TypeBuilder::Debugger::Location> > locations = Array<TypeBuilder::Debugger::Location>::create();
+ locationsRaw = locations;
if (!optionalURL == !optionalURLRegex) {
*errorString = "Either url or urlRegex must be specified.";
return;
@@ -310,7 +317,7 @@
resume(errorString);
}
-PassRefPtr<InspectorObject> InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointId, const String& scriptId, const ScriptBreakpoint& breakpoint)
+PassRefPtr<TypeBuilder::Debugger::Location> InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointId, const String& scriptId, const ScriptBreakpoint& breakpoint)
{
ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId);
if (scriptIterator == m_scripts.end())
@@ -380,14 +387,16 @@
*error = "No script for id: " + scriptId;
}
-void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<InspectorObject>& details)
+void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<InspectorObject>& detailsRaw)
{
InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(functionId);
if (injectedScript.hasNoValue()) {
*errorString = "Inspected frame has gone";
return;
}
+ RefPtr<FunctionDetails> details;
injectedScript.getFunctionDetails(errorString, functionId, &details);
+ detailsRaw = details;
}
void InspectorDebuggerAgent::schedulePauseOnNextStatement(const String& breakReason, PassRefPtr<InspectorObject> data)
@@ -470,24 +479,26 @@
m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, pauseState);
}
-void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& _expression_, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const returnByValue, RefPtr<InspectorObject>& result, bool* wasThrown)
+void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& _expression_, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const returnByValue, RefPtr<InspectorObject>& resultRaw, bool* wasThrown)
{
InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId);
if (injectedScript.hasNoValue()) {
*errorString = "Inspected frame has gone";
return;
}
+ RefPtr<RemoteObject> result;
injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, _expression_, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : false, &result, wasThrown);
+ resultRaw = result;
}
-PassRefPtr<InspectorArray> InspectorDebuggerAgent::currentCallFrames()
+PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames()
{
if (!m_pausedScriptState)
- return InspectorArray::create();
+ return Array<CallFrame>::create();
InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m_pausedScriptState);
if (injectedScript.hasNoValue()) {
ASSERT_NOT_REACHED();
- return InspectorArray::create();
+ return Array<CallFrame>::create();
}
return injectedScript.wrapCallFrames(m_currentCallStack);
}
@@ -540,7 +551,7 @@
breakpointObject->getNumber("lineNumber", &breakpoint.lineNumber);
breakpointObject->getNumber("columnNumber", &breakpoint.columnNumber);
breakpointObject->getString("condition", &breakpoint.condition);
- RefPtr<InspectorObject> location = resolveBreakpoint(it->first, scriptId, breakpoint);
+ RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it->first, scriptId, breakpoint);
if (location)
m_frontend->breakpointResolved(it->first, location);
}
Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (108076 => 108077)
--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h 2012-02-17 16:17:45 UTC (rev 108076)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h 2012-02-17 16:25:15 UTC (rev 108077)
@@ -130,7 +130,7 @@
void disable();
bool enabled();
- PassRefPtr<InspectorArray> currentCallFrames();
+ PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > currentCallFrames();
virtual void didParseSource(const String& scriptId, const Script&);
virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage);
@@ -139,7 +139,7 @@
void setPauseOnExceptionsImpl(ErrorString*, int);
- PassRefPtr<InspectorObject> resolveBreakpoint(const String& breakpointId, const String& scriptId, const ScriptBreakpoint&);
+ PassRefPtr<TypeBuilder::Debugger::Location> resolveBreakpoint(const String& breakpointId, const String& scriptId, const ScriptBreakpoint&);
void clear();
bool assertPaused(ErrorString*);
void clearBreakDetails();