Coordinated Graphics: Enable support for setContentsToBackgroundColor
https://bugs.webkit.org/show_bug.cgi?id=104128

Patch by No'am Rosenthal <noam@webkit.org> on 2012-12-05
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Enable background color in GraphicsLayerTextureMapper, and paint it using TextureMapper::drawSolidColor.
Once https://bugs.webkit.org/show_bug.cgi?id=103786 is enabled, this would enable Qt/GTK/EFL to directly
composite colors that only have a background color, without having to create a backing store for them.
This would eliminate the memory usage for those layers, reduce the time needed for them to draw into the
backing store and upload the texture, and in the future allow direct compositing of things other than
background colors.

Compositing tests cover this, but are still skipped for ports using coordinated graphics.
See https://bugs.webkit.org/show_bug.cgi?id=104129.

* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::setContentsToBackgroundColor):
(WebCore::GraphicsLayerTextureMapper::backgroundColor):
    Maintain a backgroundColor member variable in GraphicsLayerTextureMapper

* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawSolidColor):
    TextureMapperGL::drawSolidColor should allow blending when the solid color has alpha.

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::paintSelf):
(WebCore::TextureMapperLayer::flushCompositingStateSelf):
* platform/graphics/texmap/TextureMapperLayer.h:
(State):

Source/WebKit2:

Enable setContentsToBackgroundColor in CoordinatedGraphicsLayer, and pass it through to the UI process.

* Shared/WebLayerTreeInfo.h:
(WebLayerInfo):
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
(WebKit::LayerTreeRenderer::setLayerState):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::setContentsToBackgroundColor):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:
(CoordinatedGraphicsLayer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@136781 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IndexedDB: Allow multiple transactions to interleave request execution
https://bugs.webkit.org/show_bug.cgi?id=97570

Reviewed by Tony Chang.

Source/WebCore:

Implement spec logic for allowing read-only transactions, and read-write transactions
with non-overlapping scopes, to run concurrently. Transactions all still run in the
same thread with tasks triggered via timers, so tasks and the underlying database
operations are interleaved rather than truly parallelized.

Within IDBTransactionCoordinator, rename started->queued, running->started to match
spec terminology and clear up confusion.

Test: storage/indexeddb/transaction-coordination-across-databases.html
      storage/indexeddb/transaction-coordination-within-database.html
      storage/indexeddb/transaction-readwrite-exclusive.html
      storage/indexeddb/transaction-scope-sequencing.html
      storage/indexeddb/transaction-starvation.html

* Modules/indexeddb/IDBDatabaseBackendImpl.cpp: Use IDBTransaction::Mode enum
(WebCore::IDBDatabaseBackendImpl::createTransaction):
* Modules/indexeddb/IDBDatabaseBackendImpl.h: Ditto.
(IDBDatabaseBackendImpl):
* Modules/indexeddb/IDBDatabaseBackendInterface.h: Ditto.
(IDBDatabaseBackendInterface):
* Modules/indexeddb/IDBTransactionBackendImpl.cpp: Convert scope as a HashSet for
fast intersecting.
(WebCore::IDBTransactionBackendImpl::create):
(WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl):
* Modules/indexeddb/IDBTransactionBackendImpl.h:
(IDBTransactionBackendImpl):
(WebCore::IDBTransactionBackendImpl::mode):
(WebCore::IDBTransactionBackendImpl::scope):
* Modules/indexeddb/IDBTransactionCoordinator.cpp: Spec logic goes here.
(WebCore::IDBTransactionCoordinator::processStartedTransactions): Extend this
method to test all plausibly runnable transactions.
(WebCore):
(WebCore::IDBTransactionCoordinator::canRunTransaction): Test to see if one
particular transaction can be run.
(WebCore::IDBTransactionCoordinator::doScopesOverlap): Do a quick intersection
test between transaction scopes.
* Modules/indexeddb/IDBTransactionCoordinator.h:
(IDBTransactionCoordinator):

Source/WebKit/chromium:

Map to IDBTransaction::Mode enum as appropriate.

* src/IDBDatabaseBackendProxy.cpp:
(WebKit::IDBDatabaseBackendProxy::createTransaction):
* src/IDBDatabaseBackendProxy.h:
(IDBDatabaseBackendProxy):
* src/WebIDBDatabaseImpl.cpp:
(WebKit::WebIDBDatabaseImpl::createTransaction):
 * tests/IDBDatabaseBackendTest.cpp:

LayoutTests:

New tests for parallel transactions, update existing tests that relied on sequential execution.

* storage/indexeddb/database-close-expected.txt:
* storage/indexeddb/mozilla/clear-expected.txt:
* storage/indexeddb/mozilla/resources/clear.js: Split up transaction steps.
* storage/indexeddb/resources/database-close.js: Don't log on individual transaction completion.
* storage/indexeddb/resources/transaction-coordination-within-database.js: Added.
* storage/indexeddb/resources/transaction-scope-sequencing.js: Added.
* storage/indexeddb/resources/transaction-starvation.js: Added.
* storage/indexeddb/transaction-coordination-within-database-expected.txt: Added.
* storage/indexeddb/transaction-coordination-within-database.html: Added.
* storage/indexeddb/transaction-scope-sequencing-expected.txt: Added.
* storage/indexeddb/transaction-scope-sequencing.html: Added.
* storage/indexeddb/transaction-starvation-expected.txt: Added.
* storage/indexeddb/transaction-starvation.html: Added.


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