Commit 864591fc authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Fix 64 bit truncations in blink

Use appropriate types where necessary.

BUG=879657

Change-Id: Ib20ac7132628cfaac37a57059be3c894f3fc41c2
Reviewed-on: https://chromium-review.googlesource.com/c/1349467Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610751}
parent 216535c9
......@@ -1051,14 +1051,14 @@ scoped_refptr<Uint8Array> ImageBitmap::CopyBitmapData() {
return CopyImageData(image_);
}
unsigned long ImageBitmap::width() const {
unsigned ImageBitmap::width() const {
if (!image_)
return 0;
DCHECK_GT(image_->width(), 0);
return image_->width();
}
unsigned long ImageBitmap::height() const {
unsigned ImageBitmap::height() const {
if (!image_)
return 0;
DCHECK_GT(image_->height(), 0);
......
......@@ -123,8 +123,8 @@ class CORE_EXPORT ImageBitmap final : public ScriptWrappable,
scoped_refptr<Uint8Array> CopyBitmapData();
scoped_refptr<Uint8Array> CopyBitmapData(AlphaDisposition,
DataU8ColorType = kRGBAColorType);
unsigned long width() const;
unsigned long height() const;
unsigned width() const;
unsigned height() const;
IntSize Size() const;
bool IsNeutered() const { return is_neutered_; }
......
......@@ -295,7 +295,7 @@ void ImageResourceContent::NotifyObservers(
scoped_refptr<Image> ImageResourceContent::CreateImage(bool is_multipart) {
String content_dpr_value =
info_->GetResponse().HttpHeaderField(http_names::kContentDPR);
size_t comma = content_dpr_value.ReverseFind(',');
wtf_size_t comma = content_dpr_value.ReverseFind(',');
if (comma != kNotFound && comma < content_dpr_value.length() - 1) {
content_dpr_value = content_dpr_value.Substring(comma + 1);
}
......
......@@ -146,7 +146,9 @@ class XMLHttpRequest final : public XMLHttpRequestEventTarget,
Document* responseXML(ExceptionState&);
Blob* ResponseBlob();
DOMArrayBuffer* ResponseArrayBuffer();
unsigned timeout() const { return timeout_.InMilliseconds(); }
unsigned timeout() const {
return static_cast<unsigned>(timeout_.InMilliseconds());
}
void setTimeout(unsigned timeout, ExceptionState&);
ResponseTypeCode GetResponseTypeCode() const { return response_type_code_; }
String responseType();
......
......@@ -5,6 +5,7 @@
#include "third_party/blink/renderer/modules/peerconnection/rtc_stats_report.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_object_builder.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
namespace blink {
......@@ -19,7 +20,8 @@ v8::Local<v8::Value> WebRTCStatsToValue(ScriptState* script_state,
builder.AddString("type", stats->GetType());
auto add_vector = [&builder](const WebString& name, auto web_vector) {
Vector<typename decltype(web_vector)::value_type> vector(web_vector.size());
Vector<typename decltype(web_vector)::value_type> vector(
SafeCast<wtf_size_t>(web_vector.size()));
std::move(web_vector.begin(), web_vector.end(), vector.begin());
builder.Add(name, vector);
};
......@@ -53,7 +55,7 @@ v8::Local<v8::Value> WebRTCStatsToValue(ScriptState* script_state,
break;
case kWebRTCStatsMemberTypeSequenceBool: {
WebVector<int> sequence = member->ValueSequenceBool();
Vector<bool> vector(sequence.size());
Vector<bool> vector(SafeCast<wtf_size_t>(sequence.size()));
std::copy(sequence.begin(), sequence.end(), vector.begin());
builder.Add(name, vector);
break;
......
......@@ -177,7 +177,7 @@ class Database final : public ScriptWrappable {
String name_;
String expected_version_;
String display_name_;
unsigned long estimated_size_;
unsigned estimated_size_;
String filename_;
DatabaseGuid guid_;
......
......@@ -926,7 +926,7 @@ void USBDevice::AsyncIsochronousTransferIn(
DOMArrayBuffer* buffer = DOMArrayBuffer::Create(data.data(), data.size());
HeapVector<Member<USBIsochronousInTransferPacket>> packets;
packets.ReserveCapacity(mojo_packets.size());
size_t byte_offset = 0;
uint32_t byte_offset = 0;
for (const auto& packet : mojo_packets) {
DOMException* error = ConvertFatalTransferStatus(packet->status);
if (error) {
......
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