Skip to content

Commit

Permalink
deps: v8_inspector update
Browse files Browse the repository at this point in the history
Pick up latest from [1] corresponding to the Blink commit 62cd277.

[1]: pavelfeldman/v8_inspector@e6b8355

PR-URL: #8014
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
ofrobots authored and cjihrig committed Aug 11, 2016
1 parent 2e43599 commit a9fe85e
Show file tree
Hide file tree
Showing 69 changed files with 2,404 additions and 1,941 deletions.
1 change: 1 addition & 0 deletions deps/v8_inspector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ Node.js support for the [Chrome Debug Protocol][https://developer.chrome.com/dev
* third_party/v8_inspector/platform/v8_inspector: vendored from https://chromium.googlesource.com/chromium/src/third_party/WebKit/Source/platform/v8_inspector
* third_party/v8_inspector/platform/inspector_protocol: vendored from https://chromium.googlesource.com/chromium/src/third_party/WebKit/Source/platform/inspector_protocol
* third_party/jinja2: vendored from https://github.com/mitsuhiko/jinja2
* The `tests/` directory `ext/jinja.el` file have been deleted.
* third_party/markupsafe: vendored from https://github.com/mitsuhiko/markupsafe
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace blink {
namespace protocol {

template<typename T>
class ArrayBase {
class Array {
public:
static std::unique_ptr<Array<T>> create()
{
Expand All @@ -31,54 +31,48 @@ class ArrayBase {
errors->addError("array expected");
return nullptr;
}
errors->push();
std::unique_ptr<Array<T>> result(new Array<T>());
errors->push();
for (size_t i = 0; i < array->size(); ++i) {
errors->setName(String16::fromInteger(i));
T item = FromValue<T>::parse(array->at(i), errors);
result->m_vector.push_back(item);
std::unique_ptr<T> item = ValueConversions<T>::parse(array->at(i), errors);
result->m_vector.push_back(std::move(item));
}
errors->pop();
if (errors->hasErrors())
return nullptr;
return result;
}

void addItem(const T& value)
void addItem(std::unique_ptr<T> value)
{
m_vector.push_back(value);
m_vector.push_back(std::move(value));
}

size_t length()
{
return m_vector.size();
}

T get(size_t index)
T* get(size_t index)
{
return m_vector[index];
return m_vector[index].get();
}

std::unique_ptr<protocol::ListValue> serialize()
{
std::unique_ptr<protocol::ListValue> result = ListValue::create();
for (auto& item : m_vector)
result->pushValue(toValue(item));
result->pushValue(ValueConversions<T>::serialize(item));
return result;
}

private:
std::vector<T> m_vector;
std::vector<std::unique_ptr<T>> m_vector;
};

template<> class Array<String> : public ArrayBase<String> {};
template<> class Array<String16> : public ArrayBase<String16> {};
template<> class Array<int> : public ArrayBase<int> {};
template<> class Array<double> : public ArrayBase<double> {};
template<> class Array<bool> : public ArrayBase<bool> {};

template<typename T>
class Array {
class ArrayBase {
public:
static std::unique_ptr<Array<T>> create()
{
Expand All @@ -92,46 +86,52 @@ class Array {
errors->addError("array expected");
return nullptr;
}
std::unique_ptr<Array<T>> result(new Array<T>());
errors->push();
std::unique_ptr<Array<T>> result(new Array<T>());
for (size_t i = 0; i < array->size(); ++i) {
errors->setName(String16::fromInteger(i));
std::unique_ptr<T> item = FromValue<T>::parse(array->at(i), errors);
result->m_vector.push_back(std::move(item));
T item = ValueConversions<T>::parse(array->at(i), errors);
result->m_vector.push_back(item);
}
errors->pop();
if (errors->hasErrors())
return nullptr;
return result;
}

void addItem(std::unique_ptr<T> value)
void addItem(const T& value)
{
m_vector.push_back(std::move(value));
m_vector.push_back(value);
}

size_t length()
{
return m_vector.size();
}

T* get(size_t index)
T get(size_t index)
{
return m_vector[index].get();
return m_vector[index];
}

std::unique_ptr<protocol::ListValue> serialize()
{
std::unique_ptr<protocol::ListValue> result = ListValue::create();
for (auto& item : m_vector)
result->pushValue(toValue(item));
result->pushValue(ValueConversions<T>::serialize(item));
return result;
}

private:
std::vector<std::unique_ptr<T>> m_vector;
std::vector<T> m_vector;
};

template<> class Array<String> : public ArrayBase<String> {};
template<> class Array<String16> : public ArrayBase<String16> {};
template<> class Array<int> : public ArrayBase<int> {};
template<> class Array<double> : public ArrayBase<double> {};
template<> class Array<bool> : public ArrayBase<bool> {};

} // namespace platform
} // namespace blink

Expand Down
Loading

0 comments on commit a9fe85e

Please sign in to comment.