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

Unified Diff: third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp

Issue 2218883002: Record HTMLPluginElement::requestObject result. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pdr comments Created 4 years, 4 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 | « third_party/WebKit/Source/core/html/HTMLPlugInElement.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
index 52e341805564d0756a265dadfbee14252fec77e1..b9c293c40c4399bbd4778456951a8e5589da9901 100644
--- a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
@@ -45,6 +45,7 @@
#include "core/page/Page.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
#include "core/plugins/PluginView.h"
+#include "platform/Histogram.h"
#include "platform/Logging.h"
#include "platform/MIMETypeFromURL.h"
#include "platform/MIMETypeRegistry.h"
@@ -57,6 +58,18 @@ namespace blink {
using namespace HTMLNames;
+namespace {
+
+// Used for histograms, do not change the order.
+enum PluginRequestObjectResult {
+ PluginRequestObjectResultFailure = 0,
+ PluginRequestObjectResultSuccess = 1,
+ // Keep at the end.
+ PluginRequestObjectResultMax
+};
+
+} // anonymous namespace
+
HTMLPlugInElement::HTMLPlugInElement(const QualifiedName& tagName, Document& doc, bool createdByParser, PreferPlugInsForImagesOption preferPlugInsForImagesOption)
: HTMLFrameOwnerElement(tagName, doc)
, m_isDelayingLoadEvent(false)
@@ -97,6 +110,31 @@ void HTMLPlugInElement::setPersistedPluginWidget(Widget* widget)
m_persistedPluginWidget = widget;
}
+bool HTMLPlugInElement::requestObjectInternal(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
+{
+ if (url.isEmpty() && mimeType.isEmpty())
+ return false;
+
+ if (protocolIsJavaScript(url))
+ return false;
+
+ KURL completedURL = url.isEmpty() ? KURL() : document().completeURL(url);
+ if (!allowedToLoadObject(completedURL, mimeType))
+ return false;
+
+ bool useFallback;
+ if (!shouldUsePlugin(completedURL, mimeType, hasFallbackContent(), useFallback)) {
+ // If the plugin element already contains a subframe,
+ // loadOrRedirectSubframe will re-use it. Otherwise, it will create a
+ // new frame and set it as the LayoutPart's widget, causing what was
+ // previously in the widget to be torn down.
+ return loadOrRedirectSubframe(completedURL, getNameAttribute(), true);
+ }
+
+ return loadPlugin(completedURL, mimeType, paramNames, paramValues, useFallback, true);
+}
+
+
bool HTMLPlugInElement::canProcessDrag() const
{
return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(pluginWidget())->canProcessDrag();
@@ -446,26 +484,12 @@ bool HTMLPlugInElement::wouldLoadAsNetscapePlugin(const String& url, const Strin
bool HTMLPlugInElement::requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
{
- if (url.isEmpty() && mimeType.isEmpty())
- return false;
-
- if (protocolIsJavaScript(url))
- return false;
-
- KURL completedURL = url.isEmpty() ? KURL() : document().completeURL(url);
- if (!allowedToLoadObject(completedURL, mimeType))
- return false;
+ bool result = requestObjectInternal(url, mimeType, paramNames, paramValues);
- bool useFallback;
- if (!shouldUsePlugin(completedURL, mimeType, hasFallbackContent(), useFallback)) {
- // If the plugin element already contains a subframe,
- // loadOrRedirectSubframe will re-use it. Otherwise, it will create a
- // new frame and set it as the LayoutPart's widget, causing what was
- // previously in the widget to be torn down.
- return loadOrRedirectSubframe(completedURL, getNameAttribute(), true);
- }
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, resultHistogram, ("Plugin.RequestObjectResult", PluginRequestObjectResultMax));
+ resultHistogram.count(result ? PluginRequestObjectResultSuccess : PluginRequestObjectResultFailure);
- return loadPlugin(completedURL, mimeType, paramNames, paramValues, useFallback, true);
+ return result;
}
bool HTMLPlugInElement::loadPlugin(const KURL& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback, bool requireLayoutObject)
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLPlugInElement.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698