summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-14 01:02:37 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-14 01:02:37 +0000
commitfd220e6008ba976de0de1a5dd5c10576c2cd8450 (patch)
tree0409efe173a9bc2a1d7a361dea11d3ef57267486 /base
parentf9b6978b620a4297f0d27a6048a662213caaa412 (diff)
downloadchromium_src-fd220e6008ba976de0de1a5dd5c10576c2cd8450.zip
chromium_src-fd220e6008ba976de0de1a5dd5c10576c2cd8450.tar.gz
chromium_src-fd220e6008ba976de0de1a5dd5c10576c2cd8450.tar.bz2
More safe browsing cleanup work:
* Remove |resetting_| from the safe browsing service, it doesn't do anything useful. * Add appropriate locks in a few places in the database that were missing them. * Prevent potential infinite recursion in the database at one spot. BUG=none TEST=none Review URL: http://codereview.chromium.org/391060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31979 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/base.gyp1
-rw-r--r--base/scoped_bool.h24
2 files changed, 25 insertions, 0 deletions
diff --git a/base/base.gyp b/base/base.gyp
index b954e3b..51aa6c8 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -251,6 +251,7 @@
'resource_util.h',
'safe_strerror_posix.cc',
'safe_strerror_posix.h',
+ 'scoped_bool.h',
'scoped_bstr_win.cc',
'scoped_bstr_win.h',
'scoped_cftyperef.h',
diff --git a/base/scoped_bool.h b/base/scoped_bool.h
new file mode 100644
index 0000000..0622f967
--- /dev/null
+++ b/base/scoped_bool.h
@@ -0,0 +1,24 @@
+// 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.
+
+#ifndef BASE_SCOPED_BOOL_H_
+#define BASE_SCOPED_BOOL_H_
+
+// ScopedBool is useful for setting a flag only during a particular scope. If
+// you have code that has to add "var = false;" at all the exit points of a
+// function, for example, you would benefit from using this instead.
+
+class ScopedBool {
+ public:
+ explicit ScopedBool(bool* scoped_bool) : scoped_bool_(scoped_bool) {
+ *scoped_bool_ = true;
+ }
+ ~ScopedBool() { *scoped_bool_ = false; }
+
+ private:
+ bool* scoped_bool_;
+ DISALLOW_COPY_AND_ASSIGN(ScopedBool);
+};
+
+#endif // BASE_SCOPED_BOOL_H_