Index: ppapi/shared_impl/resource_tracker.h |
diff --git a/ppapi/shared_impl/resource_tracker.h b/ppapi/shared_impl/resource_tracker.h |
index 1c46bf5fe6f55f6141f1cf2905adc0006dfc4219..2f1c54e8b557603a06ac13b15e5588ac0a774b9e 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); |
}; |