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

Unified Diff: third_party/WebKit/Source/platform/inspector_protocol/ValueConversions.h

Issue 1767883002: DevTools: generate string16-based handlers for v8_inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing 2 Created 4 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
Index: third_party/WebKit/Source/platform/inspector_protocol/ValueConversions.h
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/ValueConversions.h b/third_party/WebKit/Source/platform/inspector_protocol/ValueConversions.h
index ea2c39364c115c7c512247c7f1865ff6b4f723af..e8df222b07caa22140b48c3fc33f177975a6f835 100644
--- a/third_party/WebKit/Source/platform/inspector_protocol/ValueConversions.h
+++ b/third_party/WebKit/Source/platform/inspector_protocol/ValueConversions.h
@@ -7,8 +7,8 @@
#include "platform/PlatformExport.h"
#include "platform/inspector_protocol/ErrorSupport.h"
+#include "platform/inspector_protocol/String16.h"
#include "platform/inspector_protocol/Values.h"
-#include "wtf/text/WTFString.h"
namespace blink {
namespace protocol {
@@ -19,6 +19,8 @@ PLATFORM_EXPORT PassOwnPtr<protocol::Value> toValue(double value);
PLATFORM_EXPORT PassOwnPtr<protocol::Value> toValue(bool value);
+PLATFORM_EXPORT PassOwnPtr<protocol::Value> toValue(const String16& param);
+
PLATFORM_EXPORT PassOwnPtr<protocol::Value> toValue(const String& param);
PLATFORM_EXPORT PassOwnPtr<protocol::Value> toValue(protocol::Value* param);
@@ -92,7 +94,19 @@ template<>
struct FromValue<String> {
static String parse(protocol::Value* value, ErrorSupport* errors)
{
- String result;
+ String16 result;
+ bool success = value ? value->asString(&result) : false;
+ if (!success)
+ errors->addError("string value expected");
+ return result;
+ }
+};
+
+template<>
+struct FromValue<String16> {
+ static String16 parse(protocol::Value* value, ErrorSupport* errors)
+ {
+ String16 result;
bool success = value ? value->asString(&result) : false;
if (!success)
errors->addError("string value expected");
@@ -104,7 +118,6 @@ template<>
struct FromValue<Value> {
static PassOwnPtr<Value> parse(protocol::Value* value, ErrorSupport* errors)
{
- String result;
bool success = !!value;
if (!success)
errors->addError("value expected");
@@ -116,7 +129,6 @@ template<>
struct FromValue<DictionaryValue> {
static PassOwnPtr<DictionaryValue> parse(protocol::Value* value, ErrorSupport* errors)
{
- String result;
bool success = value && value->type() == protocol::Value::TypeObject;
if (!success)
errors->addError("object expected");
@@ -128,7 +140,6 @@ template<>
struct FromValue<ListValue> {
static PassOwnPtr<ListValue> parse(protocol::Value* value, ErrorSupport* errors)
{
- String result;
bool success = value && value->type() == protocol::Value::TypeArray;
if (!success)
errors->addError("list expected");

Powered by Google App Engine
This is Rietveld 408576698