summaryrefslogtreecommitdiffstats
path: root/webkit/glue/multipart_response_delegate.cc
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-03 01:49:16 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-03 01:49:16 +0000
commit8f2bf64884944e8b770852240e34e79f117acbb6 (patch)
treee7235339bc556dc5f933b75578cb12ca8f2ce905 /webkit/glue/multipart_response_delegate.cc
parentebc34fab52eabbb680eee966bb10e8f8a8cbd845 (diff)
downloadchromium_src-8f2bf64884944e8b770852240e34e79f117acbb6.zip
chromium_src-8f2bf64884944e8b770852240e34e79f117acbb6.tar.gz
chromium_src-8f2bf64884944e8b770852240e34e79f117acbb6.tar.bz2
Revert 68094 - Refactoring BufferedDataSource to work with WebURLLoader instead of a MediaResourceLoaderBridge.
One thing to notice is that both buffered_data_source_unittest and simple_data_source_unittest need to have a way to inject a MockWebURLLoader into the BufferedResourceLoader and the SimpleDataSource. In order to make sure a new one is not created during a Start(), I introduced the function SetURLLoaderForTest and keep_test_loader flag. Patch by annacc@chromium.org: http://codereview.chromium.org/3863002/ BUG=16751 TEST=src/xcodebuild/Debug/test_shell_tests --gtest_filter=Buffered* src/xcodebuild/Debug/test_shell_tests --gtest_filter=Simple* src/webkit/tools/layout_tests/run_webkit_tests.sh --debug media webkit/tools/layout_tests/run_webkit_tests.sh --debug http/tests/media TBR=scherkus@chromium.org Review URL: http://codereview.chromium.org/5619002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68126 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/multipart_response_delegate.cc')
-rw-r--r--webkit/glue/multipart_response_delegate.cc44
1 files changed, 10 insertions, 34 deletions
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc
index b8c7758..99a9e4c 100644
--- a/webkit/glue/multipart_response_delegate.cc
+++ b/webkit/glue/multipart_response_delegate.cc
@@ -316,8 +316,7 @@ bool MultipartResponseDelegate::ReadMultipartBoundary(
bool MultipartResponseDelegate::ReadContentRanges(
const WebURLResponse& response,
int* content_range_lower_bound,
- int* content_range_upper_bound,
- int* content_range_instance_size) {
+ int* content_range_upper_bound) {
std::string content_range = response.httpHeaderField("Content-Range").utf8();
if (content_range.empty()) {
@@ -337,20 +336,12 @@ 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;
@@ -360,31 +351,16 @@ bool MultipartResponseDelegate::ReadContentRanges(
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();
-
- 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))
+ 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;
- if (!base::StringToInt(byte_range_instance_size, content_range_instance_size))
+
+ 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))
return false;
return true;
}