static const int kProfilerStackSize = 64 * KB;
-ProfilerEventsProcessor::ProfilerEventsProcessor(
- ProfileGenerator* generator,
- Sampler* sampler,
- base::TimeDelta period)
+ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator,
+ Sampler* sampler,
+ base::TimeDelta period)
: Thread(Thread::Options("v8:ProfEvntProc", kProfilerStackSize)),
generator_(generator),
sampler_(sampler),
- running_(true),
+ running_(1),
period_(period),
- last_code_event_id_(0), last_processed_code_event_id_(0) {
-}
+ last_code_event_id_(0),
+ last_processed_code_event_id_(0) {}
void ProfilerEventsProcessor::Enqueue(const CodeEventsContainer& event) {
void ProfilerEventsProcessor::StopSynchronously() {
- if (!running_) return;
- running_ = false;
+ if (!base::NoBarrier_AtomicExchange(&running_, 0)) return;
Join();
}
void ProfilerEventsProcessor::Run() {
- while (running_) {
+ while (!!base::NoBarrier_Load(&running_)) {
base::ElapsedTimer timer;
timer.Start();
// Keep processing existing events until we need to do next sample.
// Thread control.
virtual void Run();
void StopSynchronously();
- INLINE(bool running()) { return running_; }
+ INLINE(bool running()) { return !!base::NoBarrier_Load(&running_); }
void Enqueue(const CodeEventsContainer& event);
// Puts current stack into tick sample events buffer.
ProfileGenerator* generator_;
Sampler* sampler_;
- bool running_;
+ base::Atomic32 running_;
// Sampling period in microseconds.
const base::TimeDelta period_;
UnboundQueue<CodeEventsContainer> events_buffer_;