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

Unified Diff: Source/platform/JSONValues.h

Issue 991373002: Move IsPointerConvertible<T, JSONValue> specialization out of TypeTraits.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: clarify why this specialization is needed Created 5 years, 9 months 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
« no previous file with comments | « no previous file | Source/wtf/TypeTraits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/JSONValues.h
diff --git a/Source/platform/JSONValues.h b/Source/platform/JSONValues.h
index e57d08a60b8bb7c6c14422b2f7c353a140060cb8..e2653150e2889f48bd19afe02545353a97fb08aa 100644
--- a/Source/platform/JSONValues.h
+++ b/Source/platform/JSONValues.h
@@ -35,12 +35,42 @@
#include "wtf/Forward.h"
#include "wtf/HashMap.h"
#include "wtf/RefCounted.h"
+#include "wtf/TypeTraits.h"
#include "wtf/Vector.h"
#include "wtf/text/StringHash.h"
#include "wtf/text/WTFString.h"
namespace blink {
+class JSONValue;
+
+} // namespace blink
+
+namespace WTF {
+
+// FIXME: Avoid the need for this global upcasting to JSONValue (for PassRefPtr<T>.)
+// The current CodeGeneratorInspector.py generates code which order sorts its input
+// types and generates forward declarations where needed. But with inline uses
+// of setValue(PassRefPtr<JSONValue>) this is not quite sufficient for the
+// implicit conversion of PassRefPtr<T> to PassRefPtr<JSONValue> for a T that
+// has only been forward declared -- IsPointerConvertible<> doesn't have
+// complete types to work with.
+//
+// Work around that problem here by hackily declaring this global & unsafe
+// specialization.
+//
+// (InspectorTypeBuilder.h is the only piece of code that relies on this specialization.)
+template<typename From> class IsPointerConvertible<From, blink::JSONValue> {
+public:
+ enum {
+ Value = true
+ };
+};
+
+} // namespace WTF
+
+namespace blink {
+
class JSONArray;
class JSONObject;
@@ -316,4 +346,4 @@ public:
} // namespace blink
-#endif // !defined(JSONValues_h)
+#endif // JSONValues_h
« no previous file with comments | « no previous file | Source/wtf/TypeTraits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698