Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tommy Webb
Tor Browser
Commits
ec87e5bf
Commit
ec87e5bf
authored
12 years ago
by
Justin Lebar
Browse files
Options
Downloads
Patches
Plain Diff
Bug 743786 - Add IsMainThread assertions to ClearOnShutdown. r=bmsedberg
parent
c5b2e91d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xpcom/base/ClearOnShutdown.h
+9
-0
9 additions, 0 deletions
xpcom/base/ClearOnShutdown.h
with
9 additions
and
0 deletions
xpcom/base/ClearOnShutdown.h
+
9
−
0
View file @
ec87e5bf
...
...
@@ -41,6 +41,7 @@
#define mozilla_ClearOnShutdown_h
#include
"mozilla/LinkedList.h"
#include
"nsThreadUtils.h"
/*
* This header exports one public method in the mozilla namespace:
...
...
@@ -56,6 +57,10 @@
*
* There is no way to undo a call to ClearOnShutdown, so you can call it only
* on smart pointers which you know will live until the program shuts down.
*
* ClearOnShutdown is currently main-thread only because we don't want to
* accidentally free an object from a different thread than the one it was
* created on.
*/
namespace
mozilla
{
...
...
@@ -96,6 +101,8 @@ inline void ClearOnShutdown(SmartPtr *aPtr)
{
using
namespace
ClearOnShutdown_Internal
;
MOZ_ASSERT
(
NS_IsMainThread
());
MOZ_ASSERT
(
!
sHasShutDown
);
ShutdownObserver
*
observer
=
new
PointerClearer
<
SmartPtr
>
(
aPtr
);
sShutdownObservers
.
insertBack
(
observer
);
...
...
@@ -107,6 +114,8 @@ inline void KillClearOnShutdown()
{
using
namespace
ClearOnShutdown_Internal
;
MOZ_ASSERT
(
NS_IsMainThread
());
ShutdownObserver
*
observer
;
while
((
observer
=
sShutdownObservers
.
popFirst
()))
{
observer
->
Shutdown
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment