Commit 246110ed authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Commit Bot

Roll third_party/inspector_protocol to 1c471db574e6252b65df9b7b42e726185a9d8fa6

Bug: 775132
Change-Id: Ib31b7e9e5ef031abd47b4608bec5accb9181311e
Reviewed-on: https://chromium-review.googlesource.com/1217592Reviewed-by: default avatarPavel Feldman <pfeldman@chromium.org>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590108}
parent c1381d9c
...@@ -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: c22d4bd88fb7a39bc41c3b1adcdd733cc9b5e8ea Revision: 1c471db574e6252b65df9b7b42e726185a9d8fa6
License: BSD License: BSD
License File: LICENSE License File: LICENSE
Security Critical: no Security Critical: no
......
...@@ -246,10 +246,6 @@ bool UberDispatcher::parseCommand(Value* parsedMessage, int* outCallId, String* ...@@ -246,10 +246,6 @@ bool UberDispatcher::parseCommand(Value* parsedMessage, int* outCallId, String*
reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kInvalidRequest, "Message must have string 'method' property", nullptr); reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kInvalidRequest, "Message must have string 'method' property", nullptr);
return false; return false;
} }
std::unordered_map<String, String>::iterator redirectIt = m_redirects.find(method);
if (redirectIt != m_redirects.end())
method = redirectIt->second;
if (outMethod) if (outMethod)
*outMethod = method; *outMethod = method;
return true; return true;
...@@ -268,13 +264,21 @@ protocol::DispatcherBase* UberDispatcher::findDispatcher(const String& method) { ...@@ -268,13 +264,21 @@ protocol::DispatcherBase* UberDispatcher::findDispatcher(const String& method) {
return it->second.get(); return it->second.get();
} }
bool UberDispatcher::canDispatch(const String& method) bool UberDispatcher::canDispatch(const String& in_method)
{ {
String method = in_method;
auto redirectIt = m_redirects.find(method);
if (redirectIt != m_redirects.end())
method = redirectIt->second;
return !!findDispatcher(method); return !!findDispatcher(method);
} }
void UberDispatcher::dispatch(int callId, const String& method, std::unique_ptr<Value> parsedMessage, const String& rawMessage) void UberDispatcher::dispatch(int callId, const String& in_method, std::unique_ptr<Value> parsedMessage, const String& rawMessage)
{ {
String method = in_method;
auto redirectIt = m_redirects.find(method);
if (redirectIt != m_redirects.end())
method = redirectIt->second;
protocol::DispatcherBase* dispatcher = findDispatcher(method); protocol::DispatcherBase* dispatcher = findDispatcher(method);
if (!dispatcher) { if (!dispatcher) {
reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kMethodNotFound, "'" + method + "' wasn't found", nullptr); reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kMethodNotFound, "'" + method + "' wasn't found", nullptr);
......
...@@ -20,7 +20,7 @@ public: ...@@ -20,7 +20,7 @@ public:
enum Status { enum Status {
kSuccess = 0, kSuccess = 0,
kError = 1, kError = 1,
kFallThrough = 2 kFallThrough = 2,
}; };
enum ErrorCode { enum ErrorCode {
......
...@@ -5,6 +5,41 @@ ...@@ -5,6 +5,41 @@
#ifndef {{"_".join(config.protocol.namespace)}}_Maybe_h #ifndef {{"_".join(config.protocol.namespace)}}_Maybe_h
#define {{"_".join(config.protocol.namespace)}}_Maybe_h #define {{"_".join(config.protocol.namespace)}}_Maybe_h
// This macro allows to test for the version of the GNU C++ compiler.
// Note that this also applies to compilers that masquerade as GCC,
// for example clang and the Intel C++ compiler for Linux.
// Use like:
// #if IP_GNUC_PREREQ(4, 3, 1)
// ...
// #endif
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
#define IP_GNUC_PREREQ(major, minor, patchlevel) \
((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= \
((major)*10000 + (minor)*100 + (patchlevel)))
#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
#define IP_GNUC_PREREQ(major, minor, patchlevel) \
((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= \
((major)*10000 + (minor)*100 + (patchlevel)))
#else
#define IP_GNUC_PREREQ(major, minor, patchlevel) 0
#endif
#if defined(__mips64)
#define IP_TARGET_ARCH_MIPS64 1
#elif defined(__MIPSEB__) || defined(__MIPSEL__)
#define IP_TARGET_ARCH_MIPS 1
#endif
// Allowing the use of noexcept by removing the keyword on older compilers that
// do not support adding noexcept to default members.
#if ((IP_GNUC_PREREQ(4, 9, 0) && !defined(IP_TARGET_ARCH_MIPS) && \
!defined(IP_TARGET_ARCH_MIPS64)) || \
(defined(__clang__) && __cplusplus > 201300L))
#define IP_NOEXCEPT noexcept
#else
#define IP_NOEXCEPT
#endif
//#include "Forward.h" //#include "Forward.h"
{% for namespace in config.protocol.namespace %} {% for namespace in config.protocol.namespace %}
...@@ -16,7 +51,7 @@ class Maybe { ...@@ -16,7 +51,7 @@ class Maybe {
public: public:
Maybe() : m_value() { } Maybe() : m_value() { }
Maybe(std::unique_ptr<T> value) : m_value(std::move(value)) { } Maybe(std::unique_ptr<T> value) : m_value(std::move(value)) { }
Maybe(Maybe&& other) : m_value(std::move(other.m_value)) { } Maybe(Maybe&& other) IP_NOEXCEPT : m_value(std::move(other.m_value)) {}
void operator=(std::unique_ptr<T> value) { m_value = std::move(value); } void operator=(std::unique_ptr<T> value) { m_value = std::move(value); }
T* fromJust() const { DCHECK(m_value); return m_value.get(); } T* fromJust() const { DCHECK(m_value); return m_value.get(); }
T* fromMaybe(T* defaultValue) const { return m_value ? m_value.get() : defaultValue; } T* fromMaybe(T* defaultValue) const { return m_value ? m_value.get() : defaultValue; }
...@@ -31,7 +66,9 @@ class MaybeBase { ...@@ -31,7 +66,9 @@ class MaybeBase {
public: public:
MaybeBase() : m_isJust(false) { } MaybeBase() : m_isJust(false) { }
MaybeBase(T value) : m_isJust(true), m_value(value) { } MaybeBase(T value) : m_isJust(true), m_value(value) { }
MaybeBase(MaybeBase&& other) : m_isJust(other.m_isJust), m_value(std::move(other.m_value)) { } MaybeBase(MaybeBase&& other) IP_NOEXCEPT
: m_isJust(other.m_isJust),
m_value(std::move(other.m_value)) {}
void operator=(T value) { m_value = value; m_isJust = true; } void operator=(T value) { m_value = value; m_isJust = true; }
T fromJust() const { DCHECK(m_isJust); return m_value; } T fromJust() const { DCHECK(m_isJust); return m_value; }
T fromMaybe(const T& defaultValue) const { return m_isJust ? m_value : defaultValue; } T fromMaybe(const T& defaultValue) const { return m_isJust ? m_value : defaultValue; }
...@@ -48,7 +85,7 @@ class Maybe<bool> : public MaybeBase<bool> { ...@@ -48,7 +85,7 @@ class Maybe<bool> : public MaybeBase<bool> {
public: public:
Maybe() { } Maybe() { }
Maybe(bool value) : MaybeBase(value) { } Maybe(bool value) : MaybeBase(value) { }
Maybe(Maybe&& other) : MaybeBase(std::move(other)) { } Maybe(Maybe&& other) IP_NOEXCEPT : MaybeBase(std::move(other)) {}
using MaybeBase::operator=; using MaybeBase::operator=;
}; };
...@@ -57,7 +94,7 @@ class Maybe<int> : public MaybeBase<int> { ...@@ -57,7 +94,7 @@ class Maybe<int> : public MaybeBase<int> {
public: public:
Maybe() { } Maybe() { }
Maybe(int value) : MaybeBase(value) { } Maybe(int value) : MaybeBase(value) { }
Maybe(Maybe&& other) : MaybeBase(std::move(other)) { } Maybe(Maybe&& other) IP_NOEXCEPT : MaybeBase(std::move(other)) {}
using MaybeBase::operator=; using MaybeBase::operator=;
}; };
...@@ -66,7 +103,7 @@ class Maybe<double> : public MaybeBase<double> { ...@@ -66,7 +103,7 @@ class Maybe<double> : public MaybeBase<double> {
public: public:
Maybe() { } Maybe() { }
Maybe(double value) : MaybeBase(value) { } Maybe(double value) : MaybeBase(value) { }
Maybe(Maybe&& other) : MaybeBase(std::move(other)) { } Maybe(Maybe&& other) IP_NOEXCEPT : MaybeBase(std::move(other)) {}
using MaybeBase::operator=; using MaybeBase::operator=;
}; };
...@@ -75,7 +112,7 @@ class Maybe<String> : public MaybeBase<String> { ...@@ -75,7 +112,7 @@ class Maybe<String> : public MaybeBase<String> {
public: public:
Maybe() { } Maybe() { }
Maybe(const String& value) : MaybeBase(value) { } Maybe(const String& value) : MaybeBase(value) { }
Maybe(Maybe&& other) : MaybeBase(std::move(other)) { } Maybe(Maybe&& other) IP_NOEXCEPT : MaybeBase(std::move(other)) {}
using MaybeBase::operator=; using MaybeBase::operator=;
}; };
...@@ -83,4 +120,9 @@ public: ...@@ -83,4 +120,9 @@ public:
} // namespace {{namespace}} } // namespace {{namespace}}
{% endfor %} {% endfor %}
#undef IP_GNUC_PREREQ
#undef IP_TARGET_ARCH_MIPS64
#undef IP_TARGET_ARCH_MIPS
#undef IP_NOEXCEPT
#endif // !defined({{"_".join(config.protocol.namespace)}}_Maybe_h) #endif // !defined({{"_".join(config.protocol.namespace)}}_Maybe_h)
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