Index: trunk/src/ppapi/shared_impl/resource_tracker.h |
=================================================================== |
--- trunk/src/ppapi/shared_impl/resource_tracker.h (revision 189681) |
+++ trunk/src/ppapi/shared_impl/resource_tracker.h (working copy) |
@@ -10,7 +10,6 @@ |
#include "base/basictypes.h" |
#include "base/hash_tables.h" |
#include "base/memory/linked_ptr.h" |
-#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
#include "base/threading/thread_checker.h" |
#include "base/threading/thread_checker_impl.h" |
@@ -24,12 +23,7 @@ |
class PPAPI_SHARED_EXPORT ResourceTracker { |
public: |
- // A SINGLE_THREADED ResourceTracker will use a thread-checker to make sure |
- // it's always invoked on the same thread on which it was constructed. A |
- // THREAD_SAFE ResourceTracker will check that the ProxyLock is held. See |
- // CheckThreadingPreconditions() for more details. |
- enum ThreadMode { SINGLE_THREADED, THREAD_SAFE }; |
- explicit ResourceTracker(ThreadMode thread_mode); |
+ ResourceTracker(); |
virtual ~ResourceTracker(); |
// The returned pointer will be NULL if there is no resource. The reference |
@@ -59,10 +53,6 @@ |
// This calls AddResource and RemoveResource. |
friend class Resource; |
- // On the host-side, make sure we are called on the right thread. On the |
- // plugin side, make sure we have the proxy lock. |
- void CheckThreadingPreconditions() const; |
- |
// Adds the given resource to the tracker, associating it with the instance |
// stored in the resource object. The new resource ID is returned, and the |
// resource will have 0 plugin refcount. This is called by the resource |
@@ -108,11 +98,19 @@ |
base::WeakPtrFactory<ResourceTracker> weak_ptr_factory_; |
- // On the host side, we want to check that we are only called on the main |
- // thread. This is to protect us from accidentally using the tracker from |
- // other threads (especially the IO thread). On the plugin side, the tracker |
- // is protected by the proxy lock and is thread-safe, so this will be NULL. |
- scoped_ptr<base::ThreadChecker> thread_checker_; |
+ // 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); |
}; |