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

Side by Side Diff: base/synchronization/cancellation_flag.h

Issue 949293002: Implement a poor man's PostAfterStartupTask() function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_ 5 #ifndef BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_
6 #define BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_ 6 #define BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 11 matching lines...) Expand all
22 #if !defined(NDEBUG) 22 #if !defined(NDEBUG)
23 set_on_ = PlatformThread::CurrentId(); 23 set_on_ = PlatformThread::CurrentId();
24 #endif 24 #endif
25 } 25 }
26 ~CancellationFlag() {} 26 ~CancellationFlag() {}
27 27
28 // Set the flag. May only be called on the thread which owns the object. 28 // Set the flag. May only be called on the thread which owns the object.
29 void Set(); 29 void Set();
30 bool IsSet() const; // Returns true iff the flag was set. 30 bool IsSet() const; // Returns true iff the flag was set.
31 31
32 // Intended to help with testing.
33 void UnsafeReset();
34
32 private: 35 private:
33 base::subtle::Atomic32 flag_; 36 base::subtle::Atomic32 flag_;
34 #if !defined(NDEBUG) 37 #if !defined(NDEBUG)
35 PlatformThreadId set_on_; 38 PlatformThreadId set_on_;
36 #endif 39 #endif
37 40
38 DISALLOW_COPY_AND_ASSIGN(CancellationFlag); 41 DISALLOW_COPY_AND_ASSIGN(CancellationFlag);
39 }; 42 };
40 43
41 } // namespace base 44 } // namespace base
42 45
43 #endif // BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_ 46 #endif // BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_
OLDNEW
« no previous file with comments | « no previous file | base/synchronization/cancellation_flag.cc » ('j') | chrome/browser/after_startup_task_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698