Commit c7eb6226 authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

Roll third_party/inspector_protocol to ebda02bf94a742a2e26e4f818df1fc77517ac44c

This roll includes:
  - [inspector_protocol] remove old style domains support
  - Add missing virtual destructor to backend callbacks. [2]

[1] https://codereview.chromium.org/2479693002/
[2] https://codereview.chromium.org/2473393002/

BUG=none
R=dgozman@chromium.org

Review-Url: https://codereview.chromium.org/2478853002
Cr-Commit-Position: refs/heads/master@{#40784}
parent f0fb6583
...@@ -329,10 +329,6 @@ def resolve_type(protocol, prop): ...@@ -329,10 +329,6 @@ def resolve_type(protocol, prop):
return protocol.type_definitions[prop["type"]] return protocol.type_definitions[prop["type"]]
def new_style(domain):
return True
def join_arrays(dict, keys): def join_arrays(dict, keys):
result = [] result = []
for key in keys: for key in keys:
...@@ -424,8 +420,7 @@ def main(): ...@@ -424,8 +420,7 @@ def main():
"resolve_type": functools.partial(resolve_type, protocol), "resolve_type": functools.partial(resolve_type, protocol),
"type_definition": functools.partial(type_definition, protocol), "type_definition": functools.partial(type_definition, protocol),
"has_disable": has_disable, "has_disable": has_disable,
"format_include": format_include, "format_include": format_include
"new_style": new_style,
} }
if domain["domain"] in protocol.generate_domains: if domain["domain"] in protocol.generate_domains:
......
...@@ -2,7 +2,7 @@ Name: inspector protocol ...@@ -2,7 +2,7 @@ Name: inspector protocol
Short Name: inspector_protocol Short Name: inspector_protocol
URL: https://chromium.googlesource.com/deps/inspector_protocol/ URL: https://chromium.googlesource.com/deps/inspector_protocol/
Version: 0 Version: 0
Revision: cf45a6e89b17cdc9eeacdef4c003fcc55f7ec2a0 Revision: ebda02bf94a742a2e26e4f818df1fc77517ac44c
License: BSD License: BSD
License File: LICENSE License File: LICENSE
Security Critical: no Security Critical: no
...@@ -14,4 +14,3 @@ description. ...@@ -14,4 +14,3 @@ description.
Local modifications: Local modifications:
- This only includes the lib/ and templates/ directories, scripts, build - This only includes the lib/ and templates/ directories, scripts, build
and the LICENSE files. and the LICENSE files.
- Used new style for all domains d in CodeGenerator.py.
...@@ -8,17 +8,8 @@ ...@@ -8,17 +8,8 @@
namespace {{namespace}} { namespace {{namespace}} {
{% endfor %} {% endfor %}
ErrorSupport::ErrorSupport() : m_errorString(nullptr) { } ErrorSupport::ErrorSupport() { }
ErrorSupport::ErrorSupport(String* errorString) : m_errorString(errorString) { } ErrorSupport::~ErrorSupport() { }
ErrorSupport::~ErrorSupport()
{
if (m_errorString && hasErrors()) {
StringBuilder builder;
builder.append("Internal error(s): ");
builder.append(errors());
*m_errorString = builder.toString();
}
}
void ErrorSupport::setName(const String& name) void ErrorSupport::setName(const String& name)
{ {
......
...@@ -14,7 +14,6 @@ namespace {{namespace}} { ...@@ -14,7 +14,6 @@ namespace {{namespace}} {
class {{config.lib.export_macro}} ErrorSupport { class {{config.lib.export_macro}} ErrorSupport {
public: public:
ErrorSupport(); ErrorSupport();
ErrorSupport(String* errorString);
~ErrorSupport(); ~ErrorSupport();
void push(); void push();
...@@ -27,7 +26,6 @@ public: ...@@ -27,7 +26,6 @@ public:
private: private:
std::vector<String> m_path; std::vector<String> m_path;
std::vector<String> m_errors; std::vector<String> m_errors;
String* m_errorString;
}; };
{% for namespace in config.protocol.namespace %} {% for namespace in config.protocol.namespace %}
......
...@@ -20,7 +20,6 @@ namespace {{namespace}} { ...@@ -20,7 +20,6 @@ namespace {{namespace}} {
template<typename T> class Array; template<typename T> class Array;
class DictionaryValue; class DictionaryValue;
class DispatchResponse; class DispatchResponse;
using ErrorString = String;
class ErrorSupport; class ErrorSupport;
class FundamentalValue; class FundamentalValue;
class ListValue; class ListValue;
......
...@@ -150,11 +150,7 @@ const char* {{ literal | to_title_case}} = "{{literal}}"; ...@@ -150,11 +150,7 @@ const char* {{ literal | to_title_case}} = "{{literal}}";
void Frontend::{{event.name}}( void Frontend::{{event.name}}(
{%- for parameter in event.parameters %} {%- for parameter in event.parameters %}
{% if "optional" in parameter -%} {% if "optional" in parameter -%}
{%- if new_style(domain) -%}
Maybe<{{resolve_type(parameter).raw_type}}> Maybe<{{resolve_type(parameter).raw_type}}>
{%- else -%}
const Maybe<{{resolve_type(parameter).raw_type}}>&
{%- endif -%}
{%- else -%} {%- else -%}
{{resolve_type(parameter).pass_type}} {{resolve_type(parameter).pass_type}}
{%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%} {%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%}
...@@ -237,12 +233,8 @@ public: ...@@ -237,12 +233,8 @@ public:
void sendSuccess( void sendSuccess(
{%- for parameter in command.returns -%} {%- for parameter in command.returns -%}
{%- if "optional" in parameter -%} {%- if "optional" in parameter -%}
{%- if new_style(domain) -%}
Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}} Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}}
{%- else -%} {%- else -%}
const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}}
{%- endif -%}
{%- else -%}
{{resolve_type(parameter).pass_type}} {{parameter.name}} {{resolve_type(parameter).pass_type}} {{parameter.name}}
{%- endif -%} {%- endif -%}
{%- if not loop.last -%}, {% endif -%} {%- if not loop.last -%}, {% endif -%}
...@@ -260,19 +252,11 @@ public: ...@@ -260,19 +252,11 @@ public:
sendIfActive(std::move(resultObject), DispatchResponse::OK()); sendIfActive(std::move(resultObject), DispatchResponse::OK());
} }
{% if new_style(domain) %}
void sendFailure(const DispatchResponse& response) override void sendFailure(const DispatchResponse& response) override
{ {
DCHECK(response.status() == DispatchResponse::kError); DCHECK(response.status() == DispatchResponse::kError);
sendIfActive(nullptr, response); sendIfActive(nullptr, response);
} }
{% else %}
void sendFailure(const ErrorString& error) override
{
DCHECK(error.length());
sendIfActive(nullptr, DispatchResponse::Error(error));
}
{% endif %}
}; };
{% endif %} {% endif %}
...@@ -314,33 +298,21 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu ...@@ -314,33 +298,21 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu
{% if not("async" in command) %} {% if not("async" in command) %}
std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr(); std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
{% if not new_style(domain) %}
ErrorString error;
m_backend->{{command.name}}(&error
{%- else %}
DispatchResponse response = m_backend->{{command.name}}( DispatchResponse response = m_backend->{{command.name}}(
{%- endif -%}
{%- for property in command.parameters -%} {%- for property in command.parameters -%}
{%- if not loop.first or not new_style(domain) -%}, {% endif -%} {%- if not loop.first -%}, {% endif -%}
{%- if "optional" in property -%} {%- if "optional" in property -%}
{%- if new_style(domain) -%}
std::move(in_{{property.name}}) std::move(in_{{property.name}})
{%- else -%} {%- else -%}
in_{{property.name}}
{%- endif -%}
{%- else -%}
{{resolve_type(property).to_pass_type % ("in_" + property.name)}} {{resolve_type(property).to_pass_type % ("in_" + property.name)}}
{%- endif -%} {%- endif -%}
{%- endfor %} {%- endfor %}
{%- if "returns" in command %} {%- if "returns" in command %}
{%- for property in command.returns -%} {%- for property in command.returns -%}
{%- if not loop.first or command.parameters or not new_style(domain) -%}, {% endif -%} {%- if not loop.first or command.parameters -%}, {% endif -%}
&out_{{property.name}} &out_{{property.name}}
{%- endfor %} {%- endfor %}
{% endif %}); {% endif %});
{% if not new_style(domain) %}
DispatchResponse response = error.length() ? DispatchResponse::Error(error) : DispatchResponse::OK();
{% endif %}
{% if "returns" in command %} {% if "returns" in command %}
if (response.status() == DispatchResponse::kFallThrough) if (response.status() == DispatchResponse::kFallThrough)
return response.status(); return response.status();
...@@ -368,12 +340,8 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu ...@@ -368,12 +340,8 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu
{%- for property in command.parameters -%} {%- for property in command.parameters -%}
{%- if not loop.first -%}, {% endif -%} {%- if not loop.first -%}, {% endif -%}
{%- if "optional" in property -%} {%- if "optional" in property -%}
{%- if new_style(domain) -%}
std::move(in_{{property.name}}) std::move(in_{{property.name}})
{%- else -%} {%- else -%}
in_{{property.name}}
{%- endif -%}
{%- else -%}
{{resolve_type(property).to_pass_type % ("in_" + property.name)}} {{resolve_type(property).to_pass_type % ("in_" + property.name)}}
{%- endif -%} {%- endif -%}
{%- endfor -%} {%- endfor -%}
......
...@@ -196,40 +196,26 @@ public: ...@@ -196,40 +196,26 @@ public:
virtual void sendSuccess( virtual void sendSuccess(
{%- for parameter in command.returns -%} {%- for parameter in command.returns -%}
{%- if "optional" in parameter -%} {%- if "optional" in parameter -%}
{%- if new_style(domain) -%}
Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}} Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}}
{%- else -%}
const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}}
{%- endif -%}
{%- else -%} {%- else -%}
{{resolve_type(parameter).pass_type}} {{parameter.name}} {{resolve_type(parameter).pass_type}} {{parameter.name}}
{%- endif -%} {%- endif -%}
{%- if not loop.last -%}, {% endif -%} {%- if not loop.last -%}, {% endif -%}
{%- endfor -%} {%- endfor -%}
) = 0; ) = 0;
{% if new_style(domain) %}
virtual void sendFailure(const DispatchResponse&) = 0; virtual void sendFailure(const DispatchResponse&) = 0;
{% else %} virtual ~{{command.name | to_title_case}}Callback() { }
virtual void sendFailure(const ErrorString&) = 0;
{% endif %}
}; };
{% endif %} {% endif %}
{%- if not("async" in command) and new_style(domain) %} {%- if not("async" in command) %}
virtual DispatchResponse {{command.name}}( virtual DispatchResponse {{command.name}}(
{%- else %} {%- else %}
virtual void {{command.name}}( virtual void {{command.name}}(
{%- endif %} {%- endif %}
{%- if not("async" in command) and not new_style(domain) -%}
ErrorString*
{%- endif -%}
{%- for parameter in command.parameters -%} {%- for parameter in command.parameters -%}
{%- if (not loop.first) or (not ("async" in command) and not new_style(domain)) -%}, {% endif -%} {%- if not loop.first -%}, {% endif -%}
{%- if "optional" in parameter -%} {%- if "optional" in parameter -%}
{%- if new_style(domain) -%}
Maybe<{{resolve_type(parameter).raw_type}}> in_{{parameter.name}} Maybe<{{resolve_type(parameter).raw_type}}> in_{{parameter.name}}
{%- else -%}
const Maybe<{{resolve_type(parameter).raw_type}}>& in_{{parameter.name}}
{%- endif -%}
{%- else -%} {%- else -%}
{{resolve_type(parameter).pass_type}} in_{{parameter.name}} {{resolve_type(parameter).pass_type}} in_{{parameter.name}}
{%- endif -%} {%- endif -%}
...@@ -239,7 +225,7 @@ public: ...@@ -239,7 +225,7 @@ public:
std::unique_ptr<{{command.name | to_title_case}}Callback> callback std::unique_ptr<{{command.name | to_title_case}}Callback> callback
{%- else -%} {%- else -%}
{%- for parameter in command.returns -%} {%- for parameter in command.returns -%}
{%- if (not loop.first) or command.parameters or not new_style(domain) -%}, {% endif -%} {%- if (not loop.first) or command.parameters -%}, {% endif -%}
{%- if "optional" in parameter -%} {%- if "optional" in parameter -%}
Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name}} Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name}}
{%- else -%} {%- else -%}
...@@ -251,26 +237,11 @@ public: ...@@ -251,26 +237,11 @@ public:
{% endfor %} {% endfor %}
{% if not has_disable(domain.commands) %} {% if not has_disable(domain.commands) %}
{% if new_style(domain) %}
virtual DispatchResponse disable() virtual DispatchResponse disable()
{ {
return DispatchResponse::OK(); return DispatchResponse::OK();
} }
{% else %}
virtual void disable(ErrorString*) { }
{% endif %} {% endif %}
{% endif %}
// TODO(dgozman): remove once all domains migrated.
static void disableMe(Backend* backend)
{
{% if new_style(domain) %}
backend->disable();
{% else %}
ErrorString error;
backend->disable(&error);
{% endif %}
}
}; };
// ------------- Frontend interface. // ------------- Frontend interface.
...@@ -283,11 +254,7 @@ public: ...@@ -283,11 +254,7 @@ public:
void {{event.name}}( void {{event.name}}(
{%- for parameter in event.parameters -%} {%- for parameter in event.parameters -%}
{%- if "optional" in parameter -%} {%- if "optional" in parameter -%}
{%- if new_style(domain) -%}
Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}} = Maybe<{{resolve_type(parameter).raw_type}}>() Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}} = Maybe<{{resolve_type(parameter).raw_type}}>()
{%- else -%}
const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}} = Maybe<{{resolve_type(parameter).raw_type}}>()
{%- endif -%}
{%- else -%} {%- else -%}
{{resolve_type(parameter).pass_type}} {{parameter.name}} {{resolve_type(parameter).pass_type}} {{parameter.name}}
{%- endif -%}{%- if not loop.last -%}, {% endif -%} {%- endif -%}{%- if not loop.last -%}, {% endif -%}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment