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

Unified Diff: webkit/glue/multipart_response_delegate.cc

Issue 3863002: Refactoring BufferedDataSource to work with WebURLLoader instead of a MediaResourceLoaderBridge. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: little indent Created 10 years, 1 month 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 | « webkit/glue/multipart_response_delegate.h ('k') | webkit/glue/multipart_response_delegate_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/multipart_response_delegate.cc
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc
index 99a9e4c9473854cceda599f405501ec083f3e7ee..b8c7758d0e18872f40c96b494c7886de3befef9f 100644
--- a/webkit/glue/multipart_response_delegate.cc
+++ b/webkit/glue/multipart_response_delegate.cc
@@ -316,7 +316,8 @@ bool MultipartResponseDelegate::ReadMultipartBoundary(
bool MultipartResponseDelegate::ReadContentRanges(
const WebURLResponse& response,
int* content_range_lower_bound,
- int* content_range_upper_bound) {
+ int* content_range_upper_bound,
+ int* content_range_instance_size) {
std::string content_range = response.httpHeaderField("Content-Range").utf8();
if (content_range.empty()) {
@@ -336,12 +337,20 @@ bool MultipartResponseDelegate::ReadContentRanges(
// Skip over the initial space.
byte_range_lower_bound_start_offset++;
+ // Find the lower bound.
size_t byte_range_lower_bound_end_offset =
content_range.find("-", byte_range_lower_bound_start_offset);
if (byte_range_lower_bound_end_offset == std::string::npos) {
return false;
}
+ size_t byte_range_lower_bound_characters =
+ byte_range_lower_bound_end_offset - byte_range_lower_bound_start_offset;
+ std::string byte_range_lower_bound =
+ content_range.substr(byte_range_lower_bound_start_offset,
+ byte_range_lower_bound_characters);
+
+ // Find the upper bound.
size_t byte_range_upper_bound_start_offset =
byte_range_lower_bound_end_offset + 1;
@@ -351,16 +360,31 @@ bool MultipartResponseDelegate::ReadContentRanges(
return false;
}
- if (!base::StringToInt(
- content_range.begin() + byte_range_lower_bound_start_offset,
- content_range.begin() + byte_range_lower_bound_end_offset,
- content_range_lower_bound))
- return false;
+ size_t byte_range_upper_bound_characters =
+ byte_range_upper_bound_end_offset - byte_range_upper_bound_start_offset;
+ std::string byte_range_upper_bound =
+ content_range.substr(byte_range_upper_bound_start_offset,
+ byte_range_upper_bound_characters);
+
+ // Find the instance size.
+ size_t byte_range_instance_size_start_offset =
+ byte_range_upper_bound_end_offset + 1;
+
+ size_t byte_range_instance_size_end_offset =
+ content_range.length();
- if (!base::StringToInt(
- content_range.begin() + byte_range_upper_bound_start_offset,
- content_range.begin() + byte_range_upper_bound_end_offset,
- content_range_upper_bound))
+ size_t byte_range_instance_size_characters =
+ byte_range_instance_size_end_offset -
+ byte_range_instance_size_start_offset;
+ std::string byte_range_instance_size =
+ content_range.substr(byte_range_instance_size_start_offset,
+ byte_range_instance_size_characters);
+
+ if (!base::StringToInt(byte_range_lower_bound, content_range_lower_bound))
+ return false;
+ if (!base::StringToInt(byte_range_upper_bound, content_range_upper_bound))
+ return false;
+ if (!base::StringToInt(byte_range_instance_size, content_range_instance_size))
return false;
return true;
}
« no previous file with comments | « webkit/glue/multipart_response_delegate.h ('k') | webkit/glue/multipart_response_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698