Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Unified Diff: ppapi/shared_impl/resource_tracker.h

Issue 10912086: Add CHECKs to ensure that PPAPI resources are created on the right thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/ppapi/ppapi_browsertest.cc ('k') | ppapi/shared_impl/resource_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « chrome/test/ppapi/ppapi_browsertest.cc ('k') | ppapi/shared_impl/resource_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698