diff options
Diffstat (limited to 'WebCore/inspector')
29 files changed, 120 insertions, 419 deletions
diff --git a/WebCore/inspector/CodeGeneratorInspector.pm b/WebCore/inspector/CodeGeneratorInspector.pm index 177ca3b..8a3654d 100644 --- a/WebCore/inspector/CodeGeneratorInspector.pm +++ b/WebCore/inspector/CodeGeneratorInspector.pm @@ -669,7 +669,6 @@ sub generateSource push(@sourceContent, "\n#include \"config.h\""); push(@sourceContent, "#include \"$className.h\""); push(@sourceContent, "#include <wtf/text/StringConcatenate.h>"); - push(@sourceContent, "#include <wtf/text/CString.h>"); push(@sourceContent, ""); push(@sourceContent, "#if ENABLE(INSPECTOR)"); push(@sourceContent, ""); diff --git a/WebCore/inspector/ConsoleMessage.cpp b/WebCore/inspector/ConsoleMessage.cpp index f1534df..a5e9ec6 100644 --- a/WebCore/inspector/ConsoleMessage.cpp +++ b/WebCore/inspector/ConsoleMessage.cpp @@ -40,6 +40,7 @@ #include "ScriptArguments.h" #include "ScriptCallStack.h" #include "ScriptValue.h" +#include <wtf/PassOwnPtr.h> namespace WebCore { @@ -55,7 +56,7 @@ ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, c { } -ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, const String& m, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack, unsigned g) +ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, const String& m, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack, unsigned g) : m_source(s) , m_type(t) , m_level(l) diff --git a/WebCore/inspector/ConsoleMessage.h b/WebCore/inspector/ConsoleMessage.h index 351c584..4e88bec 100644 --- a/WebCore/inspector/ConsoleMessage.h +++ b/WebCore/inspector/ConsoleMessage.h @@ -49,7 +49,7 @@ class ScriptValue; class ConsoleMessage : public Noncopyable { public: ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, unsigned li, const String& u, unsigned g); - ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>, unsigned g); + ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>, unsigned g); void addToFrontend(InspectorFrontend*, InjectedScriptHost*); void updateRepeatCountInConsole(InspectorFrontend* frontend); @@ -64,8 +64,8 @@ private: MessageType m_type; MessageLevel m_level; String m_message; - RefPtr<ScriptArguments> m_arguments; - RefPtr<ScriptCallStack> m_callStack; + OwnPtr<ScriptArguments> m_arguments; + OwnPtr<ScriptCallStack> m_callStack; unsigned m_line; String m_url; unsigned m_groupLevel; diff --git a/WebCore/inspector/Inspector.idl b/WebCore/inspector/Inspector.idl index c185d2d..e8086a6 100644 --- a/WebCore/inspector/Inspector.idl +++ b/WebCore/inspector/Inspector.idl @@ -58,12 +58,10 @@ module core { #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER [notify] void addProfileHeader(out Object header); - [notify] void addHeapSnapshotChunk(out unsigned long uid, out String chunk); [notify] void attachDebuggerWhenShown(); [notify] void debuggerWasEnabled(); [notify] void debuggerWasDisabled(); [notify] void failedToParseScriptSource(out String url, out String data, out int firstLine, out int errorLine, out String errorMessage); - [notify] void finishHeapSnapshot(out unsigned long uid); [notify] void parsedScriptSource(out String sourceID, out String url, out String data, out int firstLine, out int scriptWorldType); [notify] void pausedScript(out Object details); [notify] void profilerWasEnabled(); @@ -216,7 +214,7 @@ module core { [handler=CSS] void getAllStyles2(out Array styleSheetIds); [handler=CSS] void getStyleSheet2(in String styleSheetId, out Value styleSheet); [handler=CSS] void getStyleSheetText2(in String styleSheetId, out String url, out String text); - [handler=CSS] void setStyleSheetText2(in String styleSheetId, in String text, out boolean success); + [handler=CSS] void setStyleSheetText2(in String styleSheetId, in String text); [handler=CSS] void setPropertyText2(in Object styleId, in long propertyIndex, in String text, in boolean overwrite, out Value style); [handler=CSS] void toggleProperty2(in Object styleId, in long propertyIndex, in boolean disable, out Value style); [handler=CSS] void setRuleSelector2(in Object ruleId, in String selector, out Value rule); diff --git a/WebCore/inspector/InspectorCSSAgent.cpp b/WebCore/inspector/InspectorCSSAgent.cpp index 31d951a..fd1deb5 100644 --- a/WebCore/inspector/InspectorCSSAgent.cpp +++ b/WebCore/inspector/InspectorCSSAgent.cpp @@ -285,16 +285,14 @@ void InspectorCSSAgent::getStyleSheetText2(const String& styleSheetId, String* u inspectorStyleSheet->text(result); } -void InspectorCSSAgent::setStyleSheetText2(const String& styleSheetId, const String& text, bool* success) +void InspectorCSSAgent::setStyleSheetText2(const String& styleSheetId, const String& text) { InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(styleSheetId); - if (!inspectorStyleSheet) { - *success = false; + if (!inspectorStyleSheet) return; - } - *success = inspectorStyleSheet->setText(text); - if (*success) + bool success = inspectorStyleSheet->setText(text); + if (success) inspectorStyleSheet->reparseStyleSheet(text); } diff --git a/WebCore/inspector/InspectorCSSAgent.h b/WebCore/inspector/InspectorCSSAgent.h index 2d2efb5..6e8f244 100644 --- a/WebCore/inspector/InspectorCSSAgent.h +++ b/WebCore/inspector/InspectorCSSAgent.h @@ -66,7 +66,7 @@ public: void getAllStyles2(RefPtr<InspectorArray>* styles); void getStyleSheet2(const String& styleSheetId, RefPtr<InspectorValue>* result); void getStyleSheetText2(const String& styleSheetId, String* url, String* result); - void setStyleSheetText2(const String& styleSheetId, const String& text, bool* success); + void setStyleSheetText2(const String& styleSheetId, const String& text); void setPropertyText2(const RefPtr<InspectorObject>& styleId, long propertyIndex, const String& text, bool overwrite, RefPtr<InspectorValue>* result); void toggleProperty2(const RefPtr<InspectorObject>& styleId, long propertyIndex, bool disable, RefPtr<InspectorValue>* result); void setRuleSelector2(const RefPtr<InspectorObject>& ruleId, const String& selector, RefPtr<InspectorValue>* result); diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index ed319f3..243b7ac 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -330,7 +330,7 @@ void InspectorController::setConsoleMessagesEnabled(bool enabled) m_consoleMessages[i]->addToFrontend(m_frontend.get(), m_injectedScriptHost.get()); } -void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack) +void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack) { if (!enabled()) return; @@ -381,7 +381,7 @@ void InspectorController::clearConsoleMessages() m_frontend->consoleMessagesCleared(); } -void InspectorController::startGroup(PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack, bool collapsed) +void InspectorController::startGroup(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack, bool collapsed) { ++m_groupLevel; @@ -1537,18 +1537,21 @@ static void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, co // of outline (because inflating a quad is hard) { context.save(); + context.addPath(quadPath); context.clipOut(quadPath); + context.addPath(quadPath); context.setStrokeThickness(outlineThickness); context.setStrokeColor(outlineColor, ColorSpaceDeviceRGB); - context.strokePath(quadPath); + context.strokePath(); context.restore(); } // Now do the fill + context.addPath(quadPath); context.setFillColor(fillColor, ColorSpaceDeviceRGB); - context.fillPath(quadPath); + context.fillPath(); } static void drawOutlinedQuadWithClip(GraphicsContext& context, const FloatQuad& quad, const FloatQuad& clipQuad, const Color& fillColor) diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h index 5b407e0..ca5a9d9 100644 --- a/WebCore/inspector/InspectorController.h +++ b/WebCore/inspector/InspectorController.h @@ -146,7 +146,7 @@ public: void disconnectFrontend(); void setConsoleMessagesEnabled(bool enabled, bool* newState); - void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack>); + void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack>); void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String&); void clearConsoleMessages(); const Vector<OwnPtr<ConsoleMessage> >& consoleMessages() const { return m_consoleMessages; } @@ -230,7 +230,7 @@ public: void startTiming(const String& title); bool stopTiming(const String& title, double& elapsed); - void startGroup(PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack> callFrame, bool collapsed = false); + void startGroup(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack> callFrame, bool collapsed = false); void endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL); void markTimeline(const String& message); diff --git a/WebCore/inspector/InspectorProfilerAgent.cpp b/WebCore/inspector/InspectorProfilerAgent.cpp index 6d5364f..1248677 100644 --- a/WebCore/inspector/InspectorProfilerAgent.cpp +++ b/WebCore/inspector/InspectorProfilerAgent.cpp @@ -156,21 +156,6 @@ void InspectorProfilerAgent::getProfileHeaders(RefPtr<InspectorArray>* headers) (*headers)->pushObject(createSnapshotHeader(*it->second)); } -namespace { - -class OutputStream : public ScriptHeapSnapshot::OutputStream { -public: - OutputStream(InspectorFrontend* frontend, unsigned long uid) - : m_frontend(frontend), m_uid(uid) { } - void Write(const String& chunk) { m_frontend->addHeapSnapshotChunk(m_uid, chunk); } - void Close() { m_frontend->finishHeapSnapshot(m_uid); } -private: - InspectorFrontend* m_frontend; - unsigned long m_uid; -}; - -} // namespace - void InspectorProfilerAgent::getProfile(const String& type, unsigned uid, RefPtr<InspectorObject>* profileObject) { if (type == CPUProfileType) { @@ -182,12 +167,8 @@ void InspectorProfilerAgent::getProfile(const String& type, unsigned uid, RefPtr } else if (type == HeapProfileType) { HeapSnapshotsMap::iterator it = m_snapshots.find(uid); if (it != m_snapshots.end()) { - RefPtr<ScriptHeapSnapshot> snapshot = it->second; - *profileObject = createSnapshotHeader(*snapshot); - if (m_frontend) { - OutputStream stream(m_frontend, uid); - snapshot->writeJSON(&stream); - } + *profileObject = createSnapshotHeader(*it->second); + (*profileObject)->setObject("head", it->second->buildInspectorObjectForHead()); } } } diff --git a/WebCore/inspector/InspectorStyleSheet.cpp b/WebCore/inspector/InspectorStyleSheet.cpp index eb1538f..0ad3821 100644 --- a/WebCore/inspector/InspectorStyleSheet.cpp +++ b/WebCore/inspector/InspectorStyleSheet.cpp @@ -178,9 +178,7 @@ bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText, p.parseDeclaration(tempMutableStyle.get(), propertyText + " -webkit-boguz-propertee: none", &sourceData); Vector<CSSPropertySourceData>& propertyData = sourceData->propertyData; unsigned propertyCount = propertyData.size(); - - // At least one property + the bogus property added just above should be present. - if (propertyCount < 2) + if (!propertyCount) return false; // Check for a proper propertyText termination (the parser could at least restore to the PROPERTY_NAME state). @@ -590,7 +588,6 @@ void InspectorStyleSheet::reparseStyleSheet(const String& text) for (unsigned i = 0, size = m_pageStyleSheet->length(); i < size; ++i) m_pageStyleSheet->remove(i); m_pageStyleSheet->parseString(text, m_pageStyleSheet->useStrictParsing()); - m_pageStyleSheet->styleSheetChanged(); m_inspectorStyles.clear(); } @@ -989,9 +986,6 @@ bool InspectorStyleSheet::originalStyleSheetText(String* result) const bool InspectorStyleSheet::resourceStyleSheetText(String* result) const { - if (m_origin == "user" || m_origin == "user-agent") - return false; - if (!m_pageStyleSheet || !ownerDocument()) return false; diff --git a/WebCore/inspector/ScriptArguments.cpp b/WebCore/inspector/ScriptArguments.cpp index b0fe554..e30e135 100644 --- a/WebCore/inspector/ScriptArguments.cpp +++ b/WebCore/inspector/ScriptArguments.cpp @@ -35,11 +35,6 @@ namespace WebCore { -PassRefPtr<ScriptArguments> ScriptArguments::create(ScriptState* scriptState, Vector<ScriptValue>& arguments) -{ - return adoptRef(new ScriptArguments(scriptState, arguments)); -} - ScriptArguments::ScriptArguments(ScriptState* scriptState, Vector<ScriptValue>& arguments) : m_scriptState(scriptState) { diff --git a/WebCore/inspector/ScriptArguments.h b/WebCore/inspector/ScriptArguments.h index 26549b6..fdf05ab 100644 --- a/WebCore/inspector/ScriptArguments.h +++ b/WebCore/inspector/ScriptArguments.h @@ -33,18 +33,15 @@ #include "PlatformString.h" #include "ScriptState.h" -#include <wtf/Forward.h> -#include <wtf/RefCounted.h> #include <wtf/Vector.h> namespace WebCore { class ScriptValue; -class ScriptArguments : public RefCounted<ScriptArguments> { +class ScriptArguments { public: - static PassRefPtr<ScriptArguments> create(ScriptState*, Vector<ScriptValue>& arguments); - + ScriptArguments(ScriptState*, Vector<ScriptValue>& arguments); ~ScriptArguments(); const ScriptValue& argumentAt(size_t) const; @@ -56,8 +53,6 @@ public: bool isEqual(ScriptArguments*) const; private: - ScriptArguments(ScriptState*, Vector<ScriptValue>& arguments); - ScriptStateProtectedPtr m_scriptState; Vector<ScriptValue> m_arguments; }; diff --git a/WebCore/inspector/ScriptCallFrame.h b/WebCore/inspector/ScriptCallFrame.h index 2a1f257..60d77e1 100644 --- a/WebCore/inspector/ScriptCallFrame.h +++ b/WebCore/inspector/ScriptCallFrame.h @@ -32,7 +32,7 @@ #define ScriptCallFrame_h #include "PlatformString.h" -#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> namespace WebCore { diff --git a/WebCore/inspector/ScriptCallStack.cpp b/WebCore/inspector/ScriptCallStack.cpp index 70229e5..31ec1c1 100644 --- a/WebCore/inspector/ScriptCallStack.cpp +++ b/WebCore/inspector/ScriptCallStack.cpp @@ -35,11 +35,6 @@ namespace WebCore { -PassRefPtr<ScriptCallStack> ScriptCallStack::create(Vector<ScriptCallFrame>& frames) -{ - return adoptRef(new ScriptCallStack(frames)); -} - ScriptCallStack::ScriptCallStack(Vector<ScriptCallFrame>& frames) { m_frames.swap(frames); @@ -49,13 +44,13 @@ ScriptCallStack::~ScriptCallStack() { } -const ScriptCallFrame &ScriptCallStack::at(size_t index) const +const ScriptCallFrame &ScriptCallStack::at(size_t index) { ASSERT(m_frames.size() > index); return m_frames[index]; } -size_t ScriptCallStack::size() const +size_t ScriptCallStack::size() { return m_frames.size(); } diff --git a/WebCore/inspector/ScriptCallStack.h b/WebCore/inspector/ScriptCallStack.h index 36ea670..54c6bba 100644 --- a/WebCore/inspector/ScriptCallStack.h +++ b/WebCore/inspector/ScriptCallStack.h @@ -32,32 +32,28 @@ #define ScriptCallStack_h #include "ScriptCallFrame.h" -#include <wtf/Forward.h> -#include <wtf/RefCounted.h> +#include <wtf/Noncopyable.h> #include <wtf/Vector.h> namespace WebCore { class InspectorArray; -class ScriptCallStack : public RefCounted<ScriptCallStack> { +class ScriptCallStack : public Noncopyable { public: static const size_t maxCallStackSizeToCapture = 200; - - static PassRefPtr<ScriptCallStack> create(Vector<ScriptCallFrame>&); + ScriptCallStack(Vector<ScriptCallFrame>&); ~ScriptCallStack(); - const ScriptCallFrame &at(size_t) const; - size_t size() const; + const ScriptCallFrame &at(size_t); + size_t size(); static bool stackTrace(int, const RefPtr<InspectorArray>&); bool isEqual(ScriptCallStack*) const; PassRefPtr<InspectorArray> buildInspectorObject() const; private: - ScriptCallStack(Vector<ScriptCallFrame>&); - Vector<ScriptCallFrame> m_frames; }; diff --git a/WebCore/inspector/front-end/CSSStyleModel.js b/WebCore/inspector/front-end/CSSStyleModel.js index 23ed7a8..baf44c9 100644 --- a/WebCore/inspector/front-end/CSSStyleModel.js +++ b/WebCore/inspector/front-end/CSSStyleModel.js @@ -164,18 +164,9 @@ WebInspector.CSSStyleModel.prototype = { { var resource = WebInspector.resourceManager.resourceForURL(href); if (resource && resource.type === WebInspector.Resource.Type.Stylesheet) - resource.setContent(content, this._onRevert.bind(this, styleSheetId)); + resource.content = content; } - InspectorBackend.getStyleSheetText2(styleSheetId, callback.bind(this)); - }, - - _onRevert: function(styleSheetId, contentToRevertTo) - { - function callback(success) - { - this._styleSheetChanged(styleSheetId, true); - } - InspectorBackend.setStyleSheetText2(styleSheetId, contentToRevertTo, callback.bind(this)); + InspectorBackend.getStyleSheetText2(styleSheetId, callback); } } diff --git a/WebCore/inspector/front-end/HeapSnapshotView.js b/WebCore/inspector/front-end/HeapSnapshotView.js index d09f91d..6bcc0ff 100644 --- a/WebCore/inspector/front-end/HeapSnapshotView.js +++ b/WebCore/inspector/front-end/HeapSnapshotView.js @@ -27,154 +27,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.HeapSnapshotEdgesIterator = function(snapshot, edges) -{ - this._snapshot = snapshot; - this._edges = edges; - this._edgeIndex = 0; -} - -WebInspector.HeapSnapshotEdgesIterator.prototype = { - get done() - { - return this._edgeIndex >= this._edges.length; - }, - - get isElement() - { - return this._getType() === this._snapshot._edgeElementType; - }, - - get isHidden() - { - return this._getType() === this._snapshot._edgeHiddenType; - }, - - get name() - { - return this.isElement || this.isHidden ? this._getNameOrIndex() : this._snapshot._strings[this._getNameOrIndex()]; - }, - - next: function() - { - this._edgeIndex += this._snapshot._edgeFieldsCount; - }, - - get node() - { - return new WebInspector.HeapSnapshotNodeWrapper(this._snapshot, this.nodeIndex); - }, - - get nodeIndex() - { - return this._edges[this._edgeIndex + this._snapshot._edgeToNodeOffset]; - }, - - _getNameOrIndex: function() - { - return this._edges[this._edgeIndex + this._snapshot._edgeNameOffset]; - }, - - _getType: function() - { - return this._edges[this._edgeIndex + this._snapshot._edgeTypeOffset]; - } -}; - -WebInspector.HeapSnapshotNodeWrapper = function(snapshot, nodeIndex) -{ - this._snapshot = snapshot; - this._nodes = snapshot._nodes; - this._nodeIndex = nodeIndex; -} - -WebInspector.HeapSnapshotNodeWrapper.prototype = { - get edges() - { - return new WebInspector.HeapSnapshotEdgesIterator(this._snapshot, this._getEdges()); - }, - - get edgesCount() - { - return this._nodes[this._nodeIndex + this._snapshot._edgesCountOffset]; - }, - - get instancesCount() - { - return this._nodes[this._nodeIndex + this._snapshot._nodeInstancesCountOffset]; - }, - - get isHidden() - { - return this._getType() === this._snapshot._nodeHiddenType; - }, - - get name() - { - return this._snapshot._strings[this._getName()]; - }, - - get selfSize() - { - return this._nodes[this._nodeIndex + this._snapshot._nodeSelfSizeOffset]; - }, - - _getName: function() - { - return this._nodes[this._nodeIndex + this._snapshot._nodeNameOffset]; - }, - - _getEdges: function() - { - var firstEdgeIndex = this._nodeIndex + this._snapshot._firstEdgeOffset; - return this._nodes.slice(firstEdgeIndex, firstEdgeIndex + this.edgesCount * this._snapshot._edgeFieldsCount); - }, - - _getType: function() - { - return this._nodes[this._nodeIndex + this._snapshot._nodeTypeOffset]; - } -}; - -WebInspector.HeapSnapshot = function(profile) -{ - this._profile = profile; - this._nodes = profile.nodes; - this._strings = profile.strings; - - this._init(); -} - -WebInspector.HeapSnapshot.prototype = { - _init: function() - { - this._metaNodeIndex = 0; - this._rootNodeIndex = 1; - var meta = this._nodes[this._metaNodeIndex]; - this._nodeTypeOffset = meta.fields.indexOf("type"); - this._nodeNameOffset = meta.fields.indexOf("name"); - this._nodeIdOffset = meta.fields.indexOf("id"); - this._nodeInstancesCountOffset = this._nodeIdOffset; - this._nodeSelfSizeOffset = meta.fields.indexOf("self_size"); - this._edgesCountOffset = meta.fields.indexOf("children_count"); - this._firstEdgeOffset = meta.fields.indexOf("children"); - this._nodeTypes = meta.types[this._nodeTypeOffset]; - this._nodeHiddenType = this._nodeTypes.indexOf("hidden"); - var edgesMeta = meta.types[this._firstEdgeOffset]; - this._edgeFieldsCount = edgesMeta.fields.length; - this._edgeTypeOffset = edgesMeta.fields.indexOf("type"); - this._edgeNameOffset = edgesMeta.fields.indexOf("name_or_index"); - this._edgeToNodeOffset = edgesMeta.fields.indexOf("to_node"); - this._edgeTypes = edgesMeta.types[this._edgeTypeOffset]; - this._edgeElementType = this._edgeTypes.indexOf("element"); - this._edgeHiddenType = this._edgeTypes.indexOf("hidden"); - }, - - get rootEdges() - { - return (new WebInspector.HeapSnapshotNodeWrapper(this, this._rootNodeIndex)).edges; - } -}; WebInspector.HeapSnapshotView = function(parent, profile) { @@ -242,7 +94,6 @@ WebInspector.HeapSnapshotView = function(parent, profile) this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item status-bar-item"); this.percentButton.addEventListener("click", this._percentClicked.bind(this), false); - this._loadedCallbacks = []; this._loadProfile(this.profile, profileCallback.bind(this)); function profileCallback(profile) @@ -439,14 +290,6 @@ WebInspector.HeapSnapshotView.prototype = { this._updateSummaryGraph(); }, - snapshotLoaded: function(uid, loadedSnapshot) - { - if (!this._loadedCallbacks[uid]) - return; - this._loadedCallbacks[uid](loadedSnapshot); - delete this._loadedCallbacks[uid]; - }, - _changeBase: function() { if (this.baseSnapshot.uid === this._getProfiles()[this.baseSelectElement.selectedIndex].uid) @@ -489,17 +332,15 @@ WebInspector.HeapSnapshotView.prototype = { return; } - this._loadedCallbacks[profile.uid] = processLoadedSnapshot.bind(this); - InspectorBackend.getProfile(profile.typeId, profile.uid); + InspectorBackend.getProfile(profile.typeId, profile.uid, loadedCallback.bind(this)); - function processLoadedSnapshot(loadedSnapshot) - { - var snapshot = this._convertSnapshot(loadedSnapshot); - profile.children = snapshot.children; - profile.entries = snapshot.entries; - profile.lowlevels = snapshot.lowlevels; + function loadedCallback(loadedSnapshot) { + profile.children = loadedSnapshot.head.children; + profile.entries = loadedSnapshot.head.entries; + profile.lowlevels = loadedSnapshot.head.lowlevels; this._prepareProfile(profile); profile._loaded = true; + this.parent.updateProfile(profile); callback(profile); } }, @@ -543,26 +384,6 @@ WebInspector.HeapSnapshotView.prototype = { this.refreshShowAsPercents(); }, - _convertSnapshot: function(loadedSnapshot) - { - var snapshot = new WebInspector.HeapSnapshot(loadedSnapshot); - var result = {lowlevels: {}, entries: {}, children: {}}; - for (var rootEdges = snapshot.rootEdges; !rootEdges.done; rootEdges.next()) { - var node = rootEdges.node; - if (node.isHidden) - result.lowlevels[node.name] = {count: node.instancesCount, size: node.selfSize, type: node.name}; - else if (node.instancesCount) - result.entries[node.name] = {constructorName: node.name, count: node.instancesCount, size: node.selfSize}; - else { - var entry = {constructorName: node.name}; - for (var edges = node.edges; !edges.done; edges.next()) - entry[edges.nodeIndex] = {constructorName: edges.node.name, count: edges.name}; - result.children[rootEdges.nodeIndex] = entry; - } - } - return result; - }, - _prepareProfile: function(profile) { for (var profileEntry in profile.entries) @@ -571,12 +392,12 @@ WebInspector.HeapSnapshotView.prototype = { for (var addr in profile.children) { var retainer = profile.children[addr]; - var retainerId = retainer.constructorName + ":" + addr; + var retainerId = retainer.constructorName + ':' + addr; for (var childAddr in retainer) { - if (childAddr === "constructorName") continue; + if (childAddr === 'constructorName') continue; var item = retainer[childAddr]; - var itemId = item.constructorName + ":" + childAddr; - if ((item.constructorName === "Object" || item.constructorName === "Array")) { + var itemId = item.constructorName + ':' + childAddr; + if ((item.constructorName === 'Object' || item.constructorName === 'Array')) { if (!(itemId in profile.clusters)) profile.clusters[itemId] = { constructorName: itemId, retainers: {} }; mergeRetainers(profile.clusters[itemId], item); @@ -591,7 +412,7 @@ WebInspector.HeapSnapshotView.prototype = { entry.retainers[retainer.constructorName] = { constructorName: retainer.constructorName, count: 0, clusters: {} }; var retainerEntry = entry.retainers[retainer.constructorName]; retainerEntry.count += item.count; - if (retainer.constructorName === "Object" || retainer.constructorName === "Array") + if (retainer.constructorName === 'Object' || retainer.constructorName === 'Array') retainerEntry.clusters[retainerId] = true; } }, @@ -617,7 +438,7 @@ WebInspector.HeapSnapshotView.prototype = { var sortAscending = this.dataGrid.sortOrder === "ascending"; var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier; var sortProperty = { - cons: ["constructorName", null], + cons: ["cons", null], count: ["count", null], size: ["size", "count"], countDelta: this.showCountDeltaAsPercent ? ["countDeltaPercent", null] : ["countDelta", null], diff --git a/WebCore/inspector/front-end/HelpScreen.js b/WebCore/inspector/front-end/HelpScreen.js index a1bbf1e..cad39d0 100644 --- a/WebCore/inspector/front-end/HelpScreen.js +++ b/WebCore/inspector/front-end/HelpScreen.js @@ -30,6 +30,8 @@ WebInspector.HelpScreen = function(title) { + this._addStyleSheetIfNeeded("helpScreen.css"); + this._element = document.createElement("div"); this._element.className = "help-window-outer"; this._element.addEventListener("keydown", this._onKeyDown.bind(this), false); @@ -84,5 +86,17 @@ WebInspector.HelpScreen.prototype = { // Pretend we're modal, grab focus back if we're still shown. if (this._isShown) WebInspector.currentFocusElement = this.contentElement; + }, + + _addStyleSheetIfNeeded: function(href) + { + if (WebInspector.HelpScreen._styleSheetAdded) + return; + + WebInspector.HelpScreen._styleSheetAdded = true; + var link = document.head.createChild("link"); + link.type = "text/css"; + link.rel = "stylesheet"; + link.href = href; } -} +}; diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index fb6b796..106668f 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -700,9 +700,11 @@ CommandLineAPI.prototype = { copy: function(object) { - if (injectedScript._type(object) === "node") - object = object.outerHTML; - InjectedScriptHost.copyText(object); + if (injectedScript._type(object) === "node") { + var nodeId = InjectedScriptHost.pushNodePathToFrontend(object, false, false); + InjectedScriptHost.copyNode(nodeId); + } else + InjectedScriptHost.copyText(object); }, clear: function() diff --git a/WebCore/inspector/front-end/NetworkItemView.js b/WebCore/inspector/front-end/NetworkItemView.js index 48e3b19..927e840 100644 --- a/WebCore/inspector/front-end/NetworkItemView.js +++ b/WebCore/inspector/front-end/NetworkItemView.js @@ -37,6 +37,7 @@ WebInspector.NetworkItemView = function(resource) this._headersView = new WebInspector.ResourceHeadersView(resource); // Do not store reference to content view - it can be recreated. var contentView = WebInspector.ResourceManager.resourceViewForResource(resource); + this._cookiesView = new WebInspector.ResourceCookiesView(resource); this._tabbedPane = new WebInspector.TabbedPane(this.element); this._tabbedPane.appendTab("headers", WebInspector.UIString("Headers"), this._headersView); @@ -45,10 +46,8 @@ WebInspector.NetworkItemView = function(resource) contentView.visible = false; this._tabbedPane.appendTab("content", WebInspector.UIString("Content"), contentView); } - if (Preferences.showCookiesTab) { - this._cookiesView = new WebInspector.ResourceCookiesView(resource); - this._tabbedPane.appendTab("cookies", WebInspector.UIString("Cookies"), this._cookiesView); - } + this._tabbedPane.appendTab("cookies", WebInspector.UIString("Cookies"), this._cookiesView); + if (Preferences.showTimingTab) { var timingView = new WebInspector.ResourceTimingView(resource); this._tabbedPane.appendTab("timing", WebInspector.UIString("Timing"), timingView); @@ -83,7 +82,7 @@ WebInspector.NetworkItemView.prototype = { resize: function() { - if (this._cookiesView && this._cookiesView.visible) + if (this._cookiesView.visible) this._cookiesView.resize(); } } diff --git a/WebCore/inspector/front-end/ProfilesPanel.js b/WebCore/inspector/front-end/ProfilesPanel.js index 50795e8..0aa4174 100644 --- a/WebCore/inspector/front-end/ProfilesPanel.js +++ b/WebCore/inspector/front-end/ProfilesPanel.js @@ -123,7 +123,6 @@ WebInspector.ProfilesPanel = function() this._profiles = []; this._profilerEnabled = Preferences.profilerAlwaysEnabled; - this._tempHeapSnapshots = []; this._reset(); } @@ -412,25 +411,6 @@ WebInspector.ProfilesPanel.prototype = { } }, - addHeapSnapshotChunk: function(uid, chunk) - { - if (this._tempHeapSnapshots[uid]) - this._tempHeapSnapshots[uid] += chunk; - else - this._tempHeapSnapshots[uid] = chunk; - }, - - finishHeapSnapshot: function(uid) - { - var profile = - this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)]; - if (profile) { - var view = profile.__profilesPanelProfileType.viewForProfile(profile); - view.snapshotLoaded(uid, JSON.parse(this._tempHeapSnapshots[uid])); - } - delete this._tempHeapSnapshots[uid]; - }, - showView: function(view) { this.showProfile(view.profile); diff --git a/WebCore/inspector/front-end/Resource.js b/WebCore/inspector/front-end/Resource.js index aefdd6c..9da7f82 100644 --- a/WebCore/inspector/front-end/Resource.js +++ b/WebCore/inspector/front-end/Resource.js @@ -625,69 +625,22 @@ WebInspector.Resource.prototype = { return this._content; }, - get contentTimestamp() - { - return this._contentTimestamp; - }, - - setInitialContent: function(content) + set content(content) { + var data = { oldContent: this._content, oldContentTimestamp: this._contentTimestamp }; this._content = content; - }, - - isLocallyModified: function() - { - return !!this._baseRevision; - }, - - setContent: function(newContent, onRevert) - { - var revisionResource = new WebInspector.Resource(null, this.url); - revisionResource.type = this.type; - revisionResource.loader = this.loader; - revisionResource.timestamp = this.timestamp; - revisionResource._content = this._content; - revisionResource._actualResource = this; - revisionResource._fireOnRevert = onRevert; - - if (this.finished) - revisionResource.finished = true; - else { - function finished() - { - this.removeEventListener("finished", finished); - revisionResource.finished = true; - } - this.addEventListener("finished", finished.bind(this)); - } - - if (!this._baseRevision) - this._baseRevision = revisionResource; - else - revisionResource._baseRevision = this._baseRevision; - - var data = { revision: revisionResource }; - this._content = newContent; - this.timestamp = new Date(); + this._contentTimestamp = new Date(); this.dispatchEventToListeners("content-changed", data); }, - revertToThis: function() + get contentTimestamp() { - if (!this._actualResource || !this._fireOnRevert) - return; - - function callback(content) - { - if (content) - this._fireOnRevert(content); - } - this.requestContent(callback.bind(this)); + return this._contentTimestamp; }, - get baseRevision() + setInitialContent: function(content) { - return this._baseRevision; + this._content = content; }, requestContent: function(callback) diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js index d6f7172..5c5c5d6 100644 --- a/WebCore/inspector/front-end/ResourcesPanel.js +++ b/WebCore/inspector/front-end/ResourcesPanel.js @@ -369,13 +369,13 @@ WebInspector.ResourcesPanel.prototype = { var view = WebInspector.ResourceManager.resourceViewForResource(resource); // Consider rendering diff markup here. - if (resource.baseRevision && view instanceof WebInspector.SourceView) { + if (resource._baseRevision && resource.content && view instanceof WebInspector.SourceView) { function callback(baseContent) { if (baseContent) this._applyDiffMarkup(view, baseContent, resource.content); } - resource.baseRevision.requestContent(callback.bind(this)); + resource._baseRevision.requestContent(callback.bind(this)); } this._innerShowView(view); }, @@ -1091,7 +1091,28 @@ WebInspector.FrameResourceTreeElement.prototype = { _contentChanged: function(event) { - this.insertChild(new WebInspector.ResourceRevisionTreeElement(this._storagePanel, event.data.revision), 0); + var revisionResource = new WebInspector.Resource(null, this._resource.url); + revisionResource.type = this._resource.type; + revisionResource.loader = this._resource.loader; + if (this._resource.finished) + revisionResource.finished = true; + else { + function finished() + { + revisionResource.finished = true; + } + this._resource.addEventListener("finished", finished); + } + + if (!this._resource._baseRevision) + this._resource._baseRevision = revisionResource; + else + revisionResource._baseRevision = this._resource._baseRevision; + + if (event.data.oldContent) + revisionResource.setInitialContent(event.data.oldContent); + this.insertChild(new WebInspector.ResourceRevisionTreeElement(this._storagePanel, revisionResource, event.data.oldContentTimestamp), 0); + var oldView = WebInspector.ResourceManager.existingResourceViewForResource(this._resource); if (oldView) { var newView = WebInspector.ResourceManager.recreateResourceView(this._resource); @@ -1225,13 +1246,13 @@ WebInspector.ApplicationCacheTreeElement.prototype = { } WebInspector.ApplicationCacheTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; -WebInspector.ResourceRevisionTreeElement = function(storagePanel, revision) +WebInspector.ResourceRevisionTreeElement = function(storagePanel, resource, timestamp) { - var title = revision.timestamp ? revision.timestamp.toLocaleTimeString() : "(original)"; - WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, title, "resource-sidebar-tree-item resources-category-" + revision.category.name); - if (revision.timestamp) - this.tooltip = revision.timestamp.toLocaleString(); - this._resource = revision; + var title = timestamp ? timestamp.toLocaleTimeString() : "(original)"; + WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, title, "resource-sidebar-tree-item resources-category-" + resource.category.name); + if (timestamp) + this.tooltip = timestamp.toLocaleString(); + this._resource = resource; } WebInspector.ResourceRevisionTreeElement.prototype = { @@ -1240,7 +1261,6 @@ WebInspector.ResourceRevisionTreeElement.prototype = { WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); this.listItemElement.draggable = true; this.listItemElement.addEventListener("dragstart", this._ondragstart.bind(this), false); - this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true); }, onselect: function() @@ -1254,13 +1274,6 @@ WebInspector.ResourceRevisionTreeElement.prototype = { event.dataTransfer.setData("text/plain", this._resource.content); event.dataTransfer.effectAllowed = "copy"; return true; - }, - - _handleContextMenuEvent: function(event) - { - var contextMenu = new WebInspector.ContextMenu(); - contextMenu.appendItem(WebInspector.UIString("Revert to this revision"), this._resource.revertToThis.bind(this._resource)); - contextMenu.show(event); } } diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js index 61a2f28..0a3c7a9 100644 --- a/WebCore/inspector/front-end/ScriptsPanel.js +++ b/WebCore/inspector/front-end/ScriptsPanel.js @@ -306,7 +306,7 @@ WebInspector.ScriptsPanel.prototype = { return Preferences.canEditScriptSource; }, - editScriptSource: function(editData, commitEditingCallback, cancelEditingCallback) + editScriptSource: function(sourceID, newContent, line, linesCountToShift, commitEditingCallback, cancelEditingCallback) { if (!this.canEditScripts()) return; @@ -323,19 +323,18 @@ WebInspector.ScriptsPanel.prototype = { if (callFrames && callFrames.length) this.debuggerPaused(callFrames); } else { - if (cancelEditingCallback) - cancelEditingCallback(); + cancelEditingCallback(); WebInspector.log(newBodyOrErrorMessage, WebInspector.ConsoleMessage.MessageLevel.Warning); } for (var i = 0; i < breakpoints.length; ++i) { var breakpoint = breakpoints[i]; var newLine = breakpoint.line; - if (success && breakpoint.line >= editData.line) - newLine += editData.linesCountToShift; - WebInspector.breakpointManager.setBreakpoint(editData.sourceID, breakpoint.url, newLine, breakpoint.enabled, breakpoint.condition); + if (success && breakpoint.line >= line) + newLine += linesCountToShift; + WebInspector.breakpointManager.setBreakpoint(sourceID, breakpoint.url, newLine, breakpoint.enabled, breakpoint.condition); } }; - InspectorBackend.editScriptSource(editData.sourceID, editData.content, mycallback.bind(this)); + InspectorBackend.editScriptSource(sourceID, newContent, mycallback.bind(this)); }, selectedCallFrameId: function() diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js index 163b184..9aac626 100644 --- a/WebCore/inspector/front-end/Settings.js +++ b/WebCore/inspector/front-end/Settings.js @@ -48,7 +48,6 @@ var Preferences = { fileSystemEnabled: false, useDataURLForResourceImageIcons: true, showTimingTab: false, - showCookiesTab: false, debugMode: false } diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js index 9616321..e764cf8 100644 --- a/WebCore/inspector/front-end/SourceView.js +++ b/WebCore/inspector/front-end/SourceView.js @@ -147,28 +147,14 @@ WebInspector.SourceView.prototype = { lines.push(textModel.line(i)); } - var editData = {}; - editData.sourceID = this._sourceIDForLine(line); - editData.content = lines.join("\n"); - editData.line = line; - editData.linesCountToShift = newContent.split("\n").length - 1; - - WebInspector.panels.scripts.editScriptSource(editData, this._editLineComplete.bind(this, editData), cancelEditingCallback); - }, - - _editLineComplete: function(editData, newContent) - { - this.resource.setContent(newContent, this._revertEditLine.bind(this, editData)); + var linesCountToShift = newContent.split("\n").length - 1; + var newContent = lines.join("\n"); + WebInspector.panels.scripts.editScriptSource(this._sourceIDForLine(line), newContent, line, linesCountToShift, this._editLineComplete.bind(this, newContent), cancelEditingCallback); }, - _revertEditLine: function(editData, contentToRevertTo) + _editLineComplete: function(newContent) { - var newEditData = {}; - newEditData.sourceID = editData.sourceID; - newEditData.content = editData.content; - newEditData.line = editData.line; - newEditData.linesCountToShift = -editData.linesCountToShift; - WebInspector.panels.scripts.editScriptSource(newEditData, this._editLineComplete.bind(this, newEditData)); + this.resource.content = newContent; }, _sourceIDForLine: function(line) diff --git a/WebCore/inspector/front-end/TimelinePanel.js b/WebCore/inspector/front-end/TimelinePanel.js index 16eb4d7..8900d8d 100644 --- a/WebCore/inspector/front-end/TimelinePanel.js +++ b/WebCore/inspector/front-end/TimelinePanel.js @@ -961,7 +961,7 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = { contentHelper._appendLinkRow(WebInspector.UIString("Script"), this.data.url, this.data.lineNumber); break; case recordTypes.Paint: - contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data.x, this.data.y)); + contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("%d × %d", this.data.x, this.data.y)); contentHelper._appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data.width, this.data.height)); case recordTypes.RecalculateStyles: // We don't want to see default details. break; diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html index 67fd081..2d47474 100644 --- a/WebCore/inspector/front-end/inspector.html +++ b/WebCore/inspector/front-end/inspector.html @@ -35,7 +35,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <link rel="stylesheet" type="text/css" href="inspector.css"> <link rel="stylesheet" type="text/css" href="inspectorSyntaxHighlight.css"> <link rel="stylesheet" type="text/css" href="networkPanel.css"> - <link rel="stylesheet" type="text/css" href="helpScreen.css"> <link rel="stylesheet" type="text/css" href="popover.css"> <link rel="stylesheet" type="text/css" href="textViewer.css"> <script type="text/javascript" src="utilities.js"></script> diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index 51145cf..78592ff 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -1545,16 +1545,6 @@ WebInspector.setRecordingProfile = function(isProfiling) this.panels.profiles.updateProfileTypeButtons(); } -WebInspector.addHeapSnapshotChunk = function(uid, chunk) -{ - this.panels.profiles.addHeapSnapshotChunk(uid, chunk); -} - -WebInspector.finishHeapSnapshot = function(uid) -{ - this.panels.profiles.finishHeapSnapshot(uid); -} - WebInspector.drawLoadingPieChart = function(canvas, percent) { var g = canvas.getContext("2d"); var darkColor = "rgb(122, 168, 218)"; |