| Index: ppapi/thunk/enter.cc
|
| diff --git a/ppapi/thunk/enter.cc b/ppapi/thunk/enter.cc
|
| index 03937c9b5338b353b469fc9d92366b9f2eb1247e..a98a3ec3102e07130639f8f26f6d22c4467b59d4 100644
|
| --- a/ppapi/thunk/enter.cc
|
| +++ b/ppapi/thunk/enter.cc
|
| @@ -23,6 +23,12 @@ bool IsMainThread() {
|
| PpapiGlobals::Get()->GetMainThreadMessageLoop()->BelongsToCurrentThread();
|
| }
|
|
|
| +bool CurrentThreadHandlingBlockingMessage() {
|
| + ppapi::MessageLoopShared* current =
|
| + PpapiGlobals::Get()->GetCurrentMessageLoop();
|
| + return current && current->CurrentlyHandlingBlockingMessage();
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace thunk {
|
| @@ -141,6 +147,18 @@ void EnterBase::SetStateForCallbackError(bool report_error) {
|
| PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR,
|
| std::string(), message);
|
| }
|
| + } else if (callback_->is_blocking() &&
|
| + CurrentThreadHandlingBlockingMessage()) {
|
| + // Blocking callbacks are not allowed while handling a blocking message.
|
| + callback_->MarkAsCompleted();
|
| + callback_ = NULL;
|
| + retval_ = PP_ERROR_WOULD_BLOCK_THREAD;
|
| + if (report_error) {
|
| + std::string message("Blocking callbacks are not allowed while handling "
|
| + "a blocking message from JavaScript.");
|
| + PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR,
|
| + std::string(), message);
|
| + }
|
| } else if (!IsMainThread() &&
|
| callback_->has_null_target_loop() &&
|
| !callback_->is_blocking()) {
|
|
|