[inspector] fixed all shorten-64-to-32 warnings
BUG=chromium:635948 R=dgozman@chromium.org,alph@chromium.org Review-Url: https://codereview.chromium.org/2332163002 Cr-Commit-Position: refs/heads/master@{#39426}
This commit is contained in:
parent
a375166b0f
commit
3d10918d2e
@ -37,14 +37,14 @@ class V8_EXPORT StringView {
|
||||
public:
|
||||
StringView() : m_is8Bit(true), m_length(0), m_characters8(nullptr) {}
|
||||
|
||||
StringView(const uint8_t* characters, unsigned length)
|
||||
StringView(const uint8_t* characters, size_t length)
|
||||
: m_is8Bit(true), m_length(length), m_characters8(characters) {}
|
||||
|
||||
StringView(const uint16_t* characters, unsigned length)
|
||||
StringView(const uint16_t* characters, size_t length)
|
||||
: m_is8Bit(false), m_length(length), m_characters16(characters) {}
|
||||
|
||||
bool is8Bit() const { return m_is8Bit; }
|
||||
unsigned length() const { return m_length; }
|
||||
size_t length() const { return m_length; }
|
||||
|
||||
// TODO(dgozman): add DCHECK(m_is8Bit) to accessors once platform can be used
|
||||
// here.
|
||||
@ -53,7 +53,7 @@ class V8_EXPORT StringView {
|
||||
|
||||
private:
|
||||
bool m_is8Bit;
|
||||
unsigned m_length;
|
||||
size_t m_length;
|
||||
union {
|
||||
const uint8_t* m_characters8;
|
||||
const uint16_t* m_characters16;
|
||||
|
@ -376,8 +376,8 @@ InjectedScript::createExceptionDetails(ErrorString* errorString,
|
||||
: message->GetStartColumn(m_context->context()).FromMaybe(0))
|
||||
.build();
|
||||
if (!message.IsEmpty()) {
|
||||
exceptionDetails->setScriptId(
|
||||
String16::fromInteger(message->GetScriptOrigin().ScriptID()->Value()));
|
||||
exceptionDetails->setScriptId(String16::fromInteger(
|
||||
static_cast<int>(message->GetScriptOrigin().ScriptID()->Value())));
|
||||
v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace();
|
||||
if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
|
||||
exceptionDetails->setStackTrace(m_context->inspector()
|
||||
|
@ -16,8 +16,8 @@ namespace {
|
||||
String16 findMagicComment(const String16& content, const String16& name,
|
||||
bool multiline) {
|
||||
DCHECK(name.find("=") == String16::kNotFound);
|
||||
unsigned length = content.length();
|
||||
unsigned nameLength = name.length();
|
||||
size_t length = content.length();
|
||||
size_t nameLength = name.length();
|
||||
|
||||
size_t pos = length;
|
||||
size_t equalSignPos = 0;
|
||||
@ -56,7 +56,7 @@ String16 findMagicComment(const String16& content, const String16& name,
|
||||
if (newLine != String16::kNotFound) match = match.substring(0, newLine);
|
||||
match = match.stripWhiteSpace();
|
||||
|
||||
for (unsigned i = 0; i < match.length(); ++i) {
|
||||
for (size_t i = 0; i < match.length(); ++i) {
|
||||
UChar c = match[i];
|
||||
if (c == '"' || c == '\'' || c == ' ' || c == '\t') return "";
|
||||
}
|
||||
@ -67,7 +67,7 @@ String16 findMagicComment(const String16& content, const String16& name,
|
||||
String16 createSearchRegexSource(const String16& text) {
|
||||
String16Builder result;
|
||||
|
||||
for (unsigned i = 0; i < text.length(); i++) {
|
||||
for (size_t i = 0; i < text.length(); i++) {
|
||||
UChar c = text[i];
|
||||
if (c == '[' || c == ']' || c == '(' || c == ')' || c == '{' || c == '}' ||
|
||||
c == '+' || c == '-' || c == '*' || c == '.' || c == ',' || c == '?' ||
|
||||
@ -80,19 +80,19 @@ String16 createSearchRegexSource(const String16& text) {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
std::unique_ptr<std::vector<unsigned>> lineEndings(const String16& text) {
|
||||
std::unique_ptr<std::vector<unsigned>> result(new std::vector<unsigned>());
|
||||
std::unique_ptr<std::vector<size_t>> lineEndings(const String16& text) {
|
||||
std::unique_ptr<std::vector<size_t>> result(new std::vector<size_t>());
|
||||
|
||||
const String16 lineEndString = "\n";
|
||||
unsigned start = 0;
|
||||
size_t start = 0;
|
||||
while (start < text.length()) {
|
||||
size_t lineEnd = text.find(lineEndString, start);
|
||||
if (lineEnd == String16::kNotFound) break;
|
||||
|
||||
result->push_back(static_cast<unsigned>(lineEnd));
|
||||
result->push_back(lineEnd);
|
||||
start = lineEnd + 1;
|
||||
}
|
||||
result->push_back(static_cast<unsigned>(text.length()));
|
||||
result->push_back(text.length());
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -102,11 +102,11 @@ std::vector<std::pair<int, String16>> scriptRegexpMatchesByLines(
|
||||
std::vector<std::pair<int, String16>> result;
|
||||
if (text.isEmpty()) return result;
|
||||
|
||||
std::unique_ptr<std::vector<unsigned>> endings(lineEndings(text));
|
||||
unsigned size = endings->size();
|
||||
unsigned start = 0;
|
||||
for (unsigned lineNumber = 0; lineNumber < size; ++lineNumber) {
|
||||
unsigned lineEnd = endings->at(lineNumber);
|
||||
std::unique_ptr<std::vector<size_t>> endings(lineEndings(text));
|
||||
size_t size = endings->size();
|
||||
size_t start = 0;
|
||||
for (size_t lineNumber = 0; lineNumber < size; ++lineNumber) {
|
||||
size_t lineEnd = endings->at(lineNumber);
|
||||
String16 line = text.substring(start, lineEnd - start);
|
||||
if (line.length() && line[line.length() - 1] == '\r')
|
||||
line = line.substring(0, line.length() - 1);
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <locale>
|
||||
#include <string>
|
||||
|
||||
@ -38,9 +39,12 @@ int charactersToInteger(const UChar* characters, size_t length,
|
||||
buffer.push_back('\0');
|
||||
|
||||
char* endptr;
|
||||
int result = std::strtol(buffer.data(), &endptr, 10);
|
||||
if (ok) *ok = !(*endptr);
|
||||
return result;
|
||||
long result = std::strtol(buffer.data(), &endptr, 10);
|
||||
if (ok) {
|
||||
*ok = !(*endptr) && result <= std::numeric_limits<int>::max() &&
|
||||
result >= std::numeric_limits<int>::min();
|
||||
}
|
||||
return static_cast<int>(result);
|
||||
}
|
||||
|
||||
const UChar replacementCharacter = 0xFFFD;
|
||||
@ -249,7 +253,7 @@ static const UChar32 offsetsFromUTF8[6] = {0x00000000UL,
|
||||
static_cast<UChar32>(0xFA082080UL),
|
||||
static_cast<UChar32>(0x82082080UL)};
|
||||
|
||||
static inline UChar32 readUTF8Sequence(const char*& sequence, unsigned length) {
|
||||
static inline UChar32 readUTF8Sequence(const char*& sequence, size_t length) {
|
||||
UChar32 character = 0;
|
||||
|
||||
// The cases all fall through.
|
||||
@ -366,6 +370,14 @@ String16 String16::fromInteger(int number) {
|
||||
return String16(buffer);
|
||||
}
|
||||
|
||||
// static
|
||||
String16 String16::fromInteger(size_t number) {
|
||||
const size_t kBufferSize = 50;
|
||||
char buffer[kBufferSize];
|
||||
std::snprintf(buffer, kBufferSize, "%zu", number);
|
||||
return String16(buffer);
|
||||
}
|
||||
|
||||
// static
|
||||
String16 String16::fromDouble(double number) {
|
||||
const size_t kBufferSize = 100;
|
||||
@ -397,8 +409,8 @@ int String16::toInteger(bool* ok) const {
|
||||
String16 String16::stripWhiteSpace() const {
|
||||
if (!length()) return String16();
|
||||
|
||||
unsigned start = 0;
|
||||
unsigned end = length() - 1;
|
||||
size_t start = 0;
|
||||
size_t end = length() - 1;
|
||||
|
||||
// skip white space from start
|
||||
while (start <= end && isSpaceOrNewLine(characters16()[start])) ++start;
|
||||
@ -456,12 +468,12 @@ String16 String16::fromUTF8(const char* stringStart, size_t length) {
|
||||
true) != conversionOK)
|
||||
return String16();
|
||||
|
||||
unsigned utf16Length = bufferCurrent - bufferStart;
|
||||
size_t utf16Length = bufferCurrent - bufferStart;
|
||||
return String16(bufferStart, utf16Length);
|
||||
}
|
||||
|
||||
std::string String16::utf8() const {
|
||||
unsigned length = this->length();
|
||||
size_t length = this->length();
|
||||
|
||||
if (!length) return std::string("");
|
||||
|
||||
|
@ -32,6 +32,7 @@ class String16 {
|
||||
}
|
||||
|
||||
static String16 fromInteger(int);
|
||||
static String16 fromInteger(size_t);
|
||||
static String16 fromDouble(double);
|
||||
static String16 fromDoublePrecision3(double);
|
||||
static String16 fromDoublePrecision6(double);
|
||||
@ -41,14 +42,14 @@ class String16 {
|
||||
const UChar* characters16() const { return m_impl.c_str(); }
|
||||
size_t length() const { return m_impl.length(); }
|
||||
bool isEmpty() const { return !m_impl.length(); }
|
||||
UChar operator[](unsigned index) const { return m_impl[index]; }
|
||||
String16 substring(unsigned pos, unsigned len = UINT_MAX) const {
|
||||
UChar operator[](size_t index) const { return m_impl[index]; }
|
||||
String16 substring(size_t pos, size_t len = UINT_MAX) const {
|
||||
return String16(m_impl.substr(pos, len));
|
||||
}
|
||||
size_t find(const String16& str, unsigned start = 0) const {
|
||||
size_t find(const String16& str, size_t start = 0) const {
|
||||
return m_impl.find(str.m_impl, start);
|
||||
}
|
||||
size_t reverseFind(const String16& str, unsigned start = UINT_MAX) const {
|
||||
size_t reverseFind(const String16& str, size_t start = UINT_MAX) const {
|
||||
return m_impl.rfind(str.m_impl, start);
|
||||
}
|
||||
void swap(String16& other) { m_impl.swap(other.m_impl); }
|
||||
|
@ -6,22 +6,27 @@
|
||||
|
||||
#include "src/inspector/protocol/Protocol.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace v8_inspector {
|
||||
|
||||
v8::Local<v8::String> toV8String(v8::Isolate* isolate, const String16& string) {
|
||||
if (string.isEmpty()) return v8::String::Empty(isolate);
|
||||
DCHECK(string.length() < v8::String::kMaxLength);
|
||||
return v8::String::NewFromTwoByte(
|
||||
isolate, reinterpret_cast<const uint16_t*>(string.characters16()),
|
||||
v8::NewStringType::kNormal, string.length())
|
||||
v8::NewStringType::kNormal, static_cast<int>(string.length()))
|
||||
.ToLocalChecked();
|
||||
}
|
||||
|
||||
v8::Local<v8::String> toV8StringInternalized(v8::Isolate* isolate,
|
||||
const String16& string) {
|
||||
if (string.isEmpty()) return v8::String::Empty(isolate);
|
||||
DCHECK(string.length() < v8::String::kMaxLength);
|
||||
return v8::String::NewFromTwoByte(
|
||||
isolate, reinterpret_cast<const uint16_t*>(string.characters16()),
|
||||
v8::NewStringType::kInternalized, string.length())
|
||||
v8::NewStringType::kInternalized,
|
||||
static_cast<int>(string.length()))
|
||||
.ToLocalChecked();
|
||||
}
|
||||
|
||||
@ -34,14 +39,15 @@ v8::Local<v8::String> toV8StringInternalized(v8::Isolate* isolate,
|
||||
v8::Local<v8::String> toV8String(v8::Isolate* isolate,
|
||||
const StringView& string) {
|
||||
if (!string.length()) return v8::String::Empty(isolate);
|
||||
DCHECK(string.length() < v8::String::kMaxLength);
|
||||
if (string.is8Bit())
|
||||
return v8::String::NewFromOneByte(
|
||||
isolate, reinterpret_cast<const uint8_t*>(string.characters8()),
|
||||
v8::NewStringType::kNormal, string.length())
|
||||
v8::NewStringType::kNormal, static_cast<int>(string.length()))
|
||||
.ToLocalChecked();
|
||||
return v8::String::NewFromTwoByte(
|
||||
isolate, reinterpret_cast<const uint16_t*>(string.characters16()),
|
||||
v8::NewStringType::kNormal, string.length())
|
||||
v8::NewStringType::kNormal, static_cast<int>(string.length()))
|
||||
.ToLocalChecked();
|
||||
}
|
||||
|
||||
@ -91,14 +97,20 @@ namespace protocol {
|
||||
|
||||
std::unique_ptr<protocol::Value> parseJSON(const StringView& string) {
|
||||
if (!string.length()) return nullptr;
|
||||
if (string.is8Bit())
|
||||
return protocol::parseJSON(string.characters8(), string.length());
|
||||
return protocol::parseJSON(string.characters16(), string.length());
|
||||
DCHECK(string.length() <= std::numeric_limits<int>::max());
|
||||
if (string.is8Bit()) {
|
||||
return protocol::parseJSON(string.characters8(),
|
||||
static_cast<int>(string.length()));
|
||||
}
|
||||
return protocol::parseJSON(string.characters16(),
|
||||
static_cast<int>(string.length()));
|
||||
}
|
||||
|
||||
std::unique_ptr<protocol::Value> parseJSON(const String16& string) {
|
||||
if (!string.length()) return nullptr;
|
||||
return protocol::parseJSON(string.characters16(), string.length());
|
||||
DCHECK(string.length() <= std::numeric_limits<int>::max());
|
||||
return protocol::parseJSON(string.characters16(),
|
||||
static_cast<int>(string.length()));
|
||||
}
|
||||
|
||||
} // namespace protocol
|
||||
|
@ -21,13 +21,16 @@ using StringBuilder = v8_inspector::String16Builder;
|
||||
|
||||
class StringUtil {
|
||||
public:
|
||||
static String substring(const String& s, unsigned pos, unsigned len) {
|
||||
static String substring(const String& s, size_t pos, size_t len) {
|
||||
return s.substring(pos, len);
|
||||
}
|
||||
static String fromInteger(int number) { return String::fromInteger(number); }
|
||||
static String fromInteger(size_t number) {
|
||||
return String::fromInteger(number);
|
||||
}
|
||||
static String fromDouble(double number) { return String::fromDouble(number); }
|
||||
static const size_t kNotFound = String::kNotFound;
|
||||
static void builderReserve(StringBuilder& builder, unsigned capacity) {
|
||||
static void builderReserve(StringBuilder& builder, size_t capacity) {
|
||||
builder.reserveCapacity(capacity);
|
||||
}
|
||||
};
|
||||
|
@ -160,16 +160,16 @@ class ConsoleHelper {
|
||||
: v8::MaybeLocal<v8::Map>();
|
||||
}
|
||||
|
||||
int64_t getIntFromMap(v8::Local<v8::Map> map, const String16& key,
|
||||
int64_t defaultValue) {
|
||||
int32_t getIntFromMap(v8::Local<v8::Map> map, const String16& key,
|
||||
int32_t defaultValue) {
|
||||
v8::Local<v8::String> v8Key = toV8String(m_isolate, key);
|
||||
if (!map->Has(m_context, v8Key).FromMaybe(false)) return defaultValue;
|
||||
v8::Local<v8::Value> intValue;
|
||||
if (!map->Get(m_context, v8Key).ToLocal(&intValue)) return defaultValue;
|
||||
return intValue.As<v8::Integer>()->Value();
|
||||
return static_cast<int32_t>(intValue.As<v8::Integer>()->Value());
|
||||
}
|
||||
|
||||
void setIntOnMap(v8::Local<v8::Map> map, const String16& key, int64_t value) {
|
||||
void setIntOnMap(v8::Local<v8::Map> map, const String16& key, int32_t value) {
|
||||
v8::Local<v8::String> v8Key = toV8String(m_isolate, key);
|
||||
if (!map->Set(m_context, v8Key, v8::Integer::New(m_isolate, value))
|
||||
.ToLocal(&map))
|
||||
@ -353,7 +353,7 @@ void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
||||
|
||||
v8::Local<v8::Map> countMap;
|
||||
if (!helper.privateMap("V8Console#countMap").ToLocal(&countMap)) return;
|
||||
int64_t count = helper.getIntFromMap(countMap, identifier, 0) + 1;
|
||||
int32_t count = helper.getIntFromMap(countMap, identifier, 0) + 1;
|
||||
helper.setIntOnMap(countMap, identifier, count);
|
||||
helper.reportCallWithArgument(ConsoleAPIType::kCount,
|
||||
title + ": " + String16::fromInteger(count));
|
||||
@ -511,7 +511,7 @@ void V8Console::valuesCallback(
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (!obj->GetOwnPropertyNames(context).ToLocal(&names)) return;
|
||||
v8::Local<v8::Array> values = v8::Array::New(isolate, names->Length());
|
||||
for (size_t i = 0; i < names->Length(); ++i) {
|
||||
for (uint32_t i = 0; i < names->Length(); ++i) {
|
||||
v8::Local<v8::Value> key;
|
||||
if (!names->Get(context, i).ToLocal(&key)) continue;
|
||||
v8::Local<v8::Value> value;
|
||||
@ -876,7 +876,7 @@ V8Console::CommandLineAPIScope::CommandLineAPIScope(
|
||||
if (!m_commandLineAPI->GetOwnPropertyNames(context).ToLocal(&names)) return;
|
||||
v8::Local<v8::External> externalThis =
|
||||
v8::External::New(context->GetIsolate(), this);
|
||||
for (size_t i = 0; i < names->Length(); ++i) {
|
||||
for (uint32_t i = 0; i < names->Length(); ++i) {
|
||||
v8::Local<v8::Value> name;
|
||||
if (!names->Get(context, i).ToLocal(&name) || !name->IsName()) continue;
|
||||
if (m_global->Has(context, name).FromMaybe(true)) continue;
|
||||
@ -899,7 +899,7 @@ V8Console::CommandLineAPIScope::CommandLineAPIScope(
|
||||
V8Console::CommandLineAPIScope::~CommandLineAPIScope() {
|
||||
m_cleanup = true;
|
||||
v8::Local<v8::Array> names = m_installedMethods->AsArray();
|
||||
for (size_t i = 0; i < names->Length(); ++i) {
|
||||
for (uint32_t i = 0; i < names->Length(); ++i) {
|
||||
v8::Local<v8::Value> name;
|
||||
if (!names->Get(m_context, i).ToLocal(&name) || !name->IsName()) continue;
|
||||
if (name->IsString()) {
|
||||
|
@ -378,9 +378,13 @@ bool V8Debugger::setScriptSource(
|
||||
.setExceptionId(m_inspector->nextExceptionId())
|
||||
.setText(toProtocolStringWithTypeCheck(resultTuple->Get(2)))
|
||||
.setLineNumber(
|
||||
resultTuple->Get(3)->ToInteger(m_isolate)->Value() - 1)
|
||||
static_cast<int>(
|
||||
resultTuple->Get(3)->ToInteger(m_isolate)->Value()) -
|
||||
1)
|
||||
.setColumnNumber(
|
||||
resultTuple->Get(4)->ToInteger(m_isolate)->Value() - 1)
|
||||
static_cast<int>(
|
||||
resultTuple->Get(4)->ToInteger(m_isolate)->Value()) -
|
||||
1)
|
||||
.build();
|
||||
return false;
|
||||
}
|
||||
@ -412,7 +416,7 @@ JavaScriptCallFrames V8Debugger::currentCallFrames(int limit) {
|
||||
if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames();
|
||||
v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>();
|
||||
JavaScriptCallFrames callFrames;
|
||||
for (size_t i = 0; i < callFramesArray->Length(); ++i) {
|
||||
for (uint32_t i = 0; i < callFramesArray->Length(); ++i) {
|
||||
v8::Local<v8::Value> callFrameValue;
|
||||
if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue))
|
||||
return JavaScriptCallFrames();
|
||||
@ -458,7 +462,7 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
|
||||
std::vector<String16> breakpointIds;
|
||||
if (!hitBreakpointNumbers.IsEmpty()) {
|
||||
breakpointIds.reserve(hitBreakpointNumbers->Length());
|
||||
for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) {
|
||||
for (uint32_t i = 0; i < hitBreakpointNumbers->Length(); i++) {
|
||||
v8::Local<v8::Value> hitBreakpointNumber = hitBreakpointNumbers->Get(i);
|
||||
DCHECK(!hitBreakpointNumber.IsEmpty() && hitBreakpointNumber->IsInt32());
|
||||
breakpointIds.push_back(
|
||||
@ -579,9 +583,9 @@ void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Context> context,
|
||||
callInternalGetterFunction(eventData, "type"));
|
||||
String16 name = toProtocolStringWithTypeCheck(
|
||||
callInternalGetterFunction(eventData, "name"));
|
||||
int id = callInternalGetterFunction(eventData, "id")
|
||||
int id = static_cast<int>(callInternalGetterFunction(eventData, "id")
|
||||
->ToInteger(m_isolate)
|
||||
->Value();
|
||||
->Value());
|
||||
// The scopes for the ids are defined by the eventData.name namespaces. There
|
||||
// are currently two namespaces: "Object." and "Promise.".
|
||||
void* ptr = reinterpret_cast<void*>(id * 4 + (name[0] == 'P' ? 2 : 0) + 1);
|
||||
|
@ -934,7 +934,7 @@ std::unique_ptr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(
|
||||
: nullptr;
|
||||
|
||||
String16 callFrameId =
|
||||
RemoteCallFrameId::serialize(contextId, frameOrdinal);
|
||||
RemoteCallFrameId::serialize(contextId, static_cast<int>(frameOrdinal));
|
||||
if (hasInternalError(
|
||||
errorString,
|
||||
!details
|
||||
@ -1006,8 +1006,10 @@ std::unique_ptr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(
|
||||
return Array<CallFrame>::create();
|
||||
}
|
||||
|
||||
if (hasInternalError(errorString,
|
||||
!objects->Set(debuggerContext, frameOrdinal, details)
|
||||
if (hasInternalError(
|
||||
errorString,
|
||||
!objects
|
||||
->Set(debuggerContext, static_cast<int>(frameOrdinal), details)
|
||||
.FromMaybe(false)))
|
||||
return Array<CallFrame>::create();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace v8_inspector {
|
||||
|
||||
static const char hexDigits[17] = "0123456789ABCDEF";
|
||||
|
||||
static void appendUnsignedAsHex(unsigned number, String16Builder* destination) {
|
||||
static void appendUnsignedAsHex(uint64_t number, String16Builder* destination) {
|
||||
for (size_t i = 0; i < 8; ++i) {
|
||||
UChar c = hexDigits[number & 0xF];
|
||||
destination->append(c);
|
||||
@ -81,24 +81,28 @@ V8DebuggerScript::V8DebuggerScript(v8::Isolate* isolate,
|
||||
object->Get(toV8StringInternalized(isolate, "sourceURL")));
|
||||
m_sourceMappingURL = toProtocolStringWithTypeCheck(
|
||||
object->Get(toV8StringInternalized(isolate, "sourceMappingURL")));
|
||||
m_startLine = object->Get(toV8StringInternalized(isolate, "startLine"))
|
||||
m_startLine =
|
||||
static_cast<int>(object->Get(toV8StringInternalized(isolate, "startLine"))
|
||||
->ToInteger(isolate)
|
||||
->Value();
|
||||
m_startColumn = object->Get(toV8StringInternalized(isolate, "startColumn"))
|
||||
->Value());
|
||||
m_startColumn = static_cast<int>(
|
||||
object->Get(toV8StringInternalized(isolate, "startColumn"))
|
||||
->ToInteger(isolate)
|
||||
->Value();
|
||||
m_endLine = object->Get(toV8StringInternalized(isolate, "endLine"))
|
||||
->Value());
|
||||
m_endLine =
|
||||
static_cast<int>(object->Get(toV8StringInternalized(isolate, "endLine"))
|
||||
->ToInteger(isolate)
|
||||
->Value();
|
||||
m_endColumn = object->Get(toV8StringInternalized(isolate, "endColumn"))
|
||||
->Value());
|
||||
m_endColumn =
|
||||
static_cast<int>(object->Get(toV8StringInternalized(isolate, "endColumn"))
|
||||
->ToInteger(isolate)
|
||||
->Value();
|
||||
->Value());
|
||||
m_executionContextAuxData = toProtocolStringWithTypeCheck(
|
||||
object->Get(toV8StringInternalized(isolate, "executionContextAuxData")));
|
||||
m_executionContextId =
|
||||
m_executionContextId = static_cast<int>(
|
||||
object->Get(toV8StringInternalized(isolate, "executionContextId"))
|
||||
->ToInteger(isolate)
|
||||
->Value();
|
||||
->Value());
|
||||
m_isLiveEdit = isLiveEdit;
|
||||
|
||||
v8::Local<v8::Value> sourceValue =
|
||||
|
@ -96,8 +96,8 @@ v8::Local<v8::Value> V8FunctionCall::callWithoutExceptionHandling() {
|
||||
}
|
||||
v8::MicrotasksScope microtasksScope(m_context->GetIsolate(),
|
||||
v8::MicrotasksScope::kDoNotRunMicrotasks);
|
||||
v8::MaybeLocal<v8::Value> maybeResult =
|
||||
function->Call(m_context, thisObject, m_arguments.size(), info.get());
|
||||
v8::MaybeLocal<v8::Value> maybeResult = function->Call(
|
||||
m_context, thisObject, static_cast<int>(m_arguments.size()), info.get());
|
||||
if (contextGroupId) {
|
||||
m_inspector->client()->unmuteMetrics(contextGroupId);
|
||||
m_inspector->unmuteExceptions(contextGroupId);
|
||||
|
@ -294,7 +294,7 @@ void V8HeapProfilerAgentImpl::getHeapObjectId(ErrorString* errorString,
|
||||
return;
|
||||
|
||||
v8::SnapshotObjectId id = m_isolate->GetHeapProfiler()->GetObjectId(value);
|
||||
*heapSnapshotObjectId = String16::fromInteger(id);
|
||||
*heapSnapshotObjectId = String16::fromInteger(static_cast<size_t>(id));
|
||||
}
|
||||
|
||||
void V8HeapProfilerAgentImpl::requestHeapStatsUpdate() {
|
||||
|
@ -49,7 +49,7 @@ bool markArrayEntriesAsInternal(v8::Local<v8::Context> context,
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
v8::Local<v8::Private> privateValue = internalSubtypePrivate(isolate);
|
||||
v8::Local<v8::String> subtype = subtypeForInternalType(isolate, type);
|
||||
for (size_t i = 0; i < array->Length(); ++i) {
|
||||
for (uint32_t i = 0; i < array->Length(); ++i) {
|
||||
v8::Local<v8::Value> entry;
|
||||
if (!array->Get(context, i).ToLocal(&entry) || !entry->IsObject())
|
||||
return false;
|
||||
|
@ -364,7 +364,7 @@ void V8RuntimeAgentImpl::callFunctionOn(
|
||||
if (optionalArguments.isJust()) {
|
||||
protocol::Array<protocol::Runtime::CallArgument>* arguments =
|
||||
optionalArguments.fromJust();
|
||||
argc = arguments->length();
|
||||
argc = static_cast<int>(arguments->length());
|
||||
argv.reset(new v8::Local<v8::Value>[argc]);
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
v8::Local<v8::Value> argumentValue;
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "include/v8-profiler.h"
|
||||
#include "include/v8-version.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace v8_inspector {
|
||||
|
||||
namespace {
|
||||
@ -45,7 +47,8 @@ void toFramesVector(v8::Local<v8::StackTrace> stackTrace,
|
||||
size_t maxStackSize, v8::Isolate* isolate) {
|
||||
DCHECK(isolate->InContext());
|
||||
int frameCount = stackTrace->GetFrameCount();
|
||||
if (frameCount > static_cast<int>(maxStackSize)) frameCount = maxStackSize;
|
||||
if (frameCount > static_cast<int>(maxStackSize))
|
||||
frameCount = static_cast<int>(maxStackSize);
|
||||
for (int i = 0; i < frameCount; i++) {
|
||||
v8::Local<v8::StackFrame> stackFrame = stackTrace->GetFrame(i);
|
||||
frames.push_back(toFrame(stackFrame));
|
||||
@ -159,8 +162,9 @@ std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture(
|
||||
v8::Local<v8::StackTrace> stackTrace;
|
||||
if (isolate->InContext()) {
|
||||
isolate->GetCpuProfiler()->CollectSample();
|
||||
stackTrace = v8::StackTrace::CurrentStackTrace(isolate, maxStackSize,
|
||||
stackTraceOptions);
|
||||
DCHECK(maxStackSize <= std::numeric_limits<int>::max());
|
||||
stackTrace = v8::StackTrace::CurrentStackTrace(
|
||||
isolate, static_cast<int>(maxStackSize), stackTraceOptions);
|
||||
}
|
||||
return V8StackTraceImpl::create(debugger, contextGroupId, stackTrace,
|
||||
maxStackSize, description);
|
||||
|
@ -30,7 +30,7 @@ class V8ValueCopier {
|
||||
v8::Local<v8::Array> result = v8::Array::New(m_isolate, array->Length());
|
||||
if (!result->SetPrototype(m_to, v8::Null(m_isolate)).FromMaybe(false))
|
||||
return v8::MaybeLocal<v8::Value>();
|
||||
for (size_t i = 0; i < array->Length(); ++i) {
|
||||
for (uint32_t i = 0; i < array->Length(); ++i) {
|
||||
v8::Local<v8::Value> item;
|
||||
if (!array->Get(m_from, i).ToLocal(&item))
|
||||
return v8::MaybeLocal<v8::Value>();
|
||||
@ -49,7 +49,7 @@ class V8ValueCopier {
|
||||
v8::Local<v8::Array> properties;
|
||||
if (!object->GetOwnPropertyNames(m_from).ToLocal(&properties))
|
||||
return v8::MaybeLocal<v8::Value>();
|
||||
for (size_t i = 0; i < properties->Length(); ++i) {
|
||||
for (uint32_t i = 0; i < properties->Length(); ++i) {
|
||||
v8::Local<v8::Value> name;
|
||||
if (!properties->Get(m_from, i).ToLocal(&name) || !name->IsString())
|
||||
return v8::MaybeLocal<v8::Value>();
|
||||
|
@ -1748,7 +1748,6 @@
|
||||
],
|
||||
# TODO(dgozman): fix these warnings and enable them.
|
||||
'msvs_disabled_warnings': [
|
||||
4267, # Truncation from size_t to int.
|
||||
4305, # Truncation from 'type1' to 'type2'.
|
||||
4324, # Struct padded due to declspec(align).
|
||||
4714, # Function marked forceinline not inlined.
|
||||
@ -1757,7 +1756,6 @@
|
||||
],
|
||||
'cflags': [
|
||||
'-Wno-zero-length-array',
|
||||
'-Wno-shorten-64-to-32',
|
||||
'-Wno-deprecated-declarations',
|
||||
],
|
||||
}],
|
||||
|
Loading…
Reference in New Issue
Block a user