summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing
diff options
context:
space:
mode:
authordeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-06 12:05:24 +0000
committerdeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-06 12:05:24 +0000
commitd30e8e641cf9f1bbe880328089b229a3286ee05e (patch)
tree82e63876ff1db54853946cf85852dcdd3dc759c9 /chrome/browser/printing
parentf9be5380bdd0e731b4e4127990b09781fb9a36e8 (diff)
downloadchromium_src-d30e8e641cf9f1bbe880328089b229a3286ee05e.zip
chromium_src-d30e8e641cf9f1bbe880328089b229a3286ee05e.tar.gz
chromium_src-d30e8e641cf9f1bbe880328089b229a3286ee05e.tar.bz2
Move the printing cookie from direct atomic operations to AtomicSequenceNumber.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@426 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing')
-rw-r--r--chrome/browser/printing/print_settings.cc6
-rw-r--r--chrome/browser/printing/print_settings.h9
2 files changed, 7 insertions, 8 deletions
diff --git a/chrome/browser/printing/print_settings.cc b/chrome/browser/printing/print_settings.cc
index 308e306..bdb10bf 100644
--- a/chrome/browser/printing/print_settings.cc
+++ b/chrome/browser/printing/print_settings.cc
@@ -29,13 +29,15 @@
#include "chrome/browser/printing/print_settings.h"
+#include "base/atomic_sequence_num.h"
#include "base/logging.h"
#include "chrome/browser/printing/units.h"
#include "chrome/common/render_messages.h"
namespace printing {
-int PrintSettings::s_cookie_;
+// Global SequenceNumber used for generating unique cookie values.
+static base::AtomicSequenceNumber cookie_seq;
PrintSettings::PrintSettings()
: min_shrink(1.25),
@@ -189,7 +191,7 @@ bool PrintSettings::Equals(const PrintSettings& rhs) const {
}
int PrintSettings::NewCookie() {
- return base::AtomicIncrement(&s_cookie_);
+ return cookie_seq.GetNext();
}
} // namespace printing
diff --git a/chrome/browser/printing/print_settings.h b/chrome/browser/printing/print_settings.h
index 4e9416a..7574f6e 100644
--- a/chrome/browser/printing/print_settings.h
+++ b/chrome/browser/printing/print_settings.h
@@ -106,7 +106,9 @@ class PrintSettings {
// The various overlays (headers and footers).
PageOverlays overlays;
- // Generates a new cookie to uniquely identify a PrintedDocument.
+ // Cookie generator. It is used to initialize PrintedDocument with its
+ // associated PrintSettings, to be sure that each generated PrintedPage is
+ // correctly associated with its corresponding PrintedDocument.
static int NewCookie();
private:
@@ -130,11 +132,6 @@ class PrintSettings {
// Is the orientation landscape or portrait.
bool landscape_;
-
- // Cookie generator. It is used to initialize PrintedDocument with its
- // associated PrintSettings, to be sure that each generated PrintedPage is
- // correctly associated with its corresponding PrintedDocument.
- static int s_cookie_;
};
} // namespace printing