summaryrefslogtreecommitdiffstats
path: root/content/ppapi_plugin
diff options
context:
space:
mode:
Diffstat (limited to 'content/ppapi_plugin')
-rw-r--r--content/ppapi_plugin/ppapi_thread.cc16
-rw-r--r--content/ppapi_plugin/ppapi_thread.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index d61e15b..3bd4edd 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -11,6 +11,8 @@
#include "base/process_util.h"
#include "base/rand_util.h"
#include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
+#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "content/common/child_process.h"
#include "content/common/child_process_messages.h"
@@ -138,6 +140,8 @@ bool PpapiThread::OnControlMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PpapiMsg_LoadPlugin, OnLoadPlugin)
IPC_MESSAGE_HANDLER(PpapiMsg_CreateChannel, OnCreateChannel)
IPC_MESSAGE_HANDLER(PpapiMsg_SetNetworkState, OnSetNetworkState)
+ IPC_MESSAGE_HANDLER(PpapiMsg_Crash, OnCrash)
+ IPC_MESSAGE_HANDLER(PpapiMsg_Hang, OnHang)
IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnResourceReply)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -382,6 +386,18 @@ void PpapiThread::OnSetNetworkState(bool online) {
ns->SetOnLine(PP_FromBool(online));
}
+void PpapiThread::OnCrash() {
+ // Intentionally crash upon the request of the browser.
+ volatile int* null_pointer = NULL;
+ *null_pointer = 0;
+}
+
+void PpapiThread::OnHang() {
+ // Intentionally hang upon the request of the browser.
+ for (;;)
+ base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
+}
+
bool PpapiThread::SetupRendererChannel(base::ProcessId renderer_pid,
int renderer_child_id,
bool incognito,
diff --git a/content/ppapi_plugin/ppapi_thread.h b/content/ppapi_plugin/ppapi_thread.h
index 8f7c901..d7fd039 100644
--- a/content/ppapi_plugin/ppapi_thread.h
+++ b/content/ppapi_plugin/ppapi_thread.h
@@ -97,6 +97,8 @@ class PpapiThread : public ChildThread,
const ppapi::proxy::ResourceMessageReplyParams& reply_params,
const IPC::Message& nested_msg);
void OnSetNetworkState(bool online);
+ 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.