Commit c8b522a4 authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

[jumbo] Give two kSeparator globals unique names

In some non-default, extreme, jumbo builds, the kSeparator in
content_index and the kSeparator in push_messaging ended up in
the same translation unit which then prevented compilation.

To avoid that, this patch renames them kSWRIdDescriptionSeparator
and kOriginSWRIdSeparator.

Bug: 973844
Change-Id: I6d29c3b1f1826613e30577870ed02612e30a368c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1698521
Commit-Queue: Peter Beverloo <peter@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Reviewed-by: default avatarRichard Knoll <knollr@chromium.org>
Auto-Submit: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#676899}
parent ab83ee3c
......@@ -30,12 +30,12 @@ struct ContentIndexProviderImpl::EntryData {
namespace {
constexpr char kProviderNamespace[] = "content_index";
constexpr char kSeparator[] = "-";
constexpr char kSWRIdDescriptionSeparator[] = "-";
std::string EntryKey(int64_t service_worker_registration_id,
const std::string& description_id) {
return base::NumberToString(service_worker_registration_id) + kSeparator +
description_id;
return base::NumberToString(service_worker_registration_id) +
kSWRIdDescriptionSeparator + description_id;
}
std::string EntryKey(const content::ContentIndexEntry& entry) {
......@@ -43,7 +43,7 @@ std::string EntryKey(const content::ContentIndexEntry& entry) {
}
std::pair<int64_t, std::string> GetEntryKeyComponents(const std::string& key) {
size_t pos = key.find_first_of(kSeparator);
size_t pos = key.find_first_of(kSWRIdDescriptionSeparator);
DCHECK_NE(pos, std::string::npos);
int64_t service_worker_registration_id = -1;
......
......@@ -27,12 +27,13 @@ namespace {
const size_t kPrefixLength = sizeof(kPushMessagingAppIdentifierPrefix) - 1;
const size_t kGuidSuffixLength = sizeof(kInstanceIDGuidSuffix) - 1;
const char kSeparator = '#'; // Ok as only the origin of the url is used.
// Ok to use '#' as separator since only the origin of the url is used.
const char kOriginSWRIdSeparator = '#';
const size_t kGuidLength = 36; // "%08X-%04X-%04X-%04X-%012llX"
std::string MakePrefValue(const GURL& origin,
int64_t service_worker_registration_id) {
return origin.spec() + kSeparator +
return origin.spec() + kOriginSWRIdSeparator +
base::NumberToString(service_worker_registration_id);
}
......@@ -40,7 +41,7 @@ bool GetOriginAndSWRFromPrefValue(const std::string& pref_value,
GURL* origin,
int64_t* service_worker_registration_id) {
std::vector<std::string> parts =
base::SplitString(pref_value, std::string(1, kSeparator),
base::SplitString(pref_value, std::string(1, kOriginSWRIdSeparator),
base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (parts.size() != 2)
return false;
......@@ -100,8 +101,8 @@ PushMessagingAppIdentifier PushMessagingAppIdentifier::GenerateInternal(
kInstanceIDGuidSuffix);
}
CHECK(!guid.empty());
std::string app_id =
kPushMessagingAppIdentifierPrefix + origin.spec() + kSeparator + guid;
std::string app_id = kPushMessagingAppIdentifierPrefix + origin.spec() +
kOriginSWRIdSeparator + guid;
PushMessagingAppIdentifier app_identifier(app_id, origin,
service_worker_registration_id);
......@@ -246,12 +247,12 @@ void PushMessagingAppIdentifier::DCheckValid() const {
// Optional (origin.spec() + '#')
if (app_id_.size() != kPrefixLength + kGuidLength) {
const size_t suffix_length = 1 /* kSeparator */ + kGuidLength;
const size_t suffix_length = 1 /* kOriginSWRIdSeparator */ + kGuidLength;
DCHECK_GT(app_id_.size(), kPrefixLength + suffix_length);
DCHECK_EQ(origin_, GURL(app_id_.substr(
kPrefixLength,
app_id_.size() - kPrefixLength - suffix_length)));
DCHECK_EQ(std::string(1, kSeparator),
DCHECK_EQ(std::string(1, kOriginSWRIdSeparator),
app_id_.substr(app_id_.size() - suffix_length, 1));
}
......
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