| Index: ppapi/shared_impl/resource_tracker.cc
|
| diff --git a/ppapi/shared_impl/resource_tracker.cc b/ppapi/shared_impl/resource_tracker.cc
|
| index 3b66db8b40b8c7d03b356f4b394706fc26c0fb20..2069c74913e69ef85d7b4918508d01e18a644fcc 100644
|
| --- a/ppapi/shared_impl/resource_tracker.cc
|
| +++ b/ppapi/shared_impl/resource_tracker.cc
|
| @@ -4,6 +4,9 @@
|
|
|
| #include "ppapi/shared_impl/resource_tracker.h"
|
|
|
| +#include "base/bind.h"
|
| +#include "base/compiler_specific.h"
|
| +#include "base/message_loop.h"
|
| #include "ppapi/shared_impl/callback_tracker.h"
|
| #include "ppapi/shared_impl/id_assignment.h"
|
| #include "ppapi/shared_impl/ppapi_globals.h"
|
| @@ -11,7 +14,9 @@
|
|
|
| namespace ppapi {
|
|
|
| -ResourceTracker::ResourceTracker() : last_resource_value_(0) {
|
| +ResourceTracker::ResourceTracker()
|
| + : last_resource_value_(0),
|
| + ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
|
| }
|
|
|
| ResourceTracker::~ResourceTracker() {
|
| @@ -67,6 +72,14 @@ void ResourceTracker::ReleaseResource(PP_Resource res) {
|
| }
|
| }
|
|
|
| +void ResourceTracker::ReleaseResourceSoon(PP_Resource res) {
|
| + MessageLoop::current()->PostNonNestableTask(
|
| + FROM_HERE,
|
| + base::Bind(&ResourceTracker::ReleaseResource,
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + res));
|
| +}
|
| +
|
| void ResourceTracker::DidCreateInstance(PP_Instance instance) {
|
| // Due to the infrastructure of some tests, the instance is registered
|
| // twice in a few cases. It would be nice not to do that and assert here
|
|
|