Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h

Issue 1497873002: Make DisplayItemClient an interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
index 632fa11d2677a35c0755d2c8991722d5ed772cf4..4168d6d6c788de9ee48baf1ba9c37d3591a5103d 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
@@ -192,8 +192,8 @@ public:
TableCollapsedBorderLeft = 1 << 3,
};
- DisplayItem(const DisplayItemClientWrapper& client, Type type, size_t derivedSize)
- : m_client(client.displayItemClient())
+ DisplayItem(const DisplayItemClient& client, Type type, size_t derivedSize)
+ : m_client(&client)
, m_scope(0)
, m_type(type)
, m_derivedSize(derivedSize)
@@ -213,7 +213,7 @@ public:
// Ids are for matching new DisplayItems with existing DisplayItems.
struct Id {
STACK_ALLOCATED();
- Id(const DisplayItemClient client, const Type type, const unsigned scope)
+ Id(const DisplayItemClient& client, const Type type, const unsigned scope)
: client(client)
, type(type)
, scope(scope) { }
@@ -223,12 +223,12 @@ public:
// We should always convert to non-cached types before matching.
ASSERT(!isCachedType(item.m_type));
ASSERT(!isCachedType(type));
- return client == item.m_client
+ return &client == item.m_client
&& type == item.m_type
&& scope == item.m_scope;
}
- const DisplayItemClient client;
+ const DisplayItemClient& client;
const Type type;
const unsigned scope;
};
@@ -246,12 +246,12 @@ public:
// Return the Id with cached type converted to non-cached type.
Id nonCachedId() const
{
- return Id(m_client, nonCachedType(m_type), m_scope);
+ return Id(*m_client, nonCachedType(m_type), m_scope);
}
virtual void replay(GraphicsContext&) const { }
- DisplayItemClient client() const { return m_client; }
+ const DisplayItemClient& client() const { ASSERT(m_client); return *m_client; }
Type type() const { return m_type; }
void setScope(unsigned scope) { m_scope = scope; }
@@ -345,7 +345,7 @@ public:
#ifndef NDEBUG
static WTF::String typeAsDebugString(DisplayItem::Type);
- const WTF::String& clientDebugString() const { return m_clientDebugString; }
+ const WTF::String clientDebugString() const { return m_clientDebugString; }
void setClientDebugString(const WTF::String& s) { m_clientDebugString = s; }
WTF::String asDebugString() const;
virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const;
@@ -365,7 +365,7 @@ private:
, m_skippedCache(false)
{ }
- const DisplayItemClient m_client;
+ const DisplayItemClient* m_client;
unsigned m_scope;
static_assert(TypeLast < (1 << 16), "DisplayItem::Type should fit in 16 bits");
const Type m_type : 16;
@@ -379,7 +379,7 @@ private:
class PLATFORM_EXPORT PairedBeginDisplayItem : public DisplayItem {
protected:
- PairedBeginDisplayItem(const DisplayItemClientWrapper& client, Type type, size_t derivedSize) : DisplayItem(client, type, derivedSize) { }
+ PairedBeginDisplayItem(const DisplayItemClient& client, Type type, size_t derivedSize) : DisplayItem(client, type, derivedSize) { }
private:
bool isBegin() const final { return true; }
@@ -387,7 +387,7 @@ private:
class PLATFORM_EXPORT PairedEndDisplayItem : public DisplayItem {
protected:
- PairedEndDisplayItem(const DisplayItemClientWrapper& client, Type type, size_t derivedSize) : DisplayItem(client, type, derivedSize) { }
+ PairedEndDisplayItem(const DisplayItemClient& client, Type type, size_t derivedSize) : DisplayItem(client, type, derivedSize) { }
#if ENABLE(ASSERT)
bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0;

Powered by Google App Engine
This is Rietveld 408576698