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}
This commit is contained in:
kozyatinskiy 2016-11-04 15:46:54 -07:00 committed by Commit bot
parent f0fb658386
commit c7eb622635
7 changed files with 10 additions and 93 deletions

View File

@ -329,10 +329,6 @@ def resolve_type(protocol, prop):
return protocol.type_definitions[prop["type"]]
def new_style(domain):
return True
def join_arrays(dict, keys):
result = []
for key in keys:
@ -424,8 +420,7 @@ def main():
"resolve_type": functools.partial(resolve_type, protocol),
"type_definition": functools.partial(type_definition, protocol),
"has_disable": has_disable,
"format_include": format_include,
"new_style": new_style,
"format_include": format_include
}
if domain["domain"] in protocol.generate_domains:

View File

@ -2,7 +2,7 @@ Name: inspector protocol
Short Name: inspector_protocol
URL: https://chromium.googlesource.com/deps/inspector_protocol/
Version: 0
Revision: cf45a6e89b17cdc9eeacdef4c003fcc55f7ec2a0
Revision: ebda02bf94a742a2e26e4f818df1fc77517ac44c
License: BSD
License File: LICENSE
Security Critical: no
@ -14,4 +14,3 @@ description.
Local modifications:
- This only includes the lib/ and templates/ directories, scripts, build
and the LICENSE files.
- Used new style for all domains d in CodeGenerator.py.

View File

@ -8,17 +8,8 @@
namespace {{namespace}} {
{% endfor %}
ErrorSupport::ErrorSupport() : m_errorString(nullptr) { }
ErrorSupport::ErrorSupport(String* errorString) : m_errorString(errorString) { }
ErrorSupport::~ErrorSupport()
{
if (m_errorString && hasErrors()) {
StringBuilder builder;
builder.append("Internal error(s): ");
builder.append(errors());
*m_errorString = builder.toString();
}
}
ErrorSupport::ErrorSupport() { }
ErrorSupport::~ErrorSupport() { }
void ErrorSupport::setName(const String& name)
{

View File

@ -14,7 +14,6 @@ namespace {{namespace}} {
class {{config.lib.export_macro}} ErrorSupport {
public:
ErrorSupport();
ErrorSupport(String* errorString);
~ErrorSupport();
void push();
@ -27,7 +26,6 @@ public:
private:
std::vector<String> m_path;
std::vector<String> m_errors;
String* m_errorString;
};
{% for namespace in config.protocol.namespace %}

View File

@ -20,7 +20,6 @@ namespace {{namespace}} {
template<typename T> class Array;
class DictionaryValue;
class DispatchResponse;
using ErrorString = String;
class ErrorSupport;
class FundamentalValue;
class ListValue;

View File

@ -150,11 +150,7 @@ const char* {{ literal | to_title_case}} = "{{literal}}";
void Frontend::{{event.name}}(
{%- for parameter in event.parameters %}
{% if "optional" in parameter -%}
{%- if new_style(domain) -%}
Maybe<{{resolve_type(parameter).raw_type}}>
{%- else -%}
const Maybe<{{resolve_type(parameter).raw_type}}>&
{%- endif -%}
{%- else -%}
{{resolve_type(parameter).pass_type}}
{%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%}
@ -237,11 +233,7 @@ public:
void sendSuccess(
{%- for parameter in command.returns -%}
{%- if "optional" in parameter -%}
{%- if new_style(domain) -%}
Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}}
{%- else -%}
const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}}
{%- endif -%}
{%- else -%}
{{resolve_type(parameter).pass_type}} {{parameter.name}}
{%- endif -%}
@ -260,19 +252,11 @@ public:
sendIfActive(std::move(resultObject), DispatchResponse::OK());
}
{% if new_style(domain) %}
void sendFailure(const DispatchResponse& response) override
{
DCHECK(response.status() == DispatchResponse::kError);
sendIfActive(nullptr, response);
}
{% else %}
void sendFailure(const ErrorString& error) override
{
DCHECK(error.length());
sendIfActive(nullptr, DispatchResponse::Error(error));
}
{% endif %}
};
{% endif %}
@ -314,33 +298,21 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu
{% if not("async" in command) %}
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}}(
{%- endif -%}
{%- 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 new_style(domain) -%}
std::move(in_{{property.name}})
{%- else -%}
in_{{property.name}}
{%- endif -%}
{%- else -%}
{{resolve_type(property).to_pass_type % ("in_" + property.name)}}
{%- endif -%}
{%- endfor %}
{%- if "returns" in command %}
{%- 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}}
{%- endfor %}
{% endif %});
{% if not new_style(domain) %}
DispatchResponse response = error.length() ? DispatchResponse::Error(error) : DispatchResponse::OK();
{% endif %}
{% if "returns" in command %}
if (response.status() == DispatchResponse::kFallThrough)
return response.status();
@ -368,11 +340,7 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu
{%- for property in command.parameters -%}
{%- if not loop.first -%}, {% endif -%}
{%- if "optional" in property -%}
{%- if new_style(domain) -%}
std::move(in_{{property.name}})
{%- else -%}
in_{{property.name}}
{%- endif -%}
{%- else -%}
{{resolve_type(property).to_pass_type % ("in_" + property.name)}}
{%- endif -%}

View File

@ -196,40 +196,26 @@ public:
virtual void sendSuccess(
{%- for parameter in command.returns -%}
{%- if "optional" in parameter -%}
{%- if new_style(domain) -%}
Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}}
{%- else -%}
const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}}
{%- endif -%}
{%- else -%}
{{resolve_type(parameter).pass_type}} {{parameter.name}}
{%- endif -%}
{%- if not loop.last -%}, {% endif -%}
{%- endfor -%}
) = 0;
{% if new_style(domain) %}
virtual void sendFailure(const DispatchResponse&) = 0;
{% else %}
virtual void sendFailure(const ErrorString&) = 0;
{% endif %}
virtual ~{{command.name | to_title_case}}Callback() { }
};
{% endif %}
{%- if not("async" in command) and new_style(domain) %}
{%- if not("async" in command) %}
virtual DispatchResponse {{command.name}}(
{%- else %}
virtual void {{command.name}}(
{%- endif %}
{%- if not("async" in command) and not new_style(domain) -%}
ErrorString*
{%- endif -%}
{%- 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 new_style(domain) -%}
Maybe<{{resolve_type(parameter).raw_type}}> in_{{parameter.name}}
{%- else -%}
const Maybe<{{resolve_type(parameter).raw_type}}>& in_{{parameter.name}}
{%- endif -%}
{%- else -%}
{{resolve_type(parameter).pass_type}} in_{{parameter.name}}
{%- endif -%}
@ -239,7 +225,7 @@ public:
std::unique_ptr<{{command.name | to_title_case}}Callback> callback
{%- else -%}
{%- 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 -%}
Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name}}
{%- else -%}
@ -251,26 +237,11 @@ public:
{% endfor %}
{% if not has_disable(domain.commands) %}
{% if new_style(domain) %}
virtual DispatchResponse disable()
{
return DispatchResponse::OK();
}
{% else %}
virtual void disable(ErrorString*) { }
{% 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.
@ -283,11 +254,7 @@ public:
void {{event.name}}(
{%- for parameter in event.parameters -%}
{%- if "optional" in parameter -%}
{%- if new_style(domain) -%}
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 -%}
{{resolve_type(parameter).pass_type}} {{parameter.name}}
{%- endif -%}{%- if not loop.last -%}, {% endif -%}