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

Unified Diff: ppapi/proxy/message_handler.cc

Issue 600553002: PPAPI: Disallow blocking callbacks while handling a blocking message (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
Index: ppapi/proxy/message_handler.cc
diff --git a/ppapi/proxy/message_handler.cc b/ppapi/proxy/message_handler.cc
index e095dd76509a84465b2953d362ea02f4db51ce18..a0f5cccb18393e58f0971c97652505abc8b07a9a 100644
--- a/ppapi/proxy/message_handler.cc
+++ b/ppapi/proxy/message_handler.cc
@@ -39,8 +39,12 @@ void HandleBlockingMessageWrapper(HandleBlockingMessageFunc function,
if (!dispatcher)
return;
PP_Var result = PP_MakeUndefined();
+ MessageLoopResource::GetCurrent()->
+ set_currently_handling_blocking_message(true);
CallWhileUnlocked(
function, instance, user_data, &message_data.get(), &result);
+ MessageLoopResource::GetCurrent()->
+ set_currently_handling_blocking_message(false);
PpapiMsg_PPPMessageHandler_HandleBlockingMessage::WriteReplyParams(
reply_msg.get(),
SerializedVarReturnValue::Convert(dispatcher, result),
@@ -64,10 +68,14 @@ void HandleBlockingMessageWrapper_0_1(HandleBlockingMessageFunc_0_1 function,
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (!dispatcher)
return;
+ MessageLoopResource::GetCurrent()->
+ set_currently_handling_blocking_message(true);
PP_Var return_value = CallWhileUnlocked(function,
instance,
user_data,
message_data.get());
+ MessageLoopResource::GetCurrent()->
+ set_currently_handling_blocking_message(false);
PpapiMsg_PPPMessageHandler_HandleBlockingMessage::WriteReplyParams(
reply_msg.get(),
SerializedVarReturnValue::Convert(dispatcher, return_value),

Powered by Google App Engine
This is Rietveld 408576698