Commit 066ace89 authored by Johannes Henkel's avatar Johannes Henkel Committed by Commit Bot

Roll inspector_protocol to 0d4255502019144a5dec5669d7992165ae8924e7.

https://chromium.googlesource.com/deps/inspector_protocol/+/0d4255502019144a5dec5669d7992165ae8924e7

Change-Id: I6a0f2fe8aae5cc79b7b01127c2d05cf296209e51
Reviewed-on: https://chromium-review.googlesource.com/1139098Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Johannes Henkel <johannes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575773}
parent e1e46ade
......@@ -3,7 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import convert_to_protocol_json
import convert_protocol_to_json
def main():
......
......@@ -2,7 +2,7 @@ Name: inspector protocol
Short Name: inspector_protocol
URL: https://chromium.googlesource.com/deps/inspector_protocol/
Version: 0
Revision: 5e219fd8e92b250684f978bf0ee237e83d77c682
Revision: 0d4255502019144a5dec5669d7992165ae8924e7
License: BSD
License File: LICENSE
Security Critical: no
......
#!/usr/bin/env python
# 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.
......@@ -604,7 +605,6 @@ def main():
# Note these should be sorted in the right order.
# TODO(dgozman): sort them programmatically based on commented includes.
lib_h_templates = [
"Collections_h.template",
"ErrorSupport_h.template",
"Values_h.template",
"Object_h.template",
......
#!/usr/bin/env python
# Copyright 2017 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.
......
#!/usr/bin/env python
# Copyright 2017 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.
import collections
import json
import os.path
import re
import sys
import pdl
# TODO(kozyatinskiy): remove with ConvertProtocolToJSON.py as soon as Node.js ready.
def main(argv):
if len(argv) < 2:
sys.stderr.write("Usage: %s <protocol.pdl> <protocol.json>\n" % sys.argv[0])
return 1
file_name = os.path.normpath(argv[0])
input_file = open(file_name, "r")
pdl_string = input_file.read()
protocol = pdl.loads(pdl_string, file_name)
input_file.close()
output_file = open(os.path.normpath(argv[1]), 'wb')
json.dump(protocol, output_file, indent=4, separators=(',', ': '))
output_file.close()
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
......@@ -33,7 +33,6 @@ template("inspector_protocol_generate") {
invoker.config_file,
"$inspector_protocol_dir/lib/Allocator_h.template",
"$inspector_protocol_dir/lib/Array_h.template",
"$inspector_protocol_dir/lib/Collections_h.template",
"$inspector_protocol_dir/lib/DispatcherBase_cpp.template",
"$inspector_protocol_dir/lib/DispatcherBase_h.template",
"$inspector_protocol_dir/lib/ErrorSupport_cpp.template",
......
......@@ -7,7 +7,6 @@
'inspector_protocol_files': [
'lib/Allocator_h.template',
'lib/Array_h.template',
'lib/Collections_h.template',
'lib/DispatcherBase_cpp.template',
'lib/DispatcherBase_h.template',
'lib/ErrorSupport_cpp.template',
......
// 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 {{"_".join(config.protocol.namespace)}}_Collections_h
#define {{"_".join(config.protocol.namespace)}}_Collections_h
#include {{format_include(config.protocol.package, "Forward")}}
#include <cstddef>
#if defined(__APPLE__) && !defined(_LIBCPP_VERSION)
#include <map>
#include <set>
{% for namespace in config.protocol.namespace %}
namespace {{namespace}} {
{% endfor %}
template <class Key, class T> using HashMap = std::map<Key, T>;
template <class Key> using HashSet = std::set<Key>;
{% for namespace in config.protocol.namespace %}
} // namespace {{namespace}}
{% endfor %}
#else
#include <unordered_map>
#include <unordered_set>
{% for namespace in config.protocol.namespace %}
namespace {{namespace}} {
{% endfor %}
template <class Key, class T> using HashMap = std::unordered_map<Key, T>;
template <class Key> using HashSet = std::unordered_set<Key>;
{% for namespace in config.protocol.namespace %}
} // namespace {{namespace}}
{% endfor %}
#endif // defined(__APPLE__) && !defined(_LIBCPP_VERSION)
#endif // !defined({{"_".join(config.protocol.namespace)}}_Collections_h)
......@@ -231,7 +231,7 @@ void UberDispatcher::registerBackend(const String& name, std::unique_ptr<protoco
m_dispatchers[name] = std::move(dispatcher);
}
void UberDispatcher::setupRedirects(const HashMap<String, String>& redirects)
void UberDispatcher::setupRedirects(const std::unordered_map<String, String>& redirects)
{
for (const auto& pair : redirects)
m_redirects[pair.first] = pair.second;
......@@ -269,7 +269,7 @@ DispatchResponse::Status UberDispatcher::dispatch(std::unique_ptr<Value> parsedM
return DispatchResponse::kError;
}
HashMap<String, String>::iterator redirectIt = m_redirects.find(method);
std::unordered_map<String, String>::iterator redirectIt = m_redirects.find(method);
if (redirectIt != m_redirects.end())
method = redirectIt->second;
......
......@@ -5,9 +5,8 @@
#ifndef {{"_".join(config.protocol.namespace)}}_DispatcherBase_h
#define {{"_".join(config.protocol.namespace)}}_DispatcherBase_h
//#include "Collections.h"
//#include "ErrorSupport.h"
//#include "Forward.h"
//#include "ErrorSupport.h"
//#include "Values.h"
{% for namespace in config.protocol.namespace %}
......@@ -101,7 +100,7 @@ public:
private:
FrontendChannel* m_frontendChannel;
protocol::HashSet<WeakPtr*> m_weakPtrs;
std::unordered_set<WeakPtr*> m_weakPtrs;
int m_lastCallbackId;
bool m_lastCallbackFallThrough;
};
......@@ -111,7 +110,7 @@ class {{config.lib.export_macro}} UberDispatcher {
public:
explicit UberDispatcher(FrontendChannel*);
void registerBackend(const String& name, std::unique_ptr<protocol::DispatcherBase>);
void setupRedirects(const HashMap<String, String>&);
void setupRedirects(const std::unordered_map<String, String>&);
DispatchResponse::Status dispatch(std::unique_ptr<Value> message, int* callId = nullptr, String* method = nullptr);
FrontendChannel* channel() { return m_frontendChannel; }
bool fallThroughForNotFound() { return m_fallThroughForNotFound; }
......@@ -122,8 +121,8 @@ public:
private:
FrontendChannel* m_frontendChannel;
bool m_fallThroughForNotFound;
HashMap<String, String> m_redirects;
protocol::HashMap<String, std::unique_ptr<protocol::DispatcherBase>> m_dispatchers;
std::unordered_map<String, String> m_redirects;
std::unordered_map<String, std::unique_ptr<protocol::DispatcherBase>> m_dispatchers;
};
class InternalResponse : public Serializable {
......
......@@ -5,7 +5,7 @@
#ifndef {{"_".join(config.protocol.namespace)}}_ErrorSupport_h
#define {{"_".join(config.protocol.namespace)}}_ErrorSupport_h
//#include "Forward.h"
#include {{format_include(config.protocol.package, "Forward")}}
{% for namespace in config.protocol.namespace %}
namespace {{namespace}} {
......
......@@ -10,7 +10,10 @@
{% endif %}
#include {{format_include(config.lib.string_header)}}
#include <cstddef>
#include <vector>
#include <unordered_map>
#include <unordered_set>
{% for namespace in config.protocol.namespace %}
namespace {{namespace}} {
......
......@@ -6,7 +6,6 @@
#define {{"_".join(config.protocol.namespace)}}_Values_h
//#include "Allocator.h"
//#include "Collections.h"
//#include "Forward.h"
{% for namespace in config.protocol.namespace %}
......@@ -200,7 +199,7 @@ private:
m_order.push_back(key);
}
using Dictionary = protocol::HashMap<String, std::unique_ptr<Value>>;
using Dictionary = std::unordered_map<String, std::unique_ptr<Value>>;
Dictionary m_data;
std::vector<String> m_order;
};
......
......@@ -211,13 +211,13 @@ public:
}
~DispatcherImpl() override { }
DispatchResponse::Status dispatch(int callId, const String& method, std::unique_ptr<protocol::DictionaryValue> messageObject) override;
HashMap<String, String>& redirects() { return m_redirects; }
std::unordered_map<String, String>& redirects() { return m_redirects; }
protected:
using CallHandler = DispatchResponse::Status (DispatcherImpl::*)(int callId, std::unique_ptr<DictionaryValue> messageObject, ErrorSupport* errors);
using DispatchMap = protocol::HashMap<String, CallHandler>;
using DispatchMap = std::unordered_map<String, CallHandler>;
DispatchMap m_dispatchMap;
HashMap<String, String> m_redirects;
std::unordered_map<String, String> m_redirects;
{% for command in domain.commands %}
{% if "redirect" in command %}{% continue %}{% endif %}
......@@ -231,7 +231,7 @@ protected:
DispatchResponse::Status DispatcherImpl::dispatch(int callId, const String& method, std::unique_ptr<protocol::DictionaryValue> messageObject)
{
protocol::HashMap<String, CallHandler>::iterator it = m_dispatchMap.find(method);
std::unordered_map<String, CallHandler>::iterator it = m_dispatchMap.find(method);
if (it == m_dispatchMap.end()) {
if (m_fallThroughForNotFound)
return DispatchResponse::kFallThrough;
......
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