summaryrefslogtreecommitdiffstats
path: root/ppapi/native_client
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-13 19:18:52 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-13 19:18:52 +0000
commit47a961c13f61cdbd00a7020a5a8173586a8ed892 (patch)
treea89ea8f0c81f5c74cb5bcaf852e4e83ab21fbc75 /ppapi/native_client
parent8367f7b3aab8365ed5e696e4720a2a416d956d0a (diff)
downloadchromium_src-47a961c13f61cdbd00a7020a5a8173586a8ed892.zip
chromium_src-47a961c13f61cdbd00a7020a5a8173586a8ed892.tar.gz
chromium_src-47a961c13f61cdbd00a7020a5a8173586a8ed892.tar.bz2
Add support for threadsafe completion callback factory.
This also makes the default be threadsafe. The old factory wasn't threadsafe even to the extent claimed in the header which was causing hangs in plugins BUG=136284 Review URL: https://chromiumcodereview.appspot.com/10696157 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
-rw-r--r--ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h25
1 files changed, 2 insertions, 23 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
index 9b48e1f..90b93b7 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
@@ -39,26 +39,6 @@ class Plugin;
class PnaclCoordinator;
class PnaclTranslateThread;
-// A thread safe reference counting class Needed for CompletionCallbackFactory
-// in PnaclCoordinator.
-class PnaclRefCount {
- public:
- PnaclRefCount() : ref_(0) { NaClXMutexCtor(&mu_); }
- ~PnaclRefCount() { NaClMutexDtor(&mu_); }
- int32_t AddRef() {
- nacl::MutexLocker ml(&mu_);
- return ++ref_;
- }
- int32_t Release() {
- nacl::MutexLocker ml(&mu_);
- return --ref_;
- }
-
- private:
- int32_t ref_;
- struct NaClMutex mu_;
-};
-
// A class invoked by Plugin to handle PNaCl client-side translation.
// Usage:
// (1) Invoke the factory method, e.g.,
@@ -205,10 +185,9 @@ class PnaclCoordinator: public CallbackSource<FileStreamData> {
Plugin* plugin_;
pp::CompletionCallback translate_notify_callback_;
- // PnaclRefCount is only needed to support file lookups.
- // TODO(sehr): remove this when file lookup is through ReverseService.
+ // Threadsafety is required to support file lookups.
pp::CompletionCallbackFactory<PnaclCoordinator,
- PnaclRefCount> callback_factory_;
+ pp::ThreadSafeThreadTraits> callback_factory_;
// Nexe from the final native Link.
nacl::scoped_ptr<nacl::DescWrapper> translated_fd_;