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

Unified Diff: trunk/src/ppapi/proxy/plugin_globals.cc

Issue 12920003: Revert 189518 "PPAPI: Remove threading options; it's always on" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 9 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 | « trunk/src/ppapi/proxy/plugin_globals.h ('k') | trunk/src/ppapi/proxy/plugin_resource_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ppapi/proxy/plugin_globals.cc
===================================================================
--- trunk/src/ppapi/proxy/plugin_globals.cc (revision 189681)
+++ trunk/src/ppapi/proxy/plugin_globals.cc (working copy)
@@ -49,36 +49,40 @@
PluginGlobals::PluginGlobals()
: ppapi::PpapiGlobals(),
plugin_proxy_delegate_(NULL),
- callback_tracker_(new CallbackTracker) {
+ callback_tracker_(new CallbackTracker),
+ loop_for_main_thread_(
+ new MessageLoopResource(MessageLoopResource::ForMainThread())) {
+#if defined(ENABLE_PEPPER_THREADING)
+ enable_threading_ = true;
+#else
+ enable_threading_ = false;
+#endif
+
DCHECK(!plugin_globals_);
plugin_globals_ = this;
-
- // ResourceTracker asserts that we have the lock when we add new resources,
- // so we lock when creating the MessageLoopResource even though there is no
- // chance of race conditions.
- ProxyAutoLock lock;
- loop_for_main_thread_ =
- new MessageLoopResource(MessageLoopResource::ForMainThread());
}
PluginGlobals::PluginGlobals(PerThreadForTest per_thread_for_test)
: ppapi::PpapiGlobals(per_thread_for_test),
plugin_proxy_delegate_(NULL),
callback_tracker_(new CallbackTracker) {
+#if defined(ENABLE_PEPPER_THREADING)
+ enable_threading_ = true;
+#else
+ enable_threading_ = false;
+#endif
DCHECK(!plugin_globals_);
}
PluginGlobals::~PluginGlobals() {
DCHECK(plugin_globals_ == this || !plugin_globals_);
- {
- ProxyAutoLock lock;
- // Release the main-thread message loop. We should have the last reference
- // count, so this will delete the MessageLoop resource. We do this before
- // we clear plugin_globals_, because the Resource destructor tries to access
- // this PluginGlobals.
- DCHECK(!loop_for_main_thread_ || loop_for_main_thread_->HasOneRef());
- loop_for_main_thread_ = NULL;
- }
+ // Release the main-thread message loop. We should have the last reference
+ // count, so this will delete the MessageLoop resource. We do this before
+ // we clear plugin_globals_, because the Resource destructor tries to access
+ // this PluginGlobals.
+ DCHECK(!loop_for_main_thread_ || loop_for_main_thread_->HasOneRef());
+ loop_for_main_thread_ = NULL;
+
plugin_globals_ = NULL;
}
@@ -127,7 +131,9 @@
}
base::Lock* PluginGlobals::GetProxyLock() {
- return &proxy_lock_;
+ if (enable_threading_)
+ return &proxy_lock_;
+ return NULL;
}
void PluginGlobals::LogWithSource(PP_Instance instance,
« no previous file with comments | « trunk/src/ppapi/proxy/plugin_globals.h ('k') | trunk/src/ppapi/proxy/plugin_resource_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698