Diff
Modified: trunk/Source/WebCore/ChangeLog (183241 => 183242)
--- trunk/Source/WebCore/ChangeLog 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebCore/ChangeLog 2015-04-24 04:36:12 UTC (rev 183242)
@@ -1,5 +1,24 @@
2015-04-23 Simon Fraser <[email protected]>
+ Make it possible to detach GraphicsLayerCA backing store
+ https://bugs.webkit.org/show_bug.cgi?id=144140
+
+ Reviewed by Tim Horton.
+
+ This changes makes it possible to denote a GraphicsLayerCA's backing store
+ as "attached" or not. When not attached, the backing store is made volatile
+ and can be purged. This will be used in a future patch.
+
+ * platform/graphics/ca/GraphicsLayerCA.h: Add updateBackingStoreAttachment().
+ * platform/graphics/ca/PlatformCALayer.h:
+ * platform/graphics/ca/mac/PlatformCALayerMac.h:
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm: Stubs. In future, we could
+ remove backing store on Mac and iOS WK1 too.
+ (PlatformCALayerMac::setBackingStoreAttached):
+ (PlatformCALayerMac::backingStoreAttached):
+
+2015-04-23 Simon Fraser <[email protected]>
+
Remove "layer" from GraphicsLayerCA member function names
https://bugs.webkit.org/show_bug.cgi?id=144139
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (183241 => 183242)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2015-04-24 04:36:12 UTC (rev 183242)
@@ -363,6 +363,7 @@
void updateBackfaceVisibility();
void updateStructuralLayer();
void updateDrawsContent();
+ void updateBackingStoreAttachment();
void updateBackgroundColor();
void updateContentsImage();
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (183241 => 183242)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2015-04-24 04:36:12 UTC (rev 183242)
@@ -176,6 +176,9 @@
virtual void setContentsRect(const FloatRect&) = 0;
+ virtual void setBackingStoreAttached(bool) = 0;
+ virtual bool backingStoreAttached() const = 0;
+
virtual void setMinificationFilter(FilterType) = 0;
virtual void setMagnificationFilter(FilterType) = 0;
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (183241 => 183242)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h 2015-04-24 04:36:12 UTC (rev 183242)
@@ -89,6 +89,9 @@
virtual void setHidden(bool) override;
+ virtual void setBackingStoreAttached(bool) override;
+ virtual bool backingStoreAttached() const override;
+
WEBCORE_EXPORT virtual void setGeometryFlipped(bool) override;
virtual bool isDoubleSided() const override;
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (183241 => 183242)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2015-04-24 04:36:12 UTC (rev 183242)
@@ -594,6 +594,16 @@
END_BLOCK_OBJC_EXCEPTIONS
}
+void PlatformCALayerMac::setBackingStoreAttached(bool)
+{
+ // We could throw away backing store here with setContents:nil.
+}
+
+bool PlatformCALayerMac::backingStoreAttached() const
+{
+ return true;
+}
+
void PlatformCALayerMac::setGeometryFlipped(bool value)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
Modified: trunk/Source/WebKit2/ChangeLog (183241 => 183242)
--- trunk/Source/WebKit2/ChangeLog 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/ChangeLog 2015-04-24 04:36:12 UTC (rev 183242)
@@ -1,3 +1,46 @@
+2015-04-23 Simon Fraser <[email protected]>
+
+ Make it possible to detach GraphicsLayerCA backing store
+ https://bugs.webkit.org/show_bug.cgi?id=144140
+
+ Reviewed by Tim Horton.
+
+ This changes makes it possible to denote a GraphicsLayerCA's backing store
+ as "attached" or not. When not attached, the backing store is made volatile
+ and can be purged. This will be used in a future patch.
+
+ * Shared/mac/RemoteLayerBackingStore.mm:
+ (WebKit::RemoteLayerBackingStore::~RemoteLayerBackingStore): Whitespace.
+ (WebKit::RemoteLayerBackingStore::display): If backingStoreWillBeDisplayed()
+ returns true, this indicates that the backing store was brought out of the
+ "unreachable" list, so return true even if the backing store doesn't require
+ painting.
+ * Shared/mac/RemoteLayerBackingStoreCollection.h: C++11 initializer, and comments.
+ * Shared/mac/RemoteLayerBackingStoreCollection.mm:
+ (WebKit::RemoteLayerBackingStoreCollection::RemoteLayerBackingStoreCollection):
+ (WebKit::RemoteLayerBackingStoreCollection::backingStoreWillBeDisplayed): Return true
+ if the caller will need to submit the backing store in the current transaction.
+ (WebKit::RemoteLayerBackingStoreCollection::backingStoreBecameUnreachable): This
+ explicit dirtying is no longer necessary given the backingStoreWillBeDisplayed() change.
+ * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+ (WebKit::applyPropertiesToLayer): Only set the layer's backing if we both have backing
+ store, and it's attached.
+ * Shared/mac/RemoteLayerTreeTransaction.h: New bit, and data member.
+ * Shared/mac/RemoteLayerTreeTransaction.mm:
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+ (WebKit::dumpChangedLayers):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+ (WebKit::PlatformCALayerRemote::recursiveBuildTransaction): Only call display()
+ on the backing store if it's attached.
+ (WebKit::PlatformCALayerRemote::setBackingStoreAttached):
+ (WebKit::PlatformCALayerRemote::backingStoreAttached):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+ * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
+ * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
+ (WebKit::RemoteLayerTreeContext::backingStoreWillBeDisplayed):
+
2015-04-23 Tim Horton <[email protected]>
Quick Look preview popover is not dismissed on scroll in Mail
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (183241 => 183242)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm 2015-04-24 04:36:12 UTC (rev 183242)
@@ -66,6 +66,7 @@
if (!m_layer)
return;
+
if (RemoteLayerTreeContext* context = m_layer->context())
context->backingStoreWillBeDestroyed(*this);
}
@@ -206,8 +207,9 @@
m_lastDisplayTime = std::chrono::steady_clock::now();
+ bool needToEncodeBackingStore = false;
if (RemoteLayerTreeContext* context = m_layer->context())
- context->backingStoreWillBeDisplayed(*this);
+ needToEncodeBackingStore = context->backingStoreWillBeDisplayed(*this);
// Make the previous front buffer non-volatile early, so that we can dirty the whole layer if it comes back empty.
setBufferVolatility(BufferType::Front, false);
@@ -215,7 +217,7 @@
IntSize expandedScaledSize = backingStoreSize();
if (m_dirtyRegion.isEmpty() || expandedScaledSize.isEmpty())
- return false;
+ return needToEncodeBackingStore;
IntRect layerBounds(IntPoint(), expandedIntSize(m_size));
if (!hasFrontBuffer())
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.h (183241 => 183242)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.h 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.h 2015-04-24 04:36:12 UTC (rev 183242)
@@ -45,7 +45,8 @@
void backingStoreWasCreated(RemoteLayerBackingStore&);
void backingStoreWillBeDestroyed(RemoteLayerBackingStore&);
- void backingStoreWillBeDisplayed(RemoteLayerBackingStore&);
+ // Return value indicates whether the backing store needs to be included in the transaction.
+ bool backingStoreWillBeDisplayed(RemoteLayerBackingStore&);
void backingStoreBecameUnreachable(RemoteLayerBackingStore&);
void willFlushLayers();
@@ -67,11 +68,13 @@
HashSet<RemoteLayerBackingStore*> m_liveBackingStore;
HashSet<RemoteLayerBackingStore*> m_unparentedBackingStore;
+
+ // Only used during a single flush.
HashSet<RemoteLayerBackingStore*> m_reachableBackingStoreInLatestFlush;
WebCore::Timer m_volatilityTimer;
- bool m_inLayerFlush;
+ bool m_inLayerFlush { false };
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm (183241 => 183242)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm 2015-04-24 04:36:12 UTC (rev 183242)
@@ -38,7 +38,6 @@
RemoteLayerBackingStoreCollection::RemoteLayerBackingStoreCollection()
: m_volatilityTimer(*this, &RemoteLayerBackingStoreCollection::volatilityTimerFired)
- , m_inLayerFlush(false)
{
}
@@ -88,16 +87,18 @@
m_unparentedBackingStore.remove(&backingStore);
}
-void RemoteLayerBackingStoreCollection::backingStoreWillBeDisplayed(RemoteLayerBackingStore& backingStore)
+bool RemoteLayerBackingStoreCollection::backingStoreWillBeDisplayed(RemoteLayerBackingStore& backingStore)
{
ASSERT(m_inLayerFlush);
m_reachableBackingStoreInLatestFlush.add(&backingStore);
auto backingStoreIter = m_unparentedBackingStore.find(&backingStore);
if (backingStoreIter == m_unparentedBackingStore.end())
- return;
+ return false;
+
m_liveBackingStore.add(&backingStore);
m_unparentedBackingStore.remove(backingStoreIter);
+ return true;
}
bool RemoteLayerBackingStoreCollection::markBackingStoreVolatileImmediately(RemoteLayerBackingStore& backingStore, VolatilityMarkingFlags volatilityMarkingFlags)
@@ -141,10 +142,6 @@
m_unparentedBackingStore.add(&backingStore);
m_liveBackingStore.remove(backingStoreIter);
- // If a layer with backing store is removed from the tree, mark it as having changed backing store, so that
- // on the commit which returns it to the tree, we serialize the backing store (despite possibly not painting).
- backingStore.layer()->properties().notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreChanged);
-
// This will not succeed in marking all buffers as volatile, because the commit unparenting the layer hasn't
// made it to the UI process yet. The volatility timer will finish marking the remaining buffers later.
markBackingStoreVolatileImmediately(backingStore);
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (183241 => 183242)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2015-04-24 04:36:12 UTC (rev 183242)
@@ -233,8 +233,11 @@
if (properties.changedProperties & RemoteLayerTreeTransaction::TimeOffsetChanged)
layer.timeOffset = properties.timeOffset;
- if (properties.changedProperties & RemoteLayerTreeTransaction::BackingStoreChanged) {
- if (RemoteLayerBackingStore* backingStore = properties.backingStore.get())
+ if (properties.changedProperties & RemoteLayerTreeTransaction::BackingStoreChanged
+ || properties.changedProperties & RemoteLayerTreeTransaction::BackingStoreAttachmentChanged)
+ {
+ RemoteLayerBackingStore* backingStore = properties.backingStore.get();
+ if (backingStore && properties.backingStoreAttached)
backingStore->applyBackingStoreToLayer(layer);
else {
layer.contents = nil;
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (183241 => 183242)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2015-04-24 04:36:12 UTC (rev 183242)
@@ -81,10 +81,11 @@
SpeedChanged = 1LLU << 28,
TimeOffsetChanged = 1LLU << 29,
BackingStoreChanged = 1LLU << 30,
- FiltersChanged = 1LLU << 31,
- AnimationsChanged = 1LLU << 32,
- EdgeAntialiasingMaskChanged = 1LLU << 33,
- CustomAppearanceChanged = 1LLU << 34
+ BackingStoreAttachmentChanged = 1LLU << 31,
+ FiltersChanged = 1LLU << 32,
+ AnimationsChanged = 1LLU << 33,
+ EdgeAntialiasingMaskChanged = 1LLU << 34,
+ CustomAppearanceChanged = 1LLU << 35,
};
typedef uint64_t LayerChange;
@@ -156,6 +157,7 @@
WebCore::BlendMode blendMode;
WebCore::WindRule windRule;
bool hidden;
+ bool backingStoreAttached;
bool geometryFlipped;
bool doubleSided;
bool masksToBounds;
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (183241 => 183242)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2015-04-24 04:36:12 UTC (rev 183242)
@@ -98,6 +98,7 @@
, blendMode(BlendModeNormal)
, windRule(RULE_NONZERO)
, hidden(false)
+ , backingStoreAttached(true)
, geometryFlipped(false)
, doubleSided(true)
, masksToBounds(false)
@@ -134,6 +135,7 @@
, blendMode(other.blendMode)
, windRule(other.windRule)
, hidden(other.hidden)
+ , backingStoreAttached(other.backingStoreAttached)
, geometryFlipped(other.geometryFlipped)
, doubleSided(other.doubleSided)
, masksToBounds(other.masksToBounds)
@@ -255,6 +257,9 @@
encoder << *backingStore;
}
+ if (changedProperties & BackingStoreAttachmentChanged)
+ encoder << backingStoreAttached;
+
if (changedProperties & FiltersChanged)
encoder << *filters;
@@ -454,6 +459,11 @@
result.backingStore = nullptr;
}
+ if (result.changedProperties & BackingStoreAttachmentChanged) {
+ if (!decoder.decode(result.backingStoreAttached))
+ return false;
+ }
+
if (result.changedProperties & FiltersChanged) {
std::unique_ptr<FilterOperations> filters = std::make_unique<FilterOperations>();
if (!decoder.decode(*filters))
@@ -1181,6 +1191,9 @@
dumpProperty(ts, "backingStore", "removed");
}
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::BackingStoreAttachmentChanged)
+ dumpProperty(ts, "backingStoreAttached", layerProperties.backingStoreAttached);
+
if (layerProperties.changedProperties & RemoteLayerTreeTransaction::FiltersChanged)
dumpProperty(ts, "filters", layerProperties.filters ? *layerProperties.filters : FilterOperations());
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (183241 => 183242)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2015-04-24 04:36:12 UTC (rev 183242)
@@ -153,7 +153,7 @@
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreChanged);
}
- if (m_properties.backingStore && m_properties.backingStore->display())
+ if (m_properties.backingStore && m_properties.backingStoreAttached && m_properties.backingStore->display())
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreChanged);
if (m_properties.changedProperties != RemoteLayerTreeTransaction::NoChange) {
@@ -502,6 +502,20 @@
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::HiddenChanged);
}
+void PlatformCALayerRemote::setBackingStoreAttached(bool value)
+{
+ if (m_properties.backingStoreAttached == value)
+ return;
+
+ m_properties.backingStoreAttached = value;
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreAttachmentChanged);
+}
+
+bool PlatformCALayerRemote::backingStoreAttached() const
+{
+ return m_properties.backingStoreAttached;
+}
+
void PlatformCALayerRemote::setGeometryFlipped(bool value)
{
m_properties.geometryFlipped = value;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (183241 => 183242)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2015-04-24 04:36:12 UTC (rev 183242)
@@ -94,6 +94,9 @@
virtual void setHidden(bool) override;
+ virtual void setBackingStoreAttached(bool) override;
+ virtual bool backingStoreAttached() const override;
+
virtual void setGeometryFlipped(bool) override;
virtual bool isDoubleSided() const override;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h (183241 => 183242)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h 2015-04-24 04:36:12 UTC (rev 183242)
@@ -51,7 +51,7 @@
void backingStoreWasCreated(RemoteLayerBackingStore&);
void backingStoreWillBeDestroyed(RemoteLayerBackingStore&);
- void backingStoreWillBeDisplayed(RemoteLayerBackingStore&);
+ bool backingStoreWillBeDisplayed(RemoteLayerBackingStore&);
WebCore::LayerPool& layerPool() { return m_layerPool; }
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm (183241 => 183242)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm 2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm 2015-04-24 04:36:12 UTC (rev 183242)
@@ -94,9 +94,9 @@
m_backingStoreCollection.backingStoreWillBeDestroyed(backingStore);
}
-void RemoteLayerTreeContext::backingStoreWillBeDisplayed(RemoteLayerBackingStore& backingStore)
+bool RemoteLayerTreeContext::backingStoreWillBeDisplayed(RemoteLayerBackingStore& backingStore)
{
- m_backingStoreCollection.backingStoreWillBeDisplayed(backingStore);
+ return m_backingStoreCollection.backingStoreWillBeDisplayed(backingStore);
}
std::unique_ptr<GraphicsLayer> RemoteLayerTreeContext::createGraphicsLayer(WebCore::GraphicsLayer::Type layerType, GraphicsLayerClient& client)