summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing
diff options
context:
space:
mode:
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