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

Unified Diff: webkit/glue/plugins/pepper_url_loader.cc

Issue 3053009: Pepper stream-to-file plumbing.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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
« no previous file with comments | « webkit/glue/plugins/pepper_url_loader.h ('k') | webkit/glue/plugins/pepper_url_request_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/pepper_url_loader.cc
===================================================================
--- webkit/glue/plugins/pepper_url_loader.cc (revision 53197)
+++ webkit/glue/plugins/pepper_url_loader.cc (working copy)
@@ -15,6 +15,7 @@
#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h"
#include "webkit/glue/plugins/pepper_plugin_instance.h"
#include "webkit/glue/plugins/pepper_url_request_info.h"
#include "webkit/glue/plugins/pepper_url_response_info.h"
@@ -148,9 +149,9 @@
instance_(instance),
pending_callback_(),
bytes_sent_(0),
- total_bytes_to_be_sent_(0),
+ total_bytes_to_be_sent_(-1),
bytes_received_(0),
- total_bytes_to_be_received_(0),
+ total_bytes_to_be_received_(-1),
user_buffer_(NULL),
user_buffer_size_(0),
done_(false) {
@@ -248,12 +249,22 @@
if (response_info->Initialize(response))
response_info_ = response_info;
+ // Sets -1 if the content length is unknown.
+ total_bytes_to_be_received_ = response.expectedContentLength();
+
RunCallback(PP_OK);
}
+void URLLoader::didDownloadData(WebURLLoader* loader,
+ int data_length) {
+ bytes_received_ += data_length;
+}
+
void URLLoader::didReceiveData(WebURLLoader* loader,
const char* data,
int data_length) {
+ bytes_received_ += data_length;
+
buffer_.insert(buffer_.end(), data, data + data_length);
if (user_buffer_) {
RunCallback(FillUserBuffer());
« no previous file with comments | « webkit/glue/plugins/pepper_url_loader.h ('k') | webkit/glue/plugins/pepper_url_request_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698