https://bugs.webkit.org/show_bug.cgi?id=134055
Reviewed by Simon Fraser.
* Shared/mac/RemoteLayerBackingStore.h:
* Shared/mac/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::RemoteLayerBackingStore):
(WebKit::RemoteLayerBackingStore::~RemoteLayerBackingStore):
(WebKit::RemoteLayerBackingStore::ensureBackingStore):
(WebKit::RemoteLayerBackingStore::display):
(WebKit::RemoteLayerBackingStore::drawInContext):
Remove RemoteLayerBackingStore's RemoteLayerTreeContext pointer. Instead, use the PlatformCALayer's.
Pass the PlatformCALayer in to the constructor, and remove it from ensureBackingStore();
RemoteLayerBackingStore is (for now) strictly tied to a single layer.
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::ensureBackingStore):
(WebKit::PlatformCALayerRemote::updateBackingStore):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
(WebKit::PlatformCALayerRemote::context):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170139
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-06-18 Tim Horton <timothy_horton@apple.com>
+
+ Remove RemoteLayerBackingStore’s RemoteLayerTreeContext pointer
+ https://bugs.webkit.org/show_bug.cgi?id=134055
+
+ Reviewed by Simon Fraser.
+
+ * Shared/mac/RemoteLayerBackingStore.h:
+ * Shared/mac/RemoteLayerBackingStore.mm:
+ (WebKit::RemoteLayerBackingStore::RemoteLayerBackingStore):
+ (WebKit::RemoteLayerBackingStore::~RemoteLayerBackingStore):
+ (WebKit::RemoteLayerBackingStore::ensureBackingStore):
+ (WebKit::RemoteLayerBackingStore::display):
+ (WebKit::RemoteLayerBackingStore::drawInContext):
+ Remove RemoteLayerBackingStore's RemoteLayerTreeContext pointer. Instead, use the PlatformCALayer's.
+ Pass the PlatformCALayer in to the constructor, and remove it from ensureBackingStore();
+ RemoteLayerBackingStore is (for now) strictly tied to a single layer.
+
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+ (WebKit::PlatformCALayerRemote::ensureBackingStore):
+ (WebKit::PlatformCALayerRemote::updateBackingStore):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+ (WebKit::PlatformCALayerRemote::context):
+
2014-06-18 Dan Bernstein <mitz@apple.com>
[Cocoa] Modernize one-method authentication
namespace WebKit {
class PlatformCALayerRemote;
-class RemoteLayerTreeContext;
class RemoteLayerBackingStore {
WTF_MAKE_NONCOPYABLE(RemoteLayerBackingStore);
WTF_MAKE_FAST_ALLOCATED;
public:
- RemoteLayerBackingStore(RemoteLayerTreeContext*);
+ RemoteLayerBackingStore(PlatformCALayerRemote*);
~RemoteLayerBackingStore();
- void ensureBackingStore(PlatformCALayerRemote*, WebCore::FloatSize, float scale, bool acceleratesDrawing, bool isOpaque);
+ void ensureBackingStore(WebCore::FloatSize, float scale, bool acceleratesDrawing, bool isOpaque);
void setNeedsDisplay(const WebCore::IntRect);
void setNeedsDisplay();
WebCore::RepaintRectList m_paintingRects;
- RemoteLayerTreeContext* m_context;
-
std::chrono::steady_clock::time_point m_lastDisplayTime;
};
namespace WebKit {
-RemoteLayerBackingStore::RemoteLayerBackingStore(RemoteLayerTreeContext* context)
- : m_layer(nullptr)
+RemoteLayerBackingStore::RemoteLayerBackingStore(PlatformCALayerRemote* layer)
+ : m_layer(layer)
, m_isOpaque(false)
- , m_context(context)
, m_lastDisplayTime(std::chrono::steady_clock::time_point::min())
{
- if (m_context)
- m_context->backingStoreWasCreated(this);
+ if (!m_layer)
+ return;
+ if (RemoteLayerTreeContext* context = m_layer->context())
+ context->backingStoreWasCreated(this);
}
RemoteLayerBackingStore::~RemoteLayerBackingStore()
{
clearBackingStore();
- if (m_context)
- m_context->backingStoreWillBeDestroyed(this);
+ if (!m_layer)
+ return;
+ if (RemoteLayerTreeContext* context = m_layer->context())
+ context->backingStoreWillBeDestroyed(this);
}
-void RemoteLayerBackingStore::ensureBackingStore(PlatformCALayerRemote* layer, FloatSize size, float scale, bool acceleratesDrawing, bool isOpaque)
+void RemoteLayerBackingStore::ensureBackingStore(FloatSize size, float scale, bool acceleratesDrawing, bool isOpaque)
{
- if (m_layer == layer && m_size == size && m_scale == scale && m_acceleratesDrawing == acceleratesDrawing && m_isOpaque == isOpaque)
+ if (m_size == size && m_scale == scale && m_acceleratesDrawing == acceleratesDrawing && m_isOpaque == isOpaque)
return;
- m_layer = layer;
m_size = size;
m_scale = scale;
m_acceleratesDrawing = acceleratesDrawing;
m_lastDisplayTime = std::chrono::steady_clock::now();
- if (m_context)
- m_context->backingStoreWillBeDisplayed(this);
+ if (RemoteLayerTreeContext* context = m_layer->context())
+ 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);
context.scale(FloatSize(m_scale, m_scale));
+ // FIXME: This should be moved to PlatformCALayerRemote for better layering.
switch (m_layer->layerType()) {
case PlatformCALayer::LayerTypeSimpleLayer:
case PlatformCALayer::LayerTypeTiledBackingTileLayer:
ASSERT(owner());
if (!m_properties.backingStore)
- m_properties.backingStore = std::make_unique<RemoteLayerBackingStore>(m_context);
+ m_properties.backingStore = std::make_unique<RemoteLayerBackingStore>(this);
updateBackingStore();
}
if (!m_properties.backingStore)
return;
- m_properties.backingStore->ensureBackingStore(this, m_properties.bounds.size(), m_properties.contentsScale, m_acceleratesDrawing, m_properties.opaque);
+ m_properties.backingStore->ensureBackingStore(m_properties.bounds.size(), m_properties.contentsScale, m_acceleratesDrawing, m_properties.opaque);
}
void PlatformCALayerRemote::setNeedsDisplay(const FloatRect* rect)
void didCommit();
void clearContext() { m_context = nullptr; }
+ RemoteLayerTreeContext* context() const { return m_context; }
protected:
PlatformCALayerRemote(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext* context);
PlatformCALayerRemote(const PlatformCALayerRemote&, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext*);
- RemoteLayerTreeContext* context() const { return m_context; }
-
private:
virtual bool isPlatformCALayerRemote() const override { return true; }
void ensureBackingStore();