Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update v8_inspector #8014

Merged
merged 1 commit into from
Aug 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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