JSC should have a way to gather and log Heap memory use and pause times
https://bugs.webkit.org/show_bug.cgi?id=98431

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

In order to improve our infrastructure for benchmark-driven development, we should
have a centralized method of gathering and logging various statistics about the state
of the JS heap. This would allow us to create and to use other tools to analyze the
output of the VM after running various workloads.

The first two statistics that might be interesting is memory use by JSC and GC pause
times. We can control whether this recording happens through the use of the Options
class, allowing us to either use environment variables or command line flags.

* JavaScriptCore.xcodeproj/project.pbxproj:
* heap/Heap.cpp:
(JSC::Heap::collect): If we finish a collection and are still over our set GC heap size,
we end the program immediately and report an error. Also added recording of pause times.
* heap/Heap.h:
(Heap):
(JSC::Heap::shouldCollect): When we set a specific GC heap size through Options, we
ignore all other heuristics on when we should collect and instead only ask if we're
greater than the amount specified in the Option value. This allows us to view time/memory
tradeoffs more clearly.
* heap/HeapStatistics.cpp: Added.
(JSC):
(JSC::HeapStatistics::initialize):
(JSC::HeapStatistics::recordGCPauseTime):
(JSC::HeapStatistics::logStatistics):
(JSC::HeapStatistics::exitWithFailure):
(JSC::HeapStatistics::reportSuccess):
(JSC::HeapStatistics::parseMemoryAmount):
(StorageStatistics):
(JSC::StorageStatistics::StorageStatistics):
(JSC::StorageStatistics::operator()):
(JSC::StorageStatistics::objectWithOutOfLineStorageCount):
(JSC::StorageStatistics::objectCount):
(JSC::StorageStatistics::storageSize):
(JSC::StorageStatistics::storageCapacity):
(JSC::HeapStatistics::showObjectStatistics): Moved the old showHeapStatistics (renamed to showObjectStatistics)
to try to start collecting our various memory statistics gathering/reporting mechanisms scattered throughout the
codebase into one place.
* heap/HeapStatistics.h: Added.
(JSC):
(HeapStatistics):
* jsc.cpp:
(main):
* runtime/InitializeThreading.cpp:
(JSC::initializeThreadingOnce): We need to initialize our data structures for recording
statistics if necessary.
* runtime/Options.cpp: Add new Options for the various types of statistics we'll be gathering.
(JSC::parse):
(JSC):
(JSC::Options::initialize): Initialize the various new options using environment variables.
(JSC::Options::dumpOption):
* runtime/Options.h:
(JSC):

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(main): Added a check as to whether we should dump our JSC Heap statistics on exit.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130520 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove wrong expectations added in r130452.

* platform/chromium-win-xp/editing/pasteboard/5006779-expected.png: Removed.
* platform/chromium-win-xp/editing/pasteboard/5006779-expected.txt: Removed.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130521 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2][WKTR] Implement UIClient focus callbacks in WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=98256

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-10-05
Reviewed by Kenneth Rohde Christiansen.

Tools:

Implement UIClient's focus callbacks for the main page in
WebKitTestRunner.

* WebKitTestRunner/TestController.cpp:
(WTR::focus):
(WTR::TestController::initialize):

LayoutTests:

Unskip fast/dom/Window/mozilla-focus-blur.html now that
WebKitTestRunner implements UIClient's focus callbacks.

* platform/efl-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a setting to enable plugin snapshotting
https://bugs.webkit.org/show_bug.cgi?id=98319
<rdar://problem/12426480>

Reviewed by Brady Eidson.

Source/WebCore:

Add a new bit for this preference.

* page/Settings.cpp:
(WebCore::Settings::Settings): Preference is false by default.
* page/Settings.h: Added m_plugInSnapshottingEnabled bit.
(WebCore::Settings::setPlugInSnapshottingEnabled): Set the bit.
(WebCore::Settings::plugInSnapshottingEnabled): Return the bit.

Source/WebKit/mac:

Expose plugInSnapshottingEnabled preference to WebKit clients.

* WebView/WebPreferenceKeysPrivate.h: Add WebKitPlugInSnapshottingEnabled key.
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]): Setting is turned off by default.
(-[WebPreferences plugInSnapshottingEnabled]):
(-[WebPreferences setPlugInSnapshottingEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]): Update settings based on preference.

Source/WebKit2:

Expose plugInSnapshottingEnabled preference to WebKit clients.

* Shared/WebPreferencesStore.h:
(WebKit):
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetPlugInSnapshottingEnabled):
(WKPreferencesGetPlugInSnapshottingEnabled):
* UIProcess/API/C/WKPreferences.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences): Update preference based on store.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130523 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed GTK gardening.

Adding platform-specific baselines after r130443 and r130489.

* platform/gtk/fast/repaint/box-shadow-inset-repaint-expected.png: Added.
* platform/gtk/fast/repaint/box-shadow-inset-repaint-expected.txt: Added.
* platform/gtk/fast/text/vertical-rl-rtl-linebreak-expected.png: Added.
* platform/gtk/fast/text/vertical-rl-rtl-linebreak-expected.txt: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Add support for creating EGL contexts
https://bugs.webkit.org/show_bug.cgi?id=77921

Patch by José Dapena Paz <jdapena@igalia.com> on 2012-10-05
Reviewed by Martin Robinson.

This patch adds support for EGL, using OpenGL and OpenGL ES 2. Both
options are set up on compile time, with the configure options
--enable-egl and --enable-gles2.

The implementation only adds support for EGL on top of X11, to
isolate the changes to the minimum. More changes should come
later to enable EGL for other targets (as Wayland).

.:

* GNUmakefile.am:
* configure.ac: new configure options --enable-egl and --enable-gles2.

Source/WebCore:

No new tests required, as existing WebGL and AC tests should cover
the cases.

* GNUmakefile.am:
* GNUmakefile.list.am:
* platform/graphics/GraphicsContext3D.h:
(GraphicsContext3D):
* platform/graphics/OpenGLESShims.h:
* platform/graphics/cairo/GLContext.cpp:
(WebCore):
(WebCore::GLContext::sharedX11Display):
(WebCore::GLContext::cleanupSharedX11Display):
(WebCore::activeContextList):
(WebCore::GLContext::addActiveContext):
(WebCore::GLContext::removeActiveContext):
(WebCore::GLContext::cleanupActiveContextsAtExit):
(WebCore::GLContext::createContextForWindow):
(WebCore::GLContext::createOffscreenContext):
* platform/graphics/cairo/GLContext.h:
(GLContext):
* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::create):
(WebCore::GraphicsContext3D::GraphicsContext3D):
(WebCore::GraphicsContext3D::~GraphicsContext3D):
(WebCore::GraphicsContext3D::isGLES2Compliant):
* platform/graphics/cairo/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
* platform/graphics/clutter/GraphicsContext3DClutter.cpp:
* platform/graphics/efl/GraphicsContext3DEfl.cpp:
* platform/graphics/egl/GLContextEGL.cpp: Added.
(WebCore):
(WebCore::sharedEGLDisplay):
(WebCore::getEGLConfig):
(WebCore::GLContextEGL::createWindowContext):
(WebCore::GLContextEGL::createPbufferContext):
(WebCore::GLContextEGL::createPixmapContext):
(WebCore::GLContextEGL::createContext):
(WebCore::GLContextEGL::GLContextEGL):
(WebCore::GLContextEGL::~GLContextEGL):
(WebCore::GLContextEGL::canRenderToDefaultFramebuffer):
(WebCore::GLContextEGL::defaultFrameBufferSize):
(WebCore::GLContextEGL::makeContextCurrent):
(WebCore::GLContextEGL::swapBuffers):
(WebCore::GLContextEGL::waitNative):
(WebCore::GLContextEGL::platformContext):
* platform/graphics/egl/GLContextEGL.h: Added.
(WebCore):
(GLContextEGL):
* platform/graphics/glx/GLContextGLX.cpp:
(WebCore::GLContextGLX::createWindowContext):
(WebCore::GLContextGLX::createPbufferContext):
(WebCore::GLContextGLX::createPixmapContext):
(WebCore::GLContextGLX::createContext):
(WebCore::GLContextGLX::~GLContextGLX):
(WebCore::GLContextGLX::defaultFrameBufferSize):
(WebCore::GLContextGLX::makeContextCurrent):
(WebCore::GLContextGLX::swapBuffers):
(WebCore):
(WebCore::GLContextGLX::waitNative):
* platform/graphics/glx/GLContextGLX.h:
(GLContextGLX):
* platform/graphics/mac/GraphicsContext3DMac.mm:
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::releaseShaderCompiler):
(WebCore):
* platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
(WebCore::GraphicsContext3D::readPixels):
(WebCore::GraphicsContext3D::reshapeFBOs):
(WebCore::GraphicsContext3D::renderbufferStorage):
* platform/graphics/qt/GraphicsContext3DQt.cpp:
* platform/graphics/texmap/TextureMapper.h:
* platform/gtk/RedirectedXCompositeWindow.cpp:
(WebCore::RedirectedXCompositeWindow::RedirectedXCompositeWindow):
(WebCore::RedirectedXCompositeWindow::~RedirectedXCompositeWindow):
(WebCore::RedirectedXCompositeWindow::resize):
* platform/gtk/RedirectedXCompositeWindow.h:

Source/WebKit2:

* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130525 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Remove unnecessary html file.
https://bugs.webkit.org/show_bug.cgi?id=98531

Reviewed by Yong Li.

We now just use Source/WebCore/inspector/front-end/inspector.html
instead.

* WebCoreSupport/inspectorBB.html: Removed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130527 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add expected result accidentally left out of http://trac.webkit.org/changeset/130337.
* perf/adding-radio-buttons-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130528 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed rebaseline after r130355.

r130447 forgot to update the Snow Leopard pixel baselines. The only differences are due to a different font used.

* platform/chromium-mac-snowleopard/fast/clip/overflow-border-radius-combinations-expected.png: Added.
* platform/chromium-mac-snowleopard/fast/clip/overflow-border-radius-fixed-position-expected.png: Added.
* platform/chromium-mac-snowleopard/fast/clip/overflow-border-radius-transformed-expected.png: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130529 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Update some more #includes for Platform/ directory
https://bugs.webkit.org/show_bug.cgi?id=98534

Reviewed by Adam Barth.

Part of a refactoring series. See tracking bug 82948.

* src/WebFormElement.cpp:
* src/WebFrameImpl.cpp:
* src/WebGeolocationClientMock.cpp:
* src/WebGeolocationError.cpp:
* src/WebGeolocationPermissionRequest.cpp:
* src/WebHistoryItem.cpp:
* src/WebHitTestResult.cpp:
* src/WebIDBTransactionImpl.h:
* src/WebIconLoadingCompletionImpl.h:
* src/WebImageDecoder.cpp:
* src/WebImageSkia.cpp:
* src/WebInputElement.cpp:
* src/WebKit.cpp:
* src/WebLabelElement.cpp:
* src/WebMediaStreamRegistry.cpp:
* src/WebNode.cpp:
* src/WebNotification.cpp:
* src/WebOptionElement.cpp:
* src/WebPageSerializer.cpp:
* src/WebPageSerializerImpl.cpp:
* src/WebPageSerializerImpl.h:
* src/WebPluginListBuilderImpl.cpp:
* src/WebPluginLoadObserver.h:
* src/WebPopupMenuImpl.cpp:
* src/WebPopupMenuImpl.h:
* src/WebRange.cpp:
* src/WebRegularExpression.cpp:
* src/WebScriptController.cpp:
* src/WebSecurityOrigin.cpp:
* src/WebSecurityPolicy.cpp:
* src/WebSelectElement.cpp:
* src/WebSerializedScriptValue.cpp:
* src/WebSessionDescriptionDescriptor.cpp:
* src/WebSettingsImpl.cpp:
* src/WebSocketImpl.cpp:
* src/WebSocketImpl.h:
* src/WebStorageEventDispatcherImpl.cpp:
* src/WebSurroundingText.cpp:
* src/WebURLLoadTiming.cpp:
* src/WorkerAsyncFileWriterChromium.cpp:
* src/WorkerFileSystemCallbacksBridge.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130530 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reversing a GlyphBuffer needlessly queries its size multiple times
https://bugs.webkit.org/show_bug.cgi?id=98530

Reviewed by Simon Fraser.

No new tests because there is no change in behavior.

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/FontFastPath.cpp:
(WebCore::Font::getGlyphsAndAdvancesForSimpleText): Replaced the condition
(i < glyphBuffer.size() / 2) with the equivalent test (i < end).
* platform/graphics/mac/FontComplexTextMac.cpp:
(WebCore::Font::getGlyphsAndAdvancesForComplexText): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Deleting across multiple paragraphs can change the style of surrounding text
https://bugs.webkit.org/show_bug.cgi?id=97266

Reviewed by Levi Weintraub.

Source/WebCore: 

Preserve editing styles from CSS rules in wrappingStyleForSerialization as well as inline styles
even when we're not annotating. We don't want to preserve all styles because it's against
the user expectation to keep borders, etc... when merging paragraphs. We also don't want to copy
styles from a mail blockquote because that's not a style the user has applied. See the comment
in EditingStyle::wrappingStyleForSerialization.

Test: editing/deleting/merge-paragraph-with-style-from-rule.html

* editing/EditingStyle.cpp:
(WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):
(WebCore::EditingStyle::wrappingStyleForSerialization):

LayoutTests: 

Added a regression test and rebaselined tests.

* editing/deleting/delete-before-block-image-2-expected.txt:
* editing/deleting/merge-paragraph-from-p-with-style-expected.txt:
* editing/deleting/merge-paragraph-from-p-with-style.html: We changed the behavior. The editing style of p
is now preserved when merging paragraphs.
* editing/deleting/merge-paragraph-with-style-from-rule-expected.txt: Added.
* editing/deleting/merge-paragraph-with-style-from-rule.html: Added.
* platform/mac/editing/deleting/delete-block-merge-contents-001-expected.txt:
* platform/mac/editing/pasteboard/merge-end-blockquote-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Have perf test assert worst order of magnitude
https://bugs.webkit.org/show_bug.cgi?id=98535

Reviewed by Tony Chang.

Really we only care if tests get order of magnitude slower.
Assert that tests are at least a certain magnitude.
Hopefully this will reduce flakiness some.

* resources/magnitude-perf.js:
(Magnitude._run):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130533 268f45cc-cd09-0410-ab3c-d52691b4dbfc
No autorelease pool in place, causing buildup of autoreleased objects.
https://bugs.webkit.org/show_bug.cgi?id=98522
<rdar://problem/11647950>

Reviewed by Alexey Proskuryakov.

Wrap each timer callback in an AutodrainPool, ensuring an autorelease
pool is present during calls from C/C++ into ObjC.

* platform/cf/RunLoopTimerCF.cpp:
(WebCore::timerFired):

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