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

Unified Diff: third_party/WebKit/Source/platform/json/JSONValues.h

Issue 2805473002: Add a const version of JSONObject::cast() (Closed)
Patch Set: Created 3 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/json/JSONValues.h
diff --git a/third_party/WebKit/Source/platform/json/JSONValues.h b/third_party/WebKit/Source/platform/json/JSONValues.h
index 4a37cd7913cff7254aa28ade9b781bf7856ca8c2..cb666a840d46d64fe7250a1f8590aa7cab364c23 100644
--- a/third_party/WebKit/Source/platform/json/JSONValues.h
+++ b/third_party/WebKit/Source/platform/json/JSONValues.h
@@ -177,6 +177,12 @@ class PLATFORM_EXPORT JSONObject : public JSONValue {
return static_cast<JSONObject*>(value);
}
+ static const JSONObject* cast(const JSONValue* value) {
+ if (!value || value->getType() != TypeObject)
+ return nullptr;
+ return static_cast<const JSONObject*>(value);
+ }
+
static std::unique_ptr<JSONObject> from(std::unique_ptr<JSONValue> value) {
auto maybeObject = WTF::wrapUnique(JSONObject::cast(value.get()));
if (maybeObject)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698