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

Unified Diff: webkit/browser/blob/blob_url_request_job.cc

Issue 470323003: [fsp] Improve performance for reading small chunks of data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 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
Index: webkit/browser/blob/blob_url_request_job.cc
diff --git a/webkit/browser/blob/blob_url_request_job.cc b/webkit/browser/blob/blob_url_request_job.cc
index 9eb196ad40181c50ed19ad9dbf600205e1200b15..2cd201385a72ee950d46f15d79095efc13fa8f96 100644
--- a/webkit/browser/blob/blob_url_request_job.cc
+++ b/webkit/browser/blob/blob_url_request_job.cc
@@ -4,7 +4,10 @@
#include "webkit/browser/blob/blob_url_request_job.h"
+#include <algorithm>
#include <limits>
+#include <string>
+#include <vector>
hashimoto 2014/09/05 03:17:27 nit: Are these include needed?
mtomasz 2014/09/05 05:31:42 algorithm for std::min. string for std::string. ve
#include "base/basictypes.h"
#include "base/bind.h"
@@ -13,6 +16,7 @@
#include "base/format_macros.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
+#include "base/numerics/safe_conversions.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
@@ -223,8 +227,8 @@ void BlobURLRequestJob::DidCountSize(int error) {
return;
}
- remaining_bytes_ = byte_range_.last_byte_position() -
- byte_range_.first_byte_position() + 1;
+ remaining_bytes_ = base::checked_cast<int64>(
+ byte_range_.last_byte_position() - byte_range_.first_byte_position() + 1);
DCHECK_GE(remaining_bytes_, 0);
// Do the seek at the beginning of the request.
@@ -577,6 +581,7 @@ void BlobURLRequestJob::CreateFileStreamReader(size_t index,
file_system_context_->CrackURL(
item.filesystem_url())),
item.offset() + additional_offset,
+ item.length() - additional_offset,
hashimoto 2014/09/05 03:17:27 Shouldn't item_length_list_ be used here?
mtomasz 2014/09/05 05:31:42 While filling out item_length_list_, file stream r
item.expected_modification_time())
.release();
break;

Powered by Google App Engine
This is Rietveld 408576698