| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DisplayItemClient_h | 5 #ifndef DisplayItemClient_h |
| 6 #define DisplayItemClient_h | 6 #define DisplayItemClient_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/heap/Heap.h" | 9 #include "platform/heap/Heap.h" |
| 10 #include "wtf/text/WTFString.h" | 10 #include "wtf/text/WTFString.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class DisplayItemClientInternalVoid; | 14 class DisplayItemClientInternalVoid; |
| 15 using DisplayItemClient = const DisplayItemClientInternalVoid*; | 15 using DisplayItemClient = const DisplayItemClientInternalVoid*; |
| 16 | 16 |
| 17 inline DisplayItemClient toDisplayItemClient(const void* object) { return static
_cast<DisplayItemClient>(object); } | 17 inline DisplayItemClient toDisplayItemClient(const void* object) { return static
_cast<DisplayItemClient>(object); } |
| 18 | 18 |
| 19 // Used to pass DisplayItemClient and debugName() (called only when needed) from | 19 // Used to pass DisplayItemClient and debugName() (called only when needed) from |
| 20 // core/layout module etc. to platform/paint module. | 20 // core/layout module etc. to platform/paint module. |
| 21 // The instance must not out-live the object. Long-time reference to a client mu
st | 21 // The instance must not out-live the object. Long-time reference to a client mu
st |
| 22 // use DisplayItemClient. | 22 // use DisplayItemClient. |
| 23 class PLATFORM_EXPORT DisplayItemClientWrapper { | 23 class PLATFORM_EXPORT DisplayItemClientWrapper { |
| 24 DISALLOW_ALLOCATION(); // Allow allocated in stack or in another object only
. | 24 DISALLOW_NEW(); // Allow allocated in stack or in another object only. |
| 25 public: | 25 public: |
| 26 template <typename T> | 26 template <typename T> |
| 27 DisplayItemClientWrapper(const T& object) | 27 DisplayItemClientWrapper(const T& object) |
| 28 : m_displayItemClient(object.displayItemClient()) | 28 : m_displayItemClient(object.displayItemClient()) |
| 29 , m_object(reinterpret_cast<const GenericClass&>(object)) | 29 , m_object(reinterpret_cast<const GenericClass&>(object)) |
| 30 , m_debugNameInvoker(&invokeDebugName<T>) | 30 , m_debugNameInvoker(&invokeDebugName<T>) |
| 31 { } | 31 { } |
| 32 | 32 |
| 33 DisplayItemClientWrapper(const DisplayItemClientWrapper& other) | 33 DisplayItemClientWrapper(const DisplayItemClientWrapper& other) |
| 34 : m_displayItemClient(other.m_displayItemClient) | 34 : m_displayItemClient(other.m_displayItemClient) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 48 | 48 |
| 49 DisplayItemClient m_displayItemClient; | 49 DisplayItemClient m_displayItemClient; |
| 50 const GenericClass& m_object; | 50 const GenericClass& m_object; |
| 51 using DebugNameInvoker = String(*)(const GenericClass&); | 51 using DebugNameInvoker = String(*)(const GenericClass&); |
| 52 DebugNameInvoker m_debugNameInvoker; | 52 DebugNameInvoker m_debugNameInvoker; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } | 55 } |
| 56 | 56 |
| 57 #endif // DisplayItemClient_h | 57 #endif // DisplayItemClient_h |
| OLD | NEW |