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

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
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..0504996524b10166202b968439b54c0c03d79d61 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"
@@ -96,6 +98,20 @@ class PPAPI_SHARED_EXPORT ResourceTracker {
base::WeakPtrFactory<ResourceTracker> weak_ptr_factory_;
+ // TODO(raymes): We won't be able to do thread checks once pepper calls are
+ // allowed off of the main thread.
dmichael (off chromium) 2012/09/06 02:57:26 I would rephrase that to "We won't need to do thre
raymes 2012/09/06 16:23:59 Done.
+ // 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);
};

Powered by Google App Engine
This is Rietveld 408576698