Commit f50f930a authored by dmichael@chromium.org's avatar dmichael@chromium.org

PPAPI: Blocking callbacks shouldn't need a target_loop_

See bug for details.

BUG=285389

Review URL: https://chromiumcodereview.appspot.com/23706006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221535 0039d316-1c4b-4281-b951-d872f2087c98
parent bf00bb38
......@@ -165,16 +165,22 @@ void TrackedCallback::PostRun(int32_t result) {
// should never try to PostRun more than once otherwise.
DCHECK(result == PP_ERROR_ABORTED || !is_scheduled_);
base::Closure callback_closure(
RunWhileLocked(base::Bind(&TrackedCallback::Run, this, result)));
if (!target_loop_.get()) {
// We must be running in-process and on the main thread (the Enter
// classes protect against having a null target_loop_ otherwise).
DCHECK(IsMainThread());
DCHECK(PpapiGlobals::Get()->IsHostGlobals());
base::MessageLoop::current()->PostTask(FROM_HERE, callback_closure);
if (is_blocking()) {
// We might not have a MessageLoop to post to, so we must call Run()
// directly.
Run(result);
} else {
target_loop_->PostClosure(FROM_HERE, callback_closure, 0);
base::Closure callback_closure(
RunWhileLocked(base::Bind(&TrackedCallback::Run, this, result)));
if (target_loop_) {
target_loop_->PostClosure(FROM_HERE, callback_closure, 0);
} else {
// We must be running in-process and on the main thread (the Enter
// classes protect against having a null target_loop_ otherwise).
DCHECK(IsMainThread());
DCHECK(PpapiGlobals::Get()->IsHostGlobals());
base::MessageLoop::current()->PostTask(FROM_HERE, callback_closure);
}
}
is_scheduled_ = true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment