summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJocelyn Turcotte <jturcotte@woboq.com>2016-03-07 18:52:27 +0100
committerJocelyn Turcotte (Woboq GmbH) <jturcotte@woboq.com>2016-03-10 16:08:03 +0000
commit2648205d7bc0844cd70200497956fae4661e4b5d (patch)
tree67f0631afdf35d030191fd8114da4bf7c27da21a
parent54fd0501f411ad51139625f4e17a9f23999802b4 (diff)
Fix CDM plugins not always being loaded
This fixes the issue in a similar fashion to what Chromium is doing in chrome/browser/download/download_target_determiner.cc. PluginService::GetPlugins is the only way that the plugin info can be loaded. Since we can't do it on demand from the IO thread in a synchronous handler, do explicitly during the WebEngineContext initialization. Task-number: QTBUG-50132 Change-Id: I8ed796b541c880caf8546230b3a5011047eb0fe3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
-rw-r--r--src/core/web_engine_context.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 3f81f7a95..09e131272 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -58,6 +58,7 @@
#include "content/public/app/content_main.h"
#include "content/public/app/content_main_runner.h"
#include "content/public/browser/browser_main_runner.h"
+#include "content/public/browser/plugin_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h"
@@ -149,6 +150,12 @@ bool usingQtQuick2DRenderer()
return device == QLatin1String("softwarecontext");
}
+#if defined(ENABLE_PLUGINS)
+void dummyGetPluginCallback(const std::vector<content::WebPluginInfo>&)
+{
+}
+#endif
+
} // namespace
namespace QtWebEngineCore {
@@ -290,6 +297,16 @@ WebEngineContext::WebEngineContext()
// first gets referenced on the IO thread.
MediaCaptureDevicesDispatcher::GetInstance();
+#if defined(ENABLE_PLUGINS)
+ // Creating pepper plugins from the page (which calls PluginService::GetPluginInfoArray)
+ // might fail unless the page queried the list of available plugins at least once
+ // (which ends up calling PluginService::GetPlugins). Since the plugins list can only
+ // be created from the FILE thread, and that GetPluginInfoArray is synchronous, it
+ // can't loads plugins synchronously from the IO thread to serve the render process' request
+ // and we need to make sure that it happened beforehand.
+ content::PluginService::GetInstance()->GetPlugins(base::Bind(&dummyGetPluginCallback));
+#endif
+
#if defined(ENABLE_BASIC_PRINTING)
m_printJobManager.reset(new printing::PrintJobManager());
#endif // defined(ENABLE_BASIC_PRINTING)