summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl/resource_tracker.h
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/shared_impl/resource_tracker.h')
-rw-r--r--ppapi/shared_impl/resource_tracker.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/ppapi/shared_impl/resource_tracker.h b/ppapi/shared_impl/resource_tracker.h
index 1c46bf5..2f1c54e 100644
--- a/ppapi/shared_impl/resource_tracker.h
+++ b/ppapi/shared_impl/resource_tracker.h
@@ -11,6 +11,8 @@
#include "base/hash_tables.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "base/threading/thread_checker_impl.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
@@ -63,11 +65,11 @@ class PPAPI_SHARED_EXPORT ResourceTracker {
// the given resource. It's called from the resource destructor.
virtual void RemoveResource(Resource* object);
+ private:
// Calls LastPluginRefWasDeleted on the given resource object and cancels
// pending callbacks for the resource.
void LastPluginRefWasDeleted(Resource* object);
- private:
typedef std::set<PP_Resource> ResourceSet;
struct InstanceData {
@@ -96,6 +98,20 @@ class PPAPI_SHARED_EXPORT ResourceTracker {
base::WeakPtrFactory<ResourceTracker> weak_ptr_factory_;
+ // TODO(raymes): We won't need to do thread checks once pepper calls are
+ // allowed off of the main thread.
+ // See http://code.google.com/p/chromium/issues/detail?id=92909.
+#ifdef ENABLE_PEPPER_THREADING
+ base::ThreadCheckerDoNothing thread_checker_;
+#else
+ // TODO(raymes): We've seen plugins (Flash) creating resources from random
+ // threads. Let's always crash for now in this case. Once we have a handle
+ // over how common this is, we can change ThreadCheckerImpl->ThreadChecker
+ // so that we only crash in debug mode. See
+ // https://code.google.com/p/chromium/issues/detail?id=146415.
+ base::ThreadCheckerImpl thread_checker_;
+#endif
+
DISALLOW_COPY_AND_ASSIGN(ResourceTracker);
};