Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(686)

Unified Diff: src/inspector/string-util.cc

Issue 2332163002: [inspector] fixed all shorten-64-to-32 warnings (Closed)
Patch Set: rebased Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/inspector/string-util.h ('k') | src/inspector/v8-console.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/string-util.cc
diff --git a/src/inspector/string-util.cc b/src/inspector/string-util.cc
index a261b8a8b391970658fcb06086dc8638f22876db..e6b83a5d7db6f87e5a6c3dcaa2da77d19b67e7f4 100644
--- a/src/inspector/string-util.cc
+++ b/src/inspector/string-util.cc
@@ -10,18 +10,21 @@ 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 +37,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 +95,18 @@ 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());
+ 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());
+ return protocol::parseJSON(string.characters16(),
+ static_cast<int>(string.length()));
}
} // namespace protocol
« no previous file with comments | « src/inspector/string-util.h ('k') | src/inspector/v8-console.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698