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

Unified Diff: third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template

Issue 2251343003: [DevTools] Generate separate copies of inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/Imported_h.template
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template b/third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template
index 2d4e11a469080752a67833f07bc6588efe7c2ea2..af97d50f2166ac0a53cc169a3613a48655a20b77 100644
--- a/third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template
+++ b/third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template
@@ -4,44 +4,54 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef protocol_{{domain.domain}}_imported_h
-#define protocol_{{domain.domain}}_imported_h
+#ifndef {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imported_h
+#define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imported_h
-#include "{{config.lib_package}}/InspectorProtocol.h"
+#include "{{config.protocol.package}}/InspectorProtocol.h"
#include "{{config.imported.package}}/{{domain.domain}}.h"
-namespace blink {
-namespace protocol {
+{% for namespace in config.protocol.namespace %}
+namespace {{namespace}} {
+{% endfor %}
{% for type in domain.types %}
{% if not (type.type == "object") or not ("properties" in type) or not (type.exported) %}{% continue %}{% endif %}
template<>
-struct ValueConversions<{{domain.domain}}::API::{{type.id}}> {
- static std::unique_ptr<{{domain.domain}}::API::{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors)
+struct ValueConversions<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}> {
+ static std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors)
{
if (!value) {
errors->addError("value expected");
return nullptr;
}
- std::unique_ptr<{{domain.domain}}::API::{{type.id}}> result = {{domain.domain}}::API::{{type.id}}::fromJSONString(value->toJSONString());
+ String json = value->toJSONString();
+ const UChar* characters = nullptr;
+ size_t length = 0;
+ StringUtil::toCharacters(json, &characters, &length);
+ std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}> result = {{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}::fromJSONString({{"::".join(config.imported.namespace)}}::String(characters, length));
if (!result)
errors->addError("cannot parse");
return result;
}
- static std::unique_ptr<protocol::Value> serialize({{domain.domain}}::API::{{type.id}}* value)
+ static std::unique_ptr<protocol::Value> serialize(const {{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}* value)
{
- return SerializedValue::create(value->toJSONString());
+ {{"::".join(config.imported.namespace)}}::String json = value->toJSONString();
+ const UChar* characters = nullptr;
+ size_t length = 0;
+ {{"::".join(config.imported.namespace)}}::StringUtil::toCharacters(json, &characters, &length);
+ return SerializedValue::create(String(characters, length));
}
- static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{domain.domain}}::API::{{type.id}}>& value)
+ static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}>& value)
{
- return SerializedValue::create(value->toJSONString());
+ return serialize(value.get());
}
};
{% endfor %}
-} // namespace protocol
-} // namespace blink
+{% for namespace in config.protocol.namespace %}
+} // namespace {{namespace}}
+{% endfor %}
-#endif // !defined(protocol_{{domain.domain}}_imported_h)
+#endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imported_h)

Powered by Google App Engine
This is Rietveld 408576698