Web Inspector: NMI provide data for mixing with tcmalloc heap dumps.
https://bugs.webkit.org/show_bug.cgi?id=99457

Reviewed by Yury Semikhatsky.

Source/WebCore:

countObjectSize now accepts ptr as the first argument and saves it into HashMap if the binary was ran with HEAPPROFILE env variable.
getProcessMemoryDistribution does snapshot and calls the downstream code with the map of counted objects.

* inspector/InspectorClient.h:
(WebCore::InspectorClient::dumpUncountedAllocatedObjects):
* inspector/InspectorMemoryAgent.cpp:
(WebCore::reportJSHeapInfo):
(WebCore::reportRenderTreeInfo):
(WebCore):
(WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
* inspector/MemoryInstrumentationImpl.cpp:
(WebCore::MemoryInstrumentationClientImpl::countObjectSize):
(WebCore::MemoryInstrumentationClientImpl::reportMemoryUsage):
* inspector/MemoryInstrumentationImpl.h:
(MemoryInstrumentationClientImpl):
(WebCore::MemoryInstrumentationClientImpl::countedObjects):

Source/WebKit/chromium:

Embedder's code wraps the map with counted objects info into InstrumentedObjectSizeProvider
and forces downstream code to make tcmalloc heap snapshot.
The default implementation is empty.

* public/WebDevToolsAgentClient.h:
(InstrumentedObjectSizeProvider):
(WebKit::WebDevToolsAgentClient::InstrumentedObjectSizeProvider::~InstrumentedObjectSizeProvider):
(WebKit::WebDevToolsAgentClient::dumpUncountedAllocatedObjects):
(WebDevToolsAgentClient):
* src/InspectorClientImpl.cpp:
(WebKit::InspectorClientImpl::dumpUncountedAllocatedObjects):
(WebKit):
* src/InspectorClientImpl.h:
(InspectorClientImpl):
* src/WebDevToolsAgentImpl.cpp:
(WebKit::WebDevToolsAgentImpl::getAllocatedObjects):
(WebKit::WebDevToolsAgentImpl::dumpUncountedAllocatedObjects):
(WebKit):
* src/WebDevToolsAgentImpl.h:
(WebDevToolsAgentImpl):

Source/WTF:

countObjectSize now accepts ptr as the first argument and saves it into HashMap if the binary was ran with HEAPPROFILE env variable.
getProcessMemoryDistribution does snapshot and calls the downstream code with the map of counted objects.

* wtf/MemoryInstrumentation.h:
(MemoryInstrumentationClient):
(WTF::MemoryInstrumentation::countObjectSize):
(WTF::MemoryInstrumentation::addRawBuffer):
(WTF::MemoryClassInfo::addPrivateBuffer):
(WTF::MemoryInstrumentation::addObjectImpl):
(WTF::MemoryInstrumentation::addListHashSet):
(WTF::::process):

Tools:

countObjectSize now requires pointer to object as the first argument.

* TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131869 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Update localizedStrings.js
https://bugs.webkit.org/show_bug.cgi?id=99701

Patch by Eugene Klyuchnikov <eustas.bug@gmail.com> on 2012-10-19
Reviewed by Yury Semikhatsky.

Fixed most of missing strings and orphans.

* English.lproj/localizedStrings.js:
* inspector/front-end/SettingsScreen.js:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: labelForElement is slow when there are a lot of DOM elements
https://bugs.webkit.org/show_bug.cgi?id=97825

Reviewed by Ryosuke Niwa.

Source/WebCore:

Adds a DocumentOrderedMap to TreeScope that allows accessibility to
quickly map from an id to the label for that id. This speeds up
AccessibilityNode::labelForElement, which was a bottleneck in Chromium
when accessibility was on.

Tests: accessibility/title-ui-element-correctness.html
       perf/accessibility-title-ui-element.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::labelForElement):
* dom/DocumentOrderedMap.cpp:
(WebCore::keyMatchesLabelForAttribute):
(WebCore):
(WebCore::DocumentOrderedMap::get):
(WebCore::DocumentOrderedMap::getElementByLabelForAttribute):
* dom/DocumentOrderedMap.h:
(DocumentOrderedMap):
* dom/Element.cpp:
(WebCore::Element::insertedInto):
(WebCore::Element::removedFrom):
(WebCore::Element::updateLabel):
(WebCore):
(WebCore::Element::willModifyAttribute):
* dom/Element.h:
(Element):
* dom/TreeScope.cpp:
(WebCore::TreeScope::TreeScope):
(WebCore::TreeScope::destroyTreeScopeData):
(WebCore::TreeScope::addLabel):
(WebCore):
(WebCore::TreeScope::removeLabel):
(WebCore::TreeScope::labelElementForId):
* dom/TreeScope.h:
(WebCore):
(TreeScope):
(WebCore::TreeScope::shouldCacheLabelsByForAttribute):

Tools:

Implement titleUIElement in the chromium port of DRT, and
fix getAccessibleElementById so that it ensures the backing store
is up-to-date.

* DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp:
(AccessibilityController::getAccessibleElementById):
* DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp:
(AccessibilityUIElement::titleUIElementCallback):

LayoutTests:

Adds two new tests for titleUIElement that run on both Mac and
Chromium. One tests correctness, the other tests speed.

Fixes one test so that it passes on Chromium.
Enables other tests that now pass on Chromium.

* accessibility/secure-textfield-title-ui.html:
* accessibility/title-ui-element-correctness-expected.txt: Added.
* accessibility/title-ui-element-correctness.html: Added.
* perf/accessibility-title-ui-element-expected.txt: Added.
* perf/accessibility-title-ui-element.html: Added.
* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131871 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Saving HAR, snapshots and timeline data do not work in remote debugging mode
https://bugs.webkit.org/show_bug.cgi?id=99179

Patch by Eugene Klyuchnikov <eustas.bug@gmail.com> on 2012-10-19
Reviewed by Yury Semikhatsky.

Added method "close" to InspectorFrontendHost.
Symantically, this method forces to flush all unsaved buffers for
specified file. In native implementation this turns to be no-op.

In stub implementation "close" causes compilation of blob object an
navigating to blob-schema url.

Removed "canAppend", as appending in now suppurted
by all implementations.

Repaced schema "data" with "blob" in InspectorFrontendHostStub "save"
to avoid out-of-memory errors.

* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::close): Compiles blob object and
navigates to blob-object url.
(WebCore):
* inspector/InspectorFrontendHost.h: Added "close" method.
* inspector/InspectorFrontendHost.idl: Ditto.
* inspector/front-end/FileManager.js:
(WebInspector.FileManager.prototype.close): Proxy to InspectorFrontend.
* inspector/front-end/FileUtils.js:
(WebInspector.FileOutputStream.prototype.close):
Invoke "close" on FileManager.
(WebInspector.FileOutputStream.prototype._onAppendDone): Ditto.
* inspector/front-end/HandlerRegistry.js: Added mandatory "close" call.
* inspector/front-end/HeapSnapshotView.js:
(WebInspector.HeapProfileHeader.prototype.canSaveToFile): Fixed check.
* inspector/front-end/InspectorFrontendHostStub.js:
(.WebInspector.InspectorFrontendHostStub):
Added "appendable" behaviour emulation.
* inspector/front-end/SourceFrame.js: Added mandatory "close" call.
* inspector/front-end/externs.js: Replaced "canAppend" with "close"

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[V8] Simplify GCPrologueVisitor
https://bugs.webkit.org/show_bug.cgi?id=99819

Reviewed by Kentaro Hara.

Previously, GCPrologueVisitor used a complicated traits-based template
design. That's not necessary. We can just implement it directly without
template magic.

The one subtly here is that MessagePort is not actually a subclass of
ActiveDOMObject. The next stage of this cleanup is to make MessagePort
inherit from ActiveDOMObject and remove this special case entirely.

* bindings/v8/V8GCController.cpp:
(WebCore::EnsureWeakDOMNodeVisitor::visitDOMWrapper):
(WebCore):
(WebCore::ActiveDOMObjectPrologueVisitor::visitDOMWrapper):
(WebCore::NodeVisitor::visitDOMWrapper):
(WebCore::V8GCController::gcPrologue):


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