Commit ac860c7f authored by dmichael's avatar dmichael Committed by Commit bot

PPAPI: Don't use MessageLoop::current in the plugin process

The plugin is allowed to use Pepper without having bound a PPB_MessageLoop
to the calling thread, which means MessageLoop::current won't be valid.
Instead, we should just post to the Pepper main thread.

BUG=459671

Review URL: https://codereview.chromium.org/938843002

Cr-Commit-Position: refs/heads/master@{#316924}
parent 94a977f6
......@@ -282,7 +282,7 @@ void ImageDataCache::Add(ImageData* image_data) {
cache_[image_data->pp_instance()].Add(image_data);
// Schedule a timer to invalidate this entry.
base::MessageLoop::current()->PostDelayedTask(
PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask(
FROM_HERE,
RunWhileLocked(base::Bind(&ImageDataCache::OnTimer,
weak_factory_.GetWeakPtr(),
......
......@@ -930,7 +930,7 @@ void PPB_Instance_Proxy::SelectionChanged(PP_Instance instance) {
data->should_do_request_surrounding_text = true;
if (!data->is_request_surrounding_text_pending) {
base::MessageLoop::current()->PostTask(
PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
FROM_HERE,
RunWhileLocked(base::Bind(&RequestSurroundingText, instance)));
data->is_request_surrounding_text_pending = true;
......
......@@ -22,6 +22,7 @@
#include "ppapi/proxy/ppp_class_proxy.h"
#include "ppapi/proxy/proxy_object_var.h"
#include "ppapi/proxy/serialized_var.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/ppb_var_shared.h"
#include "ppapi/shared_impl/proxy_lock.h"
#include "ppapi/shared_impl/var.h"
......@@ -379,7 +380,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgReleaseObject(int64 object_id) {
// spurious warning).
// TODO(piman): See if we can fix the IPC code to enforce strict ordering, and
// then remove this.
base::MessageLoop::current()->PostNonNestableTask(
PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostNonNestableTask(
FROM_HERE,
RunWhileLocked(base::Bind(&PPB_Var_Deprecated_Proxy::DoReleaseObject,
task_factory_.GetWeakPtr(),
......
......@@ -90,7 +90,7 @@ void ResourceTracker::ReleaseResource(PP_Resource res) {
}
void ResourceTracker::ReleaseResourceSoon(PP_Resource res) {
base::MessageLoop::current()->PostNonNestableTask(
PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostNonNestableTask(
FROM_HERE,
RunWhileLocked(base::Bind(&ResourceTracker::ReleaseResource,
weak_ptr_factory_.GetWeakPtr(),
......
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