Index: third_party/WebKit/Source/platform/v8_inspector/Allocator.h |
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/Allocator_h.template b/third_party/WebKit/Source/platform/v8_inspector/Allocator.h |
similarity index 50% |
copy from third_party/WebKit/Source/platform/inspector_protocol/Allocator_h.template |
copy to third_party/WebKit/Source/platform/v8_inspector/Allocator.h |
index e38b76cd62b7d3fc12f54462e92312558e167bf9..ae03a085a8f7a37db16f67c872ec69ab10a5c888 100644 |
--- a/third_party/WebKit/Source/platform/inspector_protocol/Allocator_h.template |
+++ b/third_party/WebKit/Source/platform/v8_inspector/Allocator.h |
@@ -5,18 +5,29 @@ |
#ifndef Allocator_h |
#define Allocator_h |
+#include <cstddef> |
+#include <cstdint> |
+ |
enum NotNullTagEnum { NotNullLiteral }; |
-#define PROTOCOL_DISALLOW_NEW() \ |
+#define V8_INSPECTOR_DISALLOW_NEW() \ |
private: \ |
void* operator new(size_t) = delete; \ |
void* operator new(size_t, NotNullTagEnum, void*) = delete; \ |
void* operator new(size_t, void*) = delete; \ |
public: |
-#define PROTOCOL_DISALLOW_COPY(ClassName) \ |
+#define V8_INSPECTOR_DISALLOW_COPY(ClassName) \ |
private: \ |
ClassName(const ClassName&) = delete; \ |
ClassName& operator=(const ClassName&) = delete |
-#endif /* Allocator_h */ |
+// Macro that returns a compile time constant with the length of an array, but gives an error if passed a non-array. |
+template<typename T, std::size_t Size> char (&ArrayLengthHelperFunction(T (&)[Size]))[Size]; |
+// GCC needs some help to deduce a 0 length array. |
+#if defined(__GNUC__) |
+template<typename T> char (&ArrayLengthHelperFunction(T (&)[0]))[0]; |
+#endif |
+#define V8_INSPECTOR_ARRAY_LENGTH(array) sizeof(::ArrayLengthHelperFunction(array)) |
+ |
+#endif // !defined(Allocator_h) |