Web Inspector: Calculate "idle" time for CPU profiles.
https://bugs.webkit.org/show_bug.cgi?id=103120

Patch by Eugene Klyuchnikov <eustas@chromium.org> on 2012-12-18
Reviewed by Pavel Feldman.

CPU profiles contain a very confusing "(program)" item.
It is time when there is no JS stack.
That could be either idle time, or time when browser is doing something.

To split "(program)" item to idle and really program time we are to
calculate idle time during profiling.

* bindings/js/ScriptProfile.cpp: Added "idleTime" getter.
* bindings/js/ScriptProfile.h: Ditto.
* bindings/js/ScriptProfiler.h:
Added getter of thread-local map of currently written profiles.
* bindings/v8/ScriptProfile.cpp: Added "idleTime" getter.
* bindings/v8/ScriptProfile.h: Ditto.
* bindings/v8/ScriptProfiler.cpp:
(WebCore::ScriptProfiler::start): Put profile name to map.
(WebCore::ScriptProfiler::stop): Remove profile name from map;
pass idleTime to profile constructor.
* bindings/v8/ScriptProfiler.h:
Added getter of thread-local map of currently written profiles.
* inspector/Inspector.json: Added "idleTime" field to profile.
* inspector/InspectorController.cpp: Pass hooks to profiler agent.
* inspector/InspectorProfilerAgent.cpp:
Add idle time to currently written profiles.
* inspector/InspectorProfilerAgent.h:
Added member to hold reference to map of currently written profiles.
* inspector/InspectorTimelineAgent.h:
Cleanup.
* inspector/ScriptProfile.idl:
Add "idleTime" member.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138004 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: show cached images under MemoryCache -> Images section
https://bugs.webkit.org/show_bug.cgi?id=105261

Reviewed by Pavel Feldman.

Source/WebCore:

Provided class name and name for several objects related to CachedImage.
Changed native memory snapsho view so that MemoryCache.Image section can
be expanded into individual images.

* inspector/front-end/NativeMemorySnapshotView.js:
(WebInspector.NativeMemorySnapshotView):
(WebInspector.NativeSnapshotNode.prototype._addChildrenFromGraph):
(WebInspector.NativeHeapGraphEdge):
(WebInspector.NativeHeapGraphEdge.prototype.type):
(WebInspector.NativeHeapGraphEdge.prototype.name):
(WebInspector.NativeHeapGraphEdge.prototype.target):
(WebInspector.NativeHeapGraphEdge.prototype._getStringField):
(WebInspector.NativeHeapGraphEdge.prototype.toString):
(WebInspector.NativeHeapGraphNode.prototype.size):
(WebInspector.NativeHeapGraphNode.prototype.referencedNodes):
(WebInspector.NativeHeapGraphNode.prototype.outgoingEdges):
(WebInspector.NativeHeapGraphNode.prototype.targetOfEdge):
(WebInspector.NativeHeapGraphNode.prototype.targetsOfAllEdges):
(WebInspector.NativeHeapGraphNode.prototype._firstEdgePoistion):
(WebInspector.NativeHeapGraphNode.prototype._afterLastEdgePosition):
(WebInspector.NativeHeapGraphNode.prototype._getStringField):
(WebInspector.NativeHeapGraphNode.prototype.toString):
(WebInspector.NativeHeapGraph):
(WebInspector.NativeHeapGraph.prototype.rootNodes):
(WebInspector.NativeHeapGraph.prototype._calculateNodeEdgeIndexes):
(WebInspector.NativeHeapGraph.prototype._addDummyNode):
(WebInspector.NativeMemoryProfileType.prototype.buttonClicked.didReceiveMemorySnapshot):
(WebInspector.NativeMemoryProfileType.prototype.buttonClicked):
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::reportMemoryUsage):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::reportMemoryUsage):
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::reportMemoryUsage):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::reportMemoryUsage):
(WebCore::FrameData::reportMemoryUsage):
* platform/graphics/Image.cpp:
(WebCore::Image::reportMemoryUsage):
* platform/graphics/skia/MemoryInstrumentationSkia.cpp:
(reportMemoryUsage):

Source/WTF:

Use first provided name and class name. If one of the ancestors tries to overwrite
it just ignore the call.

* wtf/MemoryObjectInfo.h:
(WTF::MemoryObjectInfo::setClassName):
(WTF::MemoryObjectInfo::setName):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138005 268f45cc-cd09-0410-ab3c-d52691b4dbfc