summaryrefslogtreecommitdiffstats
path: root/base/message_pump_libevent.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 23:16:26 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 23:16:26 +0000
commit5be7da24155466bf0e9bf2e5fda1a581e549df8d (patch)
treee14153b1254d3eacaaa65a9997d7edf9775d4036 /base/message_pump_libevent.cc
parent8a92555e667090d8c6592ebe670628ca33b86ef0 (diff)
downloadchromium_src-5be7da24155466bf0e9bf2e5fda1a581e549df8d.zip
chromium_src-5be7da24155466bf0e9bf2e5fda1a581e549df8d.tar.gz
chromium_src-5be7da24155466bf0e9bf2e5fda1a581e549df8d.tar.bz2
Use AutoReset (formerly ScopedBool) where possible.
This frequently saves a tiny bit of code, but even when it doesn't I think it's more future-proof (less error-prone). BUG=none TEST=none Review URL: http://codereview.chromium.org/399096 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32708 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_libevent.cc')
-rw-r--r--base/message_pump_libevent.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc
index eae77f4..4e2df5f 100644
--- a/base/message_pump_libevent.cc
+++ b/base/message_pump_libevent.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include <fcntl.h>
#include "eintr_wrapper.h"
+#include "base/auto_reset.h"
#include "base/logging.h"
#include "base/scoped_nsautorelease_pool.h"
#include "base/scoped_ptr.h"
@@ -224,9 +225,7 @@ static void timer_callback(int fd, short events, void *context)
// Reentrant!
void MessagePumpLibevent::Run(Delegate* delegate) {
DCHECK(keep_running_) << "Quit must have been called outside of Run!";
-
- bool old_in_run = in_run_;
- in_run_ = true;
+ AutoReset auto_reset_in_run(&in_run_, true);
// event_base_loopexit() + EVLOOP_ONCE is leaky, see http://crbug.com/25641.
// Instead, make our own timer and reuse it on each call to event_base_loop().
@@ -277,7 +276,6 @@ void MessagePumpLibevent::Run(Delegate* delegate) {
}
keep_running_ = true;
- in_run_ = old_in_run;
}
void MessagePumpLibevent::Quit() {