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

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

Issue 3038027: Record received data in WebViewPlugin and replay it when loading the real plugin. (Closed) Base URL: git://codf21.jail/chromium.git
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/webview_plugin.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/webview_plugin.cc
diff --git a/webkit/glue/plugins/webview_plugin.cc b/webkit/glue/plugins/webview_plugin.cc
index d01c8529813df7fc7e0d654a7ad43c6a5b7d0e22..231bd37f6829ca9716adecc539fdf16923926d88 100644
--- a/webkit/glue/plugins/webview_plugin.cc
+++ b/webkit/glue/plugins/webview_plugin.cc
@@ -4,6 +4,7 @@
#include "webkit/glue/plugins/webview_plugin.h"
+#include "base/histogram.h"
#include "base/message_loop.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
@@ -52,9 +53,16 @@ WebViewPlugin::~WebViewPlugin() {
}
void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) {
- if (response_.get()) {
- plugin->didReceiveResponse(*response_);
- plugin->didReceiveData(data_.c_str(), data_.length());
+ if (!response_.isNull()) {
+ plugin->didReceiveResponse(response_);
+ size_t total_bytes = 0;
+ for (std::list<std::string>::iterator it = data_.begin();
+ it != data_.end(); ++it) {
+ plugin->didReceiveData(it->c_str(), it->length());
+ total_bytes += it->length();
+ }
+ UMA_HISTOGRAM_MEMORY_KB("PluginDocument.Memory", (total_bytes / 1024));
+ UMA_HISTOGRAM_COUNTS("PluginDocument.NumChunks", data_.size());
}
if (finished_loading_) {
plugin->didFinishLoading();
@@ -123,12 +131,12 @@ bool WebViewPlugin::handleInputEvent(const WebInputEvent& event,
}
void WebViewPlugin::didReceiveResponse(const WebURLResponse& response) {
- DCHECK(!response_.get());
- response_.reset(new WebURLResponse(response));
+ DCHECK(response_.isNull());
+ response_ = response;
}
void WebViewPlugin::didReceiveData(const char* data, int data_length) {
- data_.append(data, data_length);
+ data_.push_back(std::string(data, data_length));
}
void WebViewPlugin::didFinishLoading() {
« no previous file with comments | « webkit/glue/plugins/webview_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698