Commit 5ec1b52d authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Give some ServiceWorker and TLS related symbols more unique names

In jumbo builds more code compile in the same translation unit
so it's more important to keep the names unique to avoid
compilation clashes.

Bug: 746953
Change-Id: I649731d0725a9c5b5ab0ec72775cc81ea54434a9
Reviewed-on: https://chromium-review.googlesource.com/819556Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarTsuyoshi Horo <horo@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#523737}
parent 1b896bfb
......@@ -42,7 +42,7 @@ static base::LazyInstance<base::ThreadLocalPointer<CacheStorageDispatcher>>::
namespace {
CacheStorageDispatcher* const kHasBeenDeleted =
CacheStorageDispatcher* const kDeletedCacheStorageDispatcherMarker =
reinterpret_cast<CacheStorageDispatcher*>(0x1);
ServiceWorkerFetchRequest FetchRequestFromWebRequest(
......@@ -200,12 +200,14 @@ CacheStorageDispatcher::~CacheStorageDispatcher() {
ClearCallbacksMapWithErrors(&cache_keys_callbacks_);
ClearCallbacksMapWithErrors(&cache_batch_callbacks_);
g_cache_storage_dispatcher_tls.Pointer()->Set(kHasBeenDeleted);
g_cache_storage_dispatcher_tls.Pointer()->Set(
kDeletedCacheStorageDispatcherMarker);
}
CacheStorageDispatcher* CacheStorageDispatcher::ThreadSpecificInstance(
ThreadSafeSender* thread_safe_sender) {
if (g_cache_storage_dispatcher_tls.Pointer()->Get() == kHasBeenDeleted) {
if (g_cache_storage_dispatcher_tls.Pointer()->Get() ==
kDeletedCacheStorageDispatcherMarker) {
NOTREACHED() << "Re-instantiating TLS CacheStorageDispatcher.";
g_cache_storage_dispatcher_tls.Pointer()->Set(nullptr);
}
......
......@@ -25,7 +25,7 @@ static base::LazyInstance<ThreadLocalPointer<IndexedDBDispatcher>>::Leaky
namespace {
IndexedDBDispatcher* const kHasBeenDeleted =
IndexedDBDispatcher* const kDeletedIndexedDBDispatcherMarker =
reinterpret_cast<IndexedDBDispatcher*>(0x1);
} // unnamed namespace
......@@ -39,11 +39,12 @@ IndexedDBDispatcher::~IndexedDBDispatcher() {
mojo_owned_callback_state_.clear();
mojo_owned_database_callback_state_.clear();
g_idb_dispatcher_tls.Pointer()->Set(kHasBeenDeleted);
g_idb_dispatcher_tls.Pointer()->Set(kDeletedIndexedDBDispatcherMarker);
}
IndexedDBDispatcher* IndexedDBDispatcher::ThreadSpecificInstance() {
if (g_idb_dispatcher_tls.Pointer()->Get() == kHasBeenDeleted) {
if (g_idb_dispatcher_tls.Pointer()->Get() ==
kDeletedIndexedDBDispatcherMarker) {
NOTREACHED() << "Re-instantiating TLS IndexedDBDispatcher.";
g_idb_dispatcher_tls.Pointer()->Set(nullptr);
}
......
......@@ -38,7 +38,8 @@ namespace {
base::LazyInstance<ThreadLocalPointer<void>>::Leaky g_dispatcher_tls =
LAZY_INSTANCE_INITIALIZER;
void* const kHasBeenDeleted = reinterpret_cast<void*>(0x1);
void* const kDeletedServiceWorkerDispatcherMarker =
reinterpret_cast<void*>(0x1);
} // namespace
......@@ -55,7 +56,7 @@ ServiceWorkerDispatcher::~ServiceWorkerDispatcher() {
g_dispatcher_tls.Pointer()->Set(nullptr);
return;
}
g_dispatcher_tls.Pointer()->Set(kHasBeenDeleted);
g_dispatcher_tls.Pointer()->Set(kDeletedServiceWorkerDispatcherMarker);
}
void ServiceWorkerDispatcher::OnMessageReceived(const IPC::Message& msg) {
......@@ -76,7 +77,8 @@ ServiceWorkerDispatcher*
ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance(
scoped_refptr<ThreadSafeSender> thread_safe_sender,
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) {
if (g_dispatcher_tls.Pointer()->Get() == kHasBeenDeleted) {
if (g_dispatcher_tls.Pointer()->Get() ==
kDeletedServiceWorkerDispatcherMarker) {
NOTREACHED() << "Re-instantiating TLS ServiceWorkerDispatcher.";
g_dispatcher_tls.Pointer()->Set(nullptr);
}
......@@ -92,7 +94,8 @@ ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance(
}
ServiceWorkerDispatcher* ServiceWorkerDispatcher::GetThreadSpecificInstance() {
if (g_dispatcher_tls.Pointer()->Get() == kHasBeenDeleted)
if (g_dispatcher_tls.Pointer()->Get() ==
kDeletedServiceWorkerDispatcherMarker)
return nullptr;
return static_cast<ServiceWorkerDispatcher*>(
g_dispatcher_tls.Pointer()->Get());
......
......@@ -26,18 +26,19 @@ namespace content {
namespace {
class HandleImpl : public blink::WebServiceWorker::Handle {
class ServiceWorkerHandleImpl : public blink::WebServiceWorker::Handle {
public:
explicit HandleImpl(const scoped_refptr<WebServiceWorkerImpl>& worker)
explicit ServiceWorkerHandleImpl(
const scoped_refptr<WebServiceWorkerImpl>& worker)
: worker_(worker) {}
~HandleImpl() override {}
~ServiceWorkerHandleImpl() override {}
blink::WebServiceWorker* ServiceWorker() override { return worker_.get(); }
private:
scoped_refptr<WebServiceWorkerImpl> worker_;
DISALLOW_COPY_AND_ASSIGN(HandleImpl);
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandleImpl);
};
} // namespace
......@@ -105,7 +106,7 @@ WebServiceWorkerImpl::CreateHandle(
const scoped_refptr<WebServiceWorkerImpl>& worker) {
if (!worker)
return nullptr;
return std::make_unique<HandleImpl>(worker);
return std::make_unique<ServiceWorkerHandleImpl>(worker);
}
WebServiceWorkerImpl::~WebServiceWorkerImpl() {
......
......@@ -24,12 +24,13 @@ namespace content {
namespace {
class HandleImpl : public blink::WebServiceWorkerRegistration::Handle {
class ServiceWorkerRegistrationHandleImpl
: public blink::WebServiceWorkerRegistration::Handle {
public:
explicit HandleImpl(
explicit ServiceWorkerRegistrationHandleImpl(
scoped_refptr<WebServiceWorkerRegistrationImpl> registration)
: registration_(std::move(registration)) {}
~HandleImpl() override {}
~ServiceWorkerRegistrationHandleImpl() override {}
blink::WebServiceWorkerRegistration* Registration() override {
return registration_.get();
......@@ -38,7 +39,7 @@ class HandleImpl : public blink::WebServiceWorkerRegistration::Handle {
private:
scoped_refptr<WebServiceWorkerRegistrationImpl> registration_;
DISALLOW_COPY_AND_ASSIGN(HandleImpl);
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationHandleImpl);
};
} // namespace
......@@ -380,7 +381,8 @@ WebServiceWorkerRegistrationImpl::CreateHandle(
scoped_refptr<WebServiceWorkerRegistrationImpl> registration) {
if (!registration)
return nullptr;
return std::make_unique<HandleImpl>(std::move(registration));
return std::make_unique<ServiceWorkerRegistrationHandleImpl>(
std::move(registration));
}
// static
......
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