Commit 71427275 authored by msw's avatar msw Committed by Commit bot

Perform a sizet->int checked_cast in WebURLLoaderImpl::OnReceiveWebBlobData.

Fixes an error on my Windows build:
d:\src\chrome-git\src\components\html_viewer\web_url_loader_impl.cc(254) : error C2220: warning treated as error - no 'object' file generated
d:\src\chrome-git\src\components\html_viewer\web_url_loader_impl.cc(254) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data

BUG=NONE
TEST=Windows html_viewer build succeeds.
R=erg@chromium.org
TBR=sky@chromium.org

Review URL: https://codereview.chromium.org/1096243004

Cr-Commit-Position: refs/heads/master@{#326898}
parent 8d89f69f
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h" #include "base/thread_task_runner_handle.h"
#include "components/html_viewer/blink_url_request_type_converters.h" #include "components/html_viewer/blink_url_request_type_converters.h"
...@@ -250,8 +251,8 @@ void WebURLLoaderImpl::OnReceiveWebBlobData( ...@@ -250,8 +251,8 @@ void WebURLLoaderImpl::OnReceiveWebBlobData(
// Send a receive data for each blob item. // Send a receive data for each blob item.
for (size_t i = 0; i < items.size(); ++i) { for (size_t i = 0; i < items.size(); ++i) {
client_->didReceiveData(this, items[i]->data.data(), items[i]->data.size(), const int data_size = base::checked_cast<int>(items[i]->data.size());
-1); client_->didReceiveData(this, items[i]->data.data(), data_size, -1);
} }
// Send a closing finish. // Send a closing finish.
...@@ -270,7 +271,7 @@ void WebURLLoaderImpl::ReadMore() { ...@@ -270,7 +271,7 @@ void WebURLLoaderImpl::ReadMore() {
if (rv == MOJO_RESULT_OK) { if (rv == MOJO_RESULT_OK) {
base::WeakPtr<WebURLLoaderImpl> self(weak_factory_.GetWeakPtr()); base::WeakPtr<WebURLLoaderImpl> self(weak_factory_.GetWeakPtr());
client_->didReceiveData(this, static_cast<const char*>(buf), buf_size, -1); client_->didReceiveData(this, static_cast<const char*>(buf), buf_size, -1);
// We may have been deleted durining didReceiveData. // We may have been deleted during didReceiveData.
if (!self) if (!self)
return; return;
EndReadDataRaw(response_body_stream_.get(), buf_size); EndReadDataRaw(response_body_stream_.get(), buf_size);
......
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