Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/plugins/renderer/webview_plugin.h" | 5 #include "components/plugins/renderer/webview_plugin.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 } | 88 } |
| 89 | 89 |
| 90 WebViewPlugin::~WebViewPlugin() { | 90 WebViewPlugin::~WebViewPlugin() { |
| 91 DCHECK(!weak_factory_.HasWeakPtrs()); | 91 DCHECK(!weak_factory_.HasWeakPtrs()); |
| 92 web_frame_widget_->close(); | 92 web_frame_widget_->close(); |
| 93 web_view_->close(); | 93 web_view_->close(); |
| 94 web_frame_->close(); | 94 web_frame_->close(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) { | 97 void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) { |
| 98 const WebURLResponse& response = web_frame_->dataSource()->response(); | |
| 99 if (!response.isNull()) { | |
|
tommycli
2016/09/16 17:38:03
If I understand correctly, WebPlugin::didReceiveRe
Nate Chapin
2016/09/16 17:49:40
Correct.
tommycli
2016/09/16 18:08:26
Okay, here's one suggestion:
Make the WebFrameCli
| |
| 100 plugin->didReceiveResponse(response); | |
| 101 size_t total_bytes = 0; | |
| 102 for (std::list<std::string>::iterator it = data_.begin(); it != data_.end(); | |
| 103 ++it) { | |
| 104 plugin->didReceiveData( | |
| 105 it->c_str(), base::checked_cast<int, size_t>(it->length())); | |
| 106 total_bytes += it->length(); | |
| 107 } | |
| 108 UMA_HISTOGRAM_MEMORY_KB( | |
|
tommycli
2016/09/16 17:38:03
Are these the only places these UMAs are logged? I
Nate Chapin
2016/09/16 17:49:39
I don't see any related histograms.xml entries?
tommycli
2016/09/16 18:08:26
They don't appear under UMA either. These must jus
| |
| 109 "PluginDocument.Memory", | |
| 110 (base::checked_cast<int, size_t>(total_bytes / 1024))); | |
| 111 UMA_HISTOGRAM_COUNTS( | |
| 112 "PluginDocument.NumChunks", | |
| 113 (base::checked_cast<int, size_t>(data_.size()))); | |
| 114 } | |
| 115 // We need to transfer the |focused_| to new plugin after it loaded. | 98 // We need to transfer the |focused_| to new plugin after it loaded. |
| 116 if (focused_) { | 99 if (focused_) { |
| 117 plugin->updateFocus(true, blink::WebFocusTypeNone); | 100 plugin->updateFocus(true, blink::WebFocusTypeNone); |
| 118 } | 101 } |
| 119 if (finished_loading_) { | 102 if (finished_loading_) { |
| 120 plugin->didFinishLoading(); | 103 plugin->didFinishLoading(); |
| 121 } | 104 } |
| 122 if (error_) { | 105 if (error_) { |
| 123 plugin->didFailLoading(*error_); | 106 plugin->didFailLoading(*error_); |
| 124 } | 107 } |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 if (!delegate_) | 332 if (!delegate_) |
| 350 return; | 333 return; |
| 351 | 334 |
| 352 // The delegate may instantiate a new plugin. | 335 // The delegate may instantiate a new plugin. |
| 353 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 336 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 354 // The delegate may have dirtied style and layout of the WebView. | 337 // The delegate may have dirtied style and layout of the WebView. |
| 355 // See for example the resizePoster function in plugin_poster.html. | 338 // See for example the resizePoster function in plugin_poster.html. |
| 356 // Run the lifecycle now so that it is clean. | 339 // Run the lifecycle now so that it is clean. |
| 357 web_view_->updateAllLifecyclePhases(); | 340 web_view_->updateAllLifecyclePhases(); |
| 358 } | 341 } |
| OLD | NEW |