summaryrefslogtreecommitdiffstats
path: root/content/ppapi_plugin
diff options
context:
space:
mode:
authoralexclarke <alexclarke@chromium.org>2015-09-24 03:18:55 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-24 10:20:11 +0000
commitde2989303f1246a29a62590c67a4eea91ba3ec7d (patch)
tree0858c622ff54a0e3f5c9154cd608968f3e62883e /content/ppapi_plugin
parent679ca9ca5333e72ca2f245f517d4a6f528549fc6 (diff)
downloadchromium_src-de2989303f1246a29a62590c67a4eea91ba3ec7d.zip
chromium_src-de2989303f1246a29a62590c67a4eea91ba3ec7d.tar.gz
chromium_src-de2989303f1246a29a62590c67a4eea91ba3ec7d.tar.bz2
Add a scheduler to PpapiBlinkPlatformImpl
This is to fix a bug where blink code called from within the ppapi process crashes if it calls Platform::current()->currentThread()->scheduler(). BUG=534972 Review URL: https://codereview.chromium.org/1366583003 Cr-Commit-Position: refs/heads/master@{#350517}
Diffstat (limited to 'content/ppapi_plugin')
-rw-r--r--content/ppapi_plugin/DEPS1
-rw-r--r--content/ppapi_plugin/ppapi_blink_platform_impl.cc10
-rw-r--r--content/ppapi_plugin/ppapi_blink_platform_impl.h6
3 files changed, 16 insertions, 1 deletions
diff --git a/content/ppapi_plugin/DEPS b/content/ppapi_plugin/DEPS
index bde9e92..903662b 100644
--- a/content/ppapi_plugin/DEPS
+++ b/content/ppapi_plugin/DEPS
@@ -1,4 +1,5 @@
include_rules = [
+ "+components/scheduler/ppapi",
"+content/child",
"+content/public/plugin",
"+ppapi/c",
diff --git a/content/ppapi_plugin/ppapi_blink_platform_impl.cc b/content/ppapi_plugin/ppapi_blink_platform_impl.cc
index 5c9de83..cea7886 100644
--- a/content/ppapi_plugin/ppapi_blink_platform_impl.cc
+++ b/content/ppapi_plugin/ppapi_blink_platform_impl.cc
@@ -10,6 +10,7 @@
#include "base/strings/string16.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
+#include "components/scheduler/ppapi/webthread_impl_for_ppapi.h"
#include "content/child/child_thread_impl.h"
#include "content/common/child_process_messages.h"
#include "ppapi/proxy/plugin_globals.h"
@@ -114,7 +115,8 @@ void PpapiBlinkPlatformImpl::SandboxSupport::getRenderStyleForStrike(
#endif // !defined(OS_ANDROID) && !defined(OS_WIN)
-PpapiBlinkPlatformImpl::PpapiBlinkPlatformImpl() {
+PpapiBlinkPlatformImpl::PpapiBlinkPlatformImpl()
+ : main_thread_(new scheduler::WebThreadImplForPPAPI()) {
#if !defined(OS_ANDROID) && !defined(OS_WIN)
sandbox_support_.reset(new PpapiBlinkPlatformImpl::SandboxSupport);
#endif
@@ -132,6 +134,12 @@ void PpapiBlinkPlatformImpl::Shutdown() {
#endif
}
+blink::WebThread* PpapiBlinkPlatformImpl::currentThread() {
+ if (main_thread_->isCurrentThread())
+ return main_thread_.get();
+ return BlinkPlatformImpl::currentThread();
+}
+
blink::WebClipboard* PpapiBlinkPlatformImpl::clipboard() {
NOTREACHED();
return NULL;
diff --git a/content/ppapi_plugin/ppapi_blink_platform_impl.h b/content/ppapi_plugin/ppapi_blink_platform_impl.h
index 3358436..d6553b7 100644
--- a/content/ppapi_plugin/ppapi_blink_platform_impl.h
+++ b/content/ppapi_plugin/ppapi_blink_platform_impl.h
@@ -9,6 +9,10 @@
#include "base/memory/scoped_ptr.h"
#include "content/child/blink_platform_impl.h"
+namespace scheduler {
+class WebThreadImplForPPAPI;
+}
+
namespace content {
class PpapiBlinkPlatformImpl : public BlinkPlatformImpl {
@@ -20,6 +24,7 @@ class PpapiBlinkPlatformImpl : public BlinkPlatformImpl {
void Shutdown();
// BlinkPlatformImpl methods:
+ virtual blink::WebThread* currentThread();
virtual blink::WebClipboard* clipboard();
virtual blink::WebMimeRegistry* mimeRegistry();
virtual blink::WebFileUtilities* fileUtilities();
@@ -54,6 +59,7 @@ class PpapiBlinkPlatformImpl : public BlinkPlatformImpl {
class SandboxSupport;
scoped_ptr<SandboxSupport> sandbox_support_;
#endif
+ scoped_ptr<scheduler::WebThreadImplForPPAPI> main_thread_;
DISALLOW_COPY_AND_ASSIGN(PpapiBlinkPlatformImpl);
};