the Chromium Embedded Framework supports a run mode where the UI thread is separate from the main application thread and is consequently hitting this DCHECK.
PK
Hi All,
Objects created using Singleton and DefaultSingletonTraits are destroyed by AtExitManager. AtExitManager is owned by ContentMainRunner and is destroyed on the main application thread. This may be a problem for Singletons that make assumptions about the destruction thread. For example, the BrowserAccessibilityStateImpl class (content/browser/accessibility/browser_accessibility_state_impl.h) is a Singleton created on the UI thread that uses base::OneShotTimer to update a histogram. The Timer::AbandonScheduledTask method (called from the OneShotTimer destructor) DCHECKs that the Timer is destroyed on the same thread that created it.
While the UI thread and the main application thread are currently the same for Chromium this may not always be a safe assumption. For example, the Chromium Embedded Framework supports a run mode where the UI thread is separate from the main application thread and is consequently hitting this DCHECK.
What kinds of assumptions should Singleton objects make about the threads used for creation and destruction?
Is there currently a way to indicate that a Singleton should be destroyed on a particular thread? If not, should we add this capability?
Thanks,
Marshall
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev