Commit 6c1d127a authored by Mostyn Bramley-Moore's avatar Mostyn Bramley-Moore Committed by Commit Bot

[jumbo] avoid g_next_id collision in cc

We can avoid the jumbo build error mentioned below, by replacing these (translation
unit) global g_next_id variables with static class variables:

./../../cc/paint/raw_memory_transfer_cache_entry.cc:13:28: error: redefinition of 'g_next_id'
base::AtomicSequenceNumber g_next_id;
                           ^
./../../cc/paint/image_transfer_cache_entry.cc:15:28: note: previous definition is here
base::AtomicSequenceNumber g_next_id;

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: I320f03d6147ca0d2e29ad75573735e9860c4ee99
Reviewed-on: https://chromium-review.googlesource.com/823032
Commit-Queue: Mostyn Bramley-Moore <mostynb@vewd.com>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523616}
parent 8c2f6b3d
...@@ -4,21 +4,17 @@ ...@@ -4,21 +4,17 @@
#include "cc/paint/image_transfer_cache_entry.h" #include "cc/paint/image_transfer_cache_entry.h"
#include "base/atomic_sequence_num.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/numerics/checked_math.h" #include "base/numerics/checked_math.h"
#include "cc/paint/paint_op_reader.h" #include "cc/paint/paint_op_reader.h"
#include "cc/paint/paint_op_writer.h" #include "cc/paint/paint_op_writer.h"
namespace cc { namespace cc {
namespace {
base::AtomicSequenceNumber g_next_id;
}
ClientImageTransferCacheEntry::ClientImageTransferCacheEntry( ClientImageTransferCacheEntry::ClientImageTransferCacheEntry(
const SkPixmap* pixmap, const SkPixmap* pixmap,
const SkColorSpace* target_color_space) const SkColorSpace* target_color_space)
: id_(g_next_id.GetNext()), pixmap_(pixmap) { : id_(s_next_id_.GetNext()), pixmap_(pixmap) {
// Compute and cache the size of the data. // Compute and cache the size of the data.
// We write the following: // We write the following:
// - Image color type (uint32_t) // - Image color type (uint32_t)
...@@ -38,6 +34,9 @@ ClientImageTransferCacheEntry::ClientImageTransferCacheEntry( ...@@ -38,6 +34,9 @@ ClientImageTransferCacheEntry::ClientImageTransferCacheEntry(
} }
ClientImageTransferCacheEntry::~ClientImageTransferCacheEntry() = default; ClientImageTransferCacheEntry::~ClientImageTransferCacheEntry() = default;
// static
base::AtomicSequenceNumber ClientImageTransferCacheEntry::s_next_id_;
size_t ClientImageTransferCacheEntry::SerializedSize() const { size_t ClientImageTransferCacheEntry::SerializedSize() const {
return size_; return size_;
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <vector> #include <vector>
#include "base/atomic_sequence_num.h"
#include "base/containers/span.h" #include "base/containers/span.h"
#include "cc/paint/transfer_cache_entry.h" #include "cc/paint/transfer_cache_entry.h"
#include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkImage.h"
...@@ -34,6 +35,7 @@ class CC_PAINT_EXPORT ClientImageTransferCacheEntry ...@@ -34,6 +35,7 @@ class CC_PAINT_EXPORT ClientImageTransferCacheEntry
uint32_t id_; uint32_t id_;
const SkPixmap* const pixmap_; const SkPixmap* const pixmap_;
size_t size_ = 0; size_t size_ = 0;
static base::AtomicSequenceNumber s_next_id_;
}; };
class CC_PAINT_EXPORT ServiceImageTransferCacheEntry class CC_PAINT_EXPORT ServiceImageTransferCacheEntry
......
...@@ -6,19 +6,17 @@ ...@@ -6,19 +6,17 @@
#include <string.h> #include <string.h>
#include "base/atomic_sequence_num.h"
namespace cc { namespace cc {
namespace {
base::AtomicSequenceNumber g_next_id;
}
ClientRawMemoryTransferCacheEntry::ClientRawMemoryTransferCacheEntry( ClientRawMemoryTransferCacheEntry::ClientRawMemoryTransferCacheEntry(
std::vector<uint8_t> data) std::vector<uint8_t> data)
: id_(g_next_id.GetNext()), data_(std::move(data)) {} : id_(s_next_id_.GetNext()), data_(std::move(data)) {}
ClientRawMemoryTransferCacheEntry::~ClientRawMemoryTransferCacheEntry() = ClientRawMemoryTransferCacheEntry::~ClientRawMemoryTransferCacheEntry() =
default; default;
// static
base::AtomicSequenceNumber ClientRawMemoryTransferCacheEntry::s_next_id_;
size_t ClientRawMemoryTransferCacheEntry::SerializedSize() const { size_t ClientRawMemoryTransferCacheEntry::SerializedSize() const {
return data_.size(); return data_.size();
} }
......
...@@ -5,9 +5,11 @@ ...@@ -5,9 +5,11 @@
#ifndef CC_PAINT_RAW_MEMORY_TRANSFER_CACHE_ENTRY_H_ #ifndef CC_PAINT_RAW_MEMORY_TRANSFER_CACHE_ENTRY_H_
#define CC_PAINT_RAW_MEMORY_TRANSFER_CACHE_ENTRY_H_ #define CC_PAINT_RAW_MEMORY_TRANSFER_CACHE_ENTRY_H_
#include "cc/paint/transfer_cache_entry.h"
#include <vector> #include <vector>
#include "cc/paint/transfer_cache_entry.h" #include "base/atomic_sequence_num.h"
namespace cc { namespace cc {
...@@ -26,6 +28,7 @@ class CC_PAINT_EXPORT ClientRawMemoryTransferCacheEntry ...@@ -26,6 +28,7 @@ class CC_PAINT_EXPORT ClientRawMemoryTransferCacheEntry
private: private:
uint32_t id_; uint32_t id_;
std::vector<uint8_t> data_; std::vector<uint8_t> data_;
static base::AtomicSequenceNumber s_next_id_;
}; };
class CC_PAINT_EXPORT ServiceRawMemoryTransferCacheEntry class CC_PAINT_EXPORT ServiceRawMemoryTransferCacheEntry
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment