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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.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/DisplayItemClient.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h
index 32f312e8ba20c5410b5a3e2efe935bf693a279e1..eb2bc41ef80e1534c1c16d952781a59686933454 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h
@@ -6,52 +6,21 @@
#define DisplayItemClient_h
#include "platform/PlatformExport.h"
-#include "platform/heap/Heap.h"
#include "wtf/text/WTFString.h"
namespace blink {
-class DisplayItemClientInternalVoid;
-using DisplayItemClient = const DisplayItemClientInternalVoid*;
-
-inline DisplayItemClient toDisplayItemClient(const void* object) { return static_cast<DisplayItemClient>(object); }
-
-// Used to pass DisplayItemClient and debugName() (called only when needed) from
-// core/layout module etc. to platform/paint module.
-// The instance must not out-live the object. Long-time reference to a client must
-// use DisplayItemClient.
-class PLATFORM_EXPORT DisplayItemClientWrapper final {
- DISALLOW_NEW(); // Allow allocated in stack or in another object only.
+// The interface for objects that can be associated with display items.
+class PLATFORM_EXPORT DisplayItemClient {
public:
- template <typename T>
- DisplayItemClientWrapper(const T& object)
- : m_displayItemClient(object.displayItemClient())
- , m_object(reinterpret_cast<const GenericClass&>(object))
- , m_debugNameInvoker(&invokeDebugName<T>)
- { }
-
- DisplayItemClientWrapper(const DisplayItemClientWrapper& other)
- : m_displayItemClient(other.m_displayItemClient)
- , m_object(other.m_object)
- , m_debugNameInvoker(other.m_debugNameInvoker)
- { }
-
- DisplayItemClient displayItemClient() const { return m_displayItemClient; }
- String debugName() const { return m_debugNameInvoker(m_object); }
-
-private:
- DisplayItemClientWrapper& operator=(const DisplayItemClientWrapper&) = delete;
-
- class GenericClass;
- template <typename T>
- static String invokeDebugName(const GenericClass& object) { return reinterpret_cast<const T&>(object).debugName(); }
-
- DisplayItemClient m_displayItemClient;
- const GenericClass& m_object;
- using DebugNameInvoker = String(*)(const GenericClass&);
- DebugNameInvoker m_debugNameInvoker;
+ virtual ~DisplayItemClient() { }
+
+ virtual String debugName() const = 0;
};
+inline bool operator==(const DisplayItemClient& client1, const DisplayItemClient& client2) { return &client1 == &client2; }
+inline bool operator!=(const DisplayItemClient& client1, const DisplayItemClient& client2) { return &client1 != &client2; }
+
}
#endif // DisplayItemClient_h

Powered by Google App Engine
This is Rietveld 408576698