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

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

Issue 2238423002: [DevTools] Generate all files in inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2240663003
Patch Set: Created 4 years, 4 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
deleted file mode 100644
index fe30a4e9000c93599c31a38d751526ef2647384e..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/platform/inspector_protocol/ValueConversions.h
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ValueConversions_h
-#define ValueConversions_h
-
-#include "platform/inspector_protocol/ErrorSupport.h"
-#include "platform/inspector_protocol/Platform.h"
-#include "platform/inspector_protocol/String16.h"
-#include "platform/inspector_protocol/Values.h"
-
-namespace blink {
-namespace protocol {
-
-template<typename T>
-struct ValueConversions {
- static std::unique_ptr<T> parse(protocol::Value* value, ErrorSupport* errors)
- {
- return T::parse(value, errors);
- }
-
- static std::unique_ptr<protocol::Value> serialize(T* value)
- {
- return value->serialize();
- }
-
- static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<T>& value)
- {
- return value->serialize();
- }
-};
-
-template<>
-struct ValueConversions<bool> {
- static bool parse(protocol::Value* value, ErrorSupport* errors)
- {
- bool result = false;
- bool success = value ? value->asBoolean(&result) : false;
- if (!success)
- errors->addError("boolean value expected");
- return result;
- }
-
- static std::unique_ptr<protocol::Value> serialize(bool value)
- {
- return FundamentalValue::create(value);
- }
-};
-
-template<>
-struct ValueConversions<int> {
- static int parse(protocol::Value* value, ErrorSupport* errors)
- {
- int result = 0;
- bool success = value ? value->asInteger(&result) : false;
- if (!success)
- errors->addError("integer value expected");
- return result;
- }
-
- static std::unique_ptr<protocol::Value> serialize(int value)
- {
- return FundamentalValue::create(value);
- }
-};
-
-template<>
-struct ValueConversions<double> {
- static double parse(protocol::Value* value, ErrorSupport* errors)
- {
- double result = 0;
- bool success = value ? value->asDouble(&result) : false;
- if (!success)
- errors->addError("double value expected");
- return result;
- }
-
- static std::unique_ptr<protocol::Value> serialize(double value)
- {
- return FundamentalValue::create(value);
- }
-};
-
-template<>
-struct ValueConversions<InspectorProtocolConvenienceStringType> {
- static InspectorProtocolConvenienceStringType parse(protocol::Value* value, ErrorSupport* errors)
- {
- String16 result;
- bool success = value ? value->asString(&result) : false;
- if (!success)
- errors->addError("string value expected");
- return result;
- }
-
- static std::unique_ptr<protocol::Value> serialize(const InspectorProtocolConvenienceStringType& value)
- {
- return StringValue::create(value);
- }
-};
-
-template<>
-struct ValueConversions<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");
- return result;
- }
-
- static std::unique_ptr<protocol::Value> serialize(const String16& value)
- {
- return StringValue::create(value);
- }
-};
-
-template<>
-struct ValueConversions<Value> {
- static std::unique_ptr<Value> parse(protocol::Value* value, ErrorSupport* errors)
- {
- bool success = !!value;
- if (!success) {
- errors->addError("value expected");
- return nullptr;
- }
- return value->clone();
- }
-
- static std::unique_ptr<protocol::Value> serialize(Value* value)
- {
- return value->clone();
- }
-
- static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<Value>& value)
- {
- return value->clone();
- }
-};
-
-template<>
-struct ValueConversions<DictionaryValue> {
- static std::unique_ptr<DictionaryValue> parse(protocol::Value* value, ErrorSupport* errors)
- {
- bool success = value && value->type() == protocol::Value::TypeObject;
- if (!success)
- errors->addError("object expected");
- return DictionaryValue::cast(value->clone());
- }
-
- static std::unique_ptr<protocol::Value> serialize(DictionaryValue* value)
- {
- return value->clone();
- }
-
- static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<DictionaryValue>& value)
- {
- return value->clone();
- }
-};
-
-template<>
-struct ValueConversions<ListValue> {
- static std::unique_ptr<ListValue> parse(protocol::Value* value, ErrorSupport* errors)
- {
- bool success = value && value->type() == protocol::Value::TypeArray;
- if (!success)
- errors->addError("list expected");
- return ListValue::cast(value->clone());
- }
-
- static std::unique_ptr<protocol::Value> serialize(ListValue* value)
- {
- return value->clone();
- }
-
- static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<ListValue>& value)
- {
- return value->clone();
- }
-};
-
-} // namespace platform
-} // namespace blink
-
-#endif // !defined(ValueConversions_h)

Powered by Google App Engine
This is Rietveld 408576698