summaryrefslogtreecommitdiff
path: root/chromium/content/ppapi_plugin
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-07-14 17:41:05 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-08-04 12:37:36 +0000
commit399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (patch)
tree6b06b60ff365abef0e13b3503d593a0df48d20e8 /chromium/content/ppapi_plugin
parent7366110654eec46f21b6824f302356426f48cd74 (diff)
downloadqtwebengine-chromium-399c965b6064c440ddcf4015f5f8e9d131c7a0a6.tar.gz
BASELINE: Update Chromium to 52.0.2743.76 and Ninja to 1.7.1
Change-Id: I382f51b959689505a60f8b707255ecb344f7d8b4 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/content/ppapi_plugin')
-rw-r--r--chromium/content/ppapi_plugin/BUILD.gn5
-rw-r--r--chromium/content/ppapi_plugin/OWNERS1
-rw-r--r--chromium/content/ppapi_plugin/broker_process_dispatcher.cc39
-rw-r--r--chromium/content/ppapi_plugin/broker_process_dispatcher.h5
-rw-r--r--chromium/content/ppapi_plugin/ppapi.sb1
-rw-r--r--chromium/content/ppapi_plugin/ppapi_blink_platform_impl.cc3
-rw-r--r--chromium/content/ppapi_plugin/ppapi_blink_platform_impl.h5
-rw-r--r--chromium/content/ppapi_plugin/ppapi_plugin_main.cc32
-rw-r--r--chromium/content/ppapi_plugin/ppapi_thread.cc27
-rw-r--r--chromium/content/ppapi_plugin/ppapi_thread.h18
10 files changed, 76 insertions, 60 deletions
diff --git a/chromium/content/ppapi_plugin/BUILD.gn b/chromium/content/ppapi_plugin/BUILD.gn
index e8dfe47d7df..8b141bf3331 100644
--- a/chromium/content/ppapi_plugin/BUILD.gn
+++ b/chromium/content/ppapi_plugin/BUILD.gn
@@ -21,6 +21,9 @@ source_set("ppapi_plugin_sources") {
visibility = [
":ppapi_plugin",
"//content", # For the component build.
+ "//content/app:both",
+ "//content/app:browser",
+ "//content/app:child",
"//gin",
]
@@ -47,8 +50,8 @@ source_set("ppapi_plugin_sources") {
"//content:export",
"//content/public/child:child_sources",
"//content/public/common:common_sources",
- "//mojo/shell/public/interfaces",
"//ppapi/proxy:ipc",
+ "//services/shell/public/interfaces",
"//skia",
"//third_party/WebKit/public:blink",
"//third_party/icu",
diff --git a/chromium/content/ppapi_plugin/OWNERS b/chromium/content/ppapi_plugin/OWNERS
index 06209509b74..bf1820623e4 100644
--- a/chromium/content/ppapi_plugin/OWNERS
+++ b/chromium/content/ppapi_plugin/OWNERS
@@ -1,4 +1,5 @@
piman@chromium.org
+yzshen@chromium.org
# Mac Sandbox profiles.
per-file *.sb=set noparent
diff --git a/chromium/content/ppapi_plugin/broker_process_dispatcher.cc b/chromium/content/ppapi_plugin/broker_process_dispatcher.cc
index 601966b3b5d..a6e5ba6d9e8 100644
--- a/chromium/content/ppapi_plugin/broker_process_dispatcher.cc
+++ b/chromium/content/ppapi_plugin/broker_process_dispatcher.cc
@@ -6,9 +6,11 @@
#include <stddef.h>
+#include <memory>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/debug/dump_without_crashing.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "content/child/child_process.h"
@@ -47,7 +49,7 @@ void GetPermissionSettingsCallback(
PP_Flash_BrowserOperations_Permission default_permission,
uint32_t site_count,
const PP_Flash_BrowserOperations_SiteSetting sites[]) {
- scoped_ptr<GetPermissionSettingsContext> context(
+ std::unique_ptr<GetPermissionSettingsContext> context(
reinterpret_cast<GetPermissionSettingsContext*>(user_data));
if (!context->dispatcher.get())
@@ -76,12 +78,14 @@ void GetPermissionSettingsCallback(
BrokerProcessDispatcher::BrokerProcessDispatcher(
PP_GetInterface_Func get_plugin_interface,
- PP_ConnectInstance_Func connect_instance)
+ PP_ConnectInstance_Func connect_instance,
+ bool peer_is_browser)
: ppapi::proxy::BrokerSideDispatcher(connect_instance),
get_plugin_interface_(get_plugin_interface),
flash_browser_operations_1_3_(NULL),
flash_browser_operations_1_2_(NULL),
- flash_browser_operations_1_0_(NULL) {
+ flash_browser_operations_1_0_(NULL),
+ peer_is_browser_(peer_is_browser) {
if (get_plugin_interface) {
flash_browser_operations_1_0_ =
static_cast<const PPP_Flash_BrowserOperations_1_0*>(
@@ -109,17 +113,36 @@ BrokerProcessDispatcher::~BrokerProcessDispatcher() {
}
bool BrokerProcessDispatcher::OnMessageReceived(const IPC::Message& msg) {
+ if (BrokerSideDispatcher::OnMessageReceived(msg))
+ return true;
+
+ if (!peer_is_browser_) {
+ // We might want to consider killing the peer instead is we see problems in
+ // the future.
+ if (msg.type() == PpapiMsg_GetSitesWithData::ID ||
+ msg.type() == PpapiMsg_ClearSiteData::ID ||
+ msg.type() == PpapiMsg_DeauthorizeContentLicenses::ID ||
+ msg.type() == PpapiMsg_GetPermissionSettings::ID ||
+ msg.type() == PpapiMsg_SetDefaultPermission::ID ||
+ msg.type() == PpapiMsg_SetSitePermission::ID) {
+ base::debug::DumpWithoutCrashing();
+ }
+ return false;
+ }
+
+ bool handled = true;
IPC_BEGIN_MESSAGE_MAP(BrokerProcessDispatcher, msg)
IPC_MESSAGE_HANDLER(PpapiMsg_GetSitesWithData, OnGetSitesWithData)
IPC_MESSAGE_HANDLER(PpapiMsg_ClearSiteData, OnClearSiteData)
IPC_MESSAGE_HANDLER(PpapiMsg_DeauthorizeContentLicenses,
OnDeauthorizeContentLicenses)
- IPC_MESSAGE_HANDLER(PpapiMsg_GetPermissionSettings, OnGetPermissionSettings)
+ IPC_MESSAGE_HANDLER(PpapiMsg_GetPermissionSettings,
+ OnGetPermissionSettings)
IPC_MESSAGE_HANDLER(PpapiMsg_SetDefaultPermission, OnSetDefaultPermission)
IPC_MESSAGE_HANDLER(PpapiMsg_SetSitePermission, OnSetSitePermission)
- IPC_MESSAGE_UNHANDLED(return BrokerSideDispatcher::OnMessageReceived(msg))
+ IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
- return true;
+ return handled;
}
void BrokerProcessDispatcher::OnGetPermissionSettingsCompleted(
@@ -300,7 +323,7 @@ bool BrokerProcessDispatcher::SetSitePermission(
return true;
std::string data_str = ConvertPluginDataPath(plugin_data_path);
- scoped_ptr<PP_Flash_BrowserOperations_SiteSetting[]> site_array(
+ std::unique_ptr<PP_Flash_BrowserOperations_SiteSetting[]> site_array(
new PP_Flash_BrowserOperations_SiteSetting[sites.size()]);
for (size_t i = 0; i < sites.size(); ++i) {
diff --git a/chromium/content/ppapi_plugin/broker_process_dispatcher.h b/chromium/content/ppapi_plugin/broker_process_dispatcher.h
index 9dca6df10b9..95401dd0237 100644
--- a/chromium/content/ppapi_plugin/broker_process_dispatcher.h
+++ b/chromium/content/ppapi_plugin/broker_process_dispatcher.h
@@ -24,7 +24,8 @@ class BrokerProcessDispatcher
public base::SupportsWeakPtr<BrokerProcessDispatcher> {
public:
BrokerProcessDispatcher(PP_GetInterface_Func get_plugin_interface,
- PP_ConnectInstance_Func connect_instance);
+ PP_ConnectInstance_Func connect_instance,
+ bool peer_is_browser);
~BrokerProcessDispatcher() override;
// IPC::Listener overrides.
@@ -88,6 +89,8 @@ class BrokerProcessDispatcher
const PPP_Flash_BrowserOperations_1_2* flash_browser_operations_1_2_;
const PPP_Flash_BrowserOperations_1_0* flash_browser_operations_1_0_;
+ bool peer_is_browser_;
+
DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher);
};
diff --git a/chromium/content/ppapi_plugin/ppapi.sb b/chromium/content/ppapi_plugin/ppapi.sb
index 79250318d98..fc55721ce50 100644
--- a/chromium/content/ppapi_plugin/ppapi.sb
+++ b/chromium/content/ppapi_plugin/ppapi.sb
@@ -13,6 +13,7 @@
(allow file-read* (regex #"^/Library/Fonts($|/)"))
(allow mach-lookup (global-name "com.apple.FontObjectsServer"))
(allow mach-lookup (global-name "com.apple.FontServer"))
+(allow mach-lookup (global-name "com.apple.fonts"))
; https://crbug.com/11269
(allow file-read* (subpath (user-homedir-path "/Library/Fonts")))
diff --git a/chromium/content/ppapi_plugin/ppapi_blink_platform_impl.cc b/chromium/content/ppapi_plugin/ppapi_blink_platform_impl.cc
index 01c04ece935..d1753ee83f5 100644
--- a/chromium/content/ppapi_plugin/ppapi_blink_platform_impl.cc
+++ b/chromium/content/ppapi_plugin/ppapi_blink_platform_impl.cc
@@ -200,8 +200,7 @@ blink::WebString PpapiBlinkPlatformImpl::cookies(
}
blink::WebString PpapiBlinkPlatformImpl::defaultLocale() {
- NOTREACHED();
- return blink::WebString();
+ return blink::WebString::fromUTF8("en");
}
blink::WebThemeEngine* PpapiBlinkPlatformImpl::themeEngine() {
diff --git a/chromium/content/ppapi_plugin/ppapi_blink_platform_impl.h b/chromium/content/ppapi_plugin/ppapi_blink_platform_impl.h
index e9b8f39c794..d3f25b4ec79 100644
--- a/chromium/content/ppapi_plugin/ppapi_blink_platform_impl.h
+++ b/chromium/content/ppapi_plugin/ppapi_blink_platform_impl.h
@@ -7,8 +7,9 @@
#include <stddef.h>
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "content/child/blink_platform_impl.h"
@@ -56,7 +57,7 @@ class PpapiBlinkPlatformImpl : public BlinkPlatformImpl {
private:
#if !defined(OS_ANDROID) && !defined(OS_WIN)
class SandboxSupport;
- scoped_ptr<SandboxSupport> sandbox_support_;
+ std::unique_ptr<SandboxSupport> sandbox_support_;
#endif
DISALLOW_COPY_AND_ASSIGN(PpapiBlinkPlatformImpl);
diff --git a/chromium/content/ppapi_plugin/ppapi_plugin_main.cc b/chromium/content/ppapi_plugin/ppapi_plugin_main.cc
index ccd05e9111b..7e53b57a83f 100644
--- a/chromium/content/ppapi_plugin/ppapi_plugin_main.cc
+++ b/chromium/content/ppapi_plugin/ppapi_plugin_main.cc
@@ -31,8 +31,9 @@
#include "sandbox/win/src/sandbox.h"
#include "third_party/WebKit/public/web/win/WebFontRendering.h"
#include "third_party/skia/include/ports/SkTypeface_win.h"
+#include "ui/display/win/dpi.h"
+#include "ui/gfx/font_render_params.h"
#include "ui/gfx/win/direct_write.h"
-#include "ui/gfx/win/dpi.h"
#endif
#if defined(OS_CHROMEOS)
@@ -59,18 +60,6 @@ void* g_target_services = 0;
namespace content {
-namespace {
-
-#if defined(OS_WIN)
-// Windows-only skia sandbox support
-void SkiaPreCacheFont(const LOGFONT& logfont) {
- ppapi::proxy::PluginGlobals::Get()->PreCacheFontForFlash(
- reinterpret_cast<const void*>(&logfont));
-}
-#endif
-
-} // namespace
-
// Main function for starting the PPAPI plugin process.
int PpapiPluginMain(const MainFunctionParams& parameters) {
const base::CommandLine& command_line = parameters.command_line;
@@ -141,15 +130,16 @@ int PpapiPluginMain(const MainFunctionParams& parameters) {
#if defined(OS_WIN)
if (!base::win::IsUser32AndGdi32Available())
gfx::win::MaybeInitializeDirectWrite();
- bool use_direct_write = gfx::win::IsDirectWriteEnabled();
- if (use_direct_write) {
- InitializeDWriteFontProxy();
- } else {
- SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont);
- }
+ InitializeDWriteFontProxy();
+
+ blink::WebFontRendering::setDeviceScaleFactor(display::win::GetDPIScale());
- blink::WebFontRendering::setUseDirectWrite(use_direct_write);
- blink::WebFontRendering::setDeviceScaleFactor(gfx::GetDPIScale());
+ const gfx::FontRenderParams font_params =
+ gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr);
+ blink::WebFontRendering::setAntialiasedTextEnabled(font_params.antialiasing);
+ blink::WebFontRendering::setLCDTextEnabled(
+ font_params.subpixel_rendering !=
+ gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE);
#endif
main_message_loop.Run();
diff --git a/chromium/content/ppapi_plugin/ppapi_thread.cc b/chromium/content/ppapi_plugin/ppapi_thread.cc
index 8e0724b5e6b..ea5e4bc341e 100644
--- a/chromium/content/ppapi_plugin/ppapi_thread.cc
+++ b/chromium/content/ppapi_plugin/ppapi_thread.cc
@@ -28,7 +28,6 @@
#include "content/child/child_discardable_shared_memory_manager.h"
#include "content/child/child_process.h"
#include "content/common/child_process_messages.h"
-#include "content/common/sandbox_util.h"
#include "content/ppapi_plugin/broker_process_dispatcher.h"
#include "content/ppapi_plugin/plugin_process_dispatcher.h"
#include "content/ppapi_plugin/ppapi_blink_platform_impl.h"
@@ -192,15 +191,7 @@ IPC::PlatformFileForTransit PpapiThread::ShareHandleWithRemote(
base::PlatformFile handle,
base::ProcessId peer_pid,
bool should_close_source) {
-#if defined(OS_WIN)
- if (peer_handle_.IsValid()) {
- DCHECK(is_broker_);
- return IPC::GetPlatformFileForTransit(handle, should_close_source);
- }
-#endif
-
- DCHECK(peer_pid != base::kNullProcessId);
- return BrokerGetFileHandleForProcess(handle, peer_pid, should_close_source);
+ return IPC::GetPlatformFileForTransit(handle, should_close_source);
}
base::SharedMemoryHandle PpapiThread::ShareSharedMemoryHandleWithRemote(
@@ -453,8 +444,8 @@ void PpapiThread::OnCreateChannel(base::ProcessId renderer_pid,
IPC::ChannelHandle channel_handle;
if (!plugin_entry_points_.get_interface || // Plugin couldn't be loaded.
- !SetupRendererChannel(renderer_pid, renderer_child_id, incognito,
- &channel_handle)) {
+ !SetupChannel(renderer_pid, renderer_child_id, incognito,
+ &channel_handle)) {
Send(new PpapiHostMsg_ChannelCreated(IPC::ChannelHandle()));
return;
}
@@ -492,10 +483,10 @@ void PpapiThread::OnHang() {
base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
}
-bool PpapiThread::SetupRendererChannel(base::ProcessId renderer_pid,
- int renderer_child_id,
- bool incognito,
- IPC::ChannelHandle* handle) {
+bool PpapiThread::SetupChannel(base::ProcessId renderer_pid,
+ int renderer_child_id,
+ bool incognito,
+ IPC::ChannelHandle* handle) {
DCHECK(is_broker_ == (connect_instance_func_ != NULL));
IPC::ChannelHandle plugin_handle;
plugin_handle.name = IPC::Channel::GenerateVerifiedChannelID(
@@ -505,15 +496,17 @@ bool PpapiThread::SetupRendererChannel(base::ProcessId renderer_pid,
ppapi::proxy::ProxyChannel* dispatcher = NULL;
bool init_result = false;
if (is_broker_) {
+ bool peer_is_browser = renderer_pid == base::kNullProcessId;
BrokerProcessDispatcher* broker_dispatcher =
new BrokerProcessDispatcher(plugin_entry_points_.get_interface,
- connect_instance_func_);
+ connect_instance_func_, peer_is_browser);
init_result = broker_dispatcher->InitBrokerWithChannel(this,
renderer_pid,
plugin_handle,
false);
dispatcher = broker_dispatcher;
} else {
+ DCHECK_NE(base::kNullProcessId, renderer_pid);
PluginProcessDispatcher* plugin_dispatcher =
new PluginProcessDispatcher(plugin_entry_points_.get_interface,
permissions_,
diff --git a/chromium/content/ppapi_plugin/ppapi_thread.h b/chromium/content/ppapi_plugin/ppapi_thread.h
index 34d807723ae..a3b322bb7aa 100644
--- a/chromium/content/ppapi_plugin/ppapi_thread.h
+++ b/chromium/content/ppapi_plugin/ppapi_thread.h
@@ -8,11 +8,11 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/process/process.h"
#include "base/scoped_native_library.h"
#include "build/build_config.h"
@@ -110,12 +110,14 @@ class PpapiThread : public ChildThreadImpl,
void OnCrash();
void OnHang();
- // Sets up the channel to the given renderer. On success, returns true and
- // fills the given ChannelHandle with the information from the new channel.
- bool SetupRendererChannel(base::ProcessId renderer_pid,
- int renderer_child_id,
- bool incognito,
- IPC::ChannelHandle* handle);
+ // Sets up the channel to the given renderer. If |renderer_pid| is
+ // base::kNullProcessId, the channel is set up to the browser. On success,
+ // returns true and fills the given ChannelHandle with the information from
+ // the new channel.
+ bool SetupChannel(base::ProcessId renderer_pid,
+ int renderer_child_id,
+ bool incognito,
+ IPC::ChannelHandle* handle);
// Sets up the name of the plugin for logging using the given path.
void SavePluginName(const base::FilePath& path);
@@ -163,7 +165,7 @@ class PpapiThread : public ChildThreadImpl,
uint32_t next_plugin_dispatcher_id_;
// The BlinkPlatformImpl implementation.
- scoped_ptr<PpapiBlinkPlatformImpl> blink_platform_impl_;
+ std::unique_ptr<PpapiBlinkPlatformImpl> blink_platform_impl_;
#if defined(OS_WIN)
// Caches the handle to the peer process if this is a broker.