Replace AllowCrossThreadAccess() + non-GCed pointers with crossThreadUnretained())

This CL adds CrossThreadCopier for crossThreadUnretained() in CrossThreadCopier.h.
Other changes are made by:
  sed -i 's/AllowCrossThreadAccess/crossThreadUnretained/g'

BUG=597856
CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/1925583003
Cr-Commit-Position: refs/heads/master@{#401578}
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
index d286f91..3850969 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
@@ -232,7 +232,7 @@
 
         // Inform main thread to re-queue the data.
         m_loadingTaskRunner->postTask(
-            BLINK_FROM_HERE, threadSafeBind(&SourceStream::fetchDataFromResourceBuffer, AllowCrossThreadAccess(this), 0));
+            BLINK_FROM_HERE, threadSafeBind(&SourceStream::fetchDataFromResourceBuffer, crossThreadUnretained(this), 0));
     }
 
     void didFinishLoading()
diff --git a/third_party/WebKit/Source/core/dom/CrossThreadTask.h b/third_party/WebKit/Source/core/dom/CrossThreadTask.h
index 1e37ae5b..2b23153 100644
--- a/third_party/WebKit/Source/core/dom/CrossThreadTask.h
+++ b/third_party/WebKit/Source/core/dom/CrossThreadTask.h
@@ -80,7 +80,7 @@
 //     CrossThreadCopier.
 //     You don't have to call manually e.g. isolatedCopy().
 //     To pass things that cannot be copied by CrossThreadCopier
-//     (e.g. pointers), use AllowCrossThreadAccess() explicitly.
+//     (e.g. pointers), use crossThreadUnretained() explicitly.
 
 // RETTYPE, PS, and MPS are added as template parameters to circumvent MSVC 18.00.21005.1 (VS 2013) issues.
 
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp
index 8740657..de82e29 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp
@@ -67,7 +67,7 @@
     // currentThread will always be non-null in production, but can be null in Chromium unit tests.
     if (Platform::current()->currentThread() && s_sharedThread->m_thread) {
         WaitableEvent waitableEvent;
-        s_sharedThread->postTask(threadSafeBind(&HTMLParserThread::cleanupHTMLParserThread, AllowCrossThreadAccess(s_sharedThread), AllowCrossThreadAccess(&waitableEvent)));
+        s_sharedThread->postTask(threadSafeBind(&HTMLParserThread::cleanupHTMLParserThread, crossThreadUnretained(s_sharedThread), crossThreadUnretained(&waitableEvent)));
         SafePointScope scope(BlinkGC::HeapPointersOnStack);
         waitableEvent.wait();
     }
@@ -91,7 +91,7 @@
     ASSERT(isMainThread());
     if (!m_thread) {
         m_thread = WebThreadSupportingGC::create("HTMLParserThread");
-        postTask(threadSafeBind(&HTMLParserThread::setupHTMLParserThread, AllowCrossThreadAccess(this)));
+        postTask(threadSafeBind(&HTMLParserThread::setupHTMLParserThread, crossThreadUnretained(this)));
     }
 
     m_thread->postTask(BLINK_FROM_HERE, std::move(closure));
diff --git a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
index af9291e..2af3f36 100644
--- a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
+++ b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
@@ -221,7 +221,7 @@
     if (arrayBuffer->byteLength() >= longTaskByteLengthThreshold)
         taskSize = BackgroundTaskRunner::TaskSizeLongRunningTask;
     WebTaskRunner* taskRunner = Platform::current()->currentThread()->getWebTaskRunner();
-    BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread, wrapCrossThreadPersistent(this), AllowCrossThreadAccess(taskRunner), wrapCrossThreadPersistent(arrayBuffer)), taskSize);
+    BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread, wrapCrossThreadPersistent(this), crossThreadUnretained(taskRunner), wrapCrossThreadPersistent(arrayBuffer)), taskSize);
 }
 
 void ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread(WebTaskRunner* taskRunner, DOMArrayBuffer* arrayBuffer)
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp b/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
index 39e72b0..1ee913c9 100644
--- a/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
+++ b/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
@@ -163,9 +163,9 @@
         std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent());
         postTaskToWorkerGlobalScope(createCrossThreadTask(
             &WorkerThreadableLoaderTestHelper::workerCreateLoader,
-            AllowCrossThreadAccess(this),
-            AllowCrossThreadAccess(client),
-            AllowCrossThreadAccess(completionEvent.get()),
+            crossThreadUnretained(this),
+            crossThreadUnretained(client),
+            crossThreadUnretained(completionEvent.get()),
             crossOriginRequestPolicy));
         completionEvent->wait();
     }
@@ -175,8 +175,8 @@
         std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent());
         postTaskToWorkerGlobalScope(createCrossThreadTask(
             &WorkerThreadableLoaderTestHelper::workerStartLoader,
-            AllowCrossThreadAccess(this),
-            AllowCrossThreadAccess(completionEvent.get()),
+            crossThreadUnretained(this),
+            crossThreadUnretained(completionEvent.get()),
             request));
         completionEvent->wait();
     }
@@ -209,8 +209,8 @@
         std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent());
         postTaskToWorkerGlobalScope(createCrossThreadTask(
             &WorkerThreadableLoaderTestHelper::workerCallCheckpoint,
-            AllowCrossThreadAccess(this),
-            AllowCrossThreadAccess(completionEvent.get()),
+            crossThreadUnretained(this),
+            crossThreadUnretained(completionEvent.get()),
             n));
         completionEvent->wait();
     }
@@ -235,7 +235,7 @@
 
     void onTearDown() override
     {
-        postTaskToWorkerGlobalScope(createCrossThreadTask(&WorkerThreadableLoaderTestHelper::clearLoader, AllowCrossThreadAccess(this)));
+        postTaskToWorkerGlobalScope(createCrossThreadTask(&WorkerThreadableLoaderTestHelper::clearLoader, crossThreadUnretained(this)));
         m_workerThread->terminateAndWait();
 
         // Needed to clean up the things on the main thread side and
diff --git a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp
index e90b4c5..3186f3d 100644
--- a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp
@@ -143,12 +143,12 @@
 
 void WorkerThreadableLoader::MainThreadBridgeBase::createLoaderInMainThread(const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions)
 {
-    m_loaderProxy->postTaskToLoader(createCrossThreadTask(&MainThreadBridgeBase::mainThreadCreateLoader, AllowCrossThreadAccess(this), options, resourceLoaderOptions));
+    m_loaderProxy->postTaskToLoader(createCrossThreadTask(&MainThreadBridgeBase::mainThreadCreateLoader, crossThreadUnretained(this), options, resourceLoaderOptions));
 }
 
 void WorkerThreadableLoader::MainThreadBridgeBase::startInMainThread(const ResourceRequest& request, const WorkerGlobalScope& workerGlobalScope)
 {
-    loaderProxy()->postTaskToLoader(createCrossThreadTask(&MainThreadBridgeBase::mainThreadStart, AllowCrossThreadAccess(this), request));
+    loaderProxy()->postTaskToLoader(createCrossThreadTask(&MainThreadBridgeBase::mainThreadStart, crossThreadUnretained(this), request));
 }
 
 void WorkerThreadableLoader::MainThreadBridgeBase::mainThreadDestroy(ExecutionContext* context)
@@ -164,7 +164,7 @@
     m_workerClientWrapper->clearClient();
 
     // "delete this" and m_mainThreadLoader::deref() on the worker object's thread.
-    m_loaderProxy->postTaskToLoader(createCrossThreadTask(&MainThreadBridgeBase::mainThreadDestroy, AllowCrossThreadAccess(this)));
+    m_loaderProxy->postTaskToLoader(createCrossThreadTask(&MainThreadBridgeBase::mainThreadDestroy, crossThreadUnretained(this)));
 }
 
 void WorkerThreadableLoader::MainThreadBridgeBase::mainThreadOverrideTimeout(unsigned long timeoutMilliseconds, ExecutionContext* context)
@@ -179,7 +179,7 @@
 
 void WorkerThreadableLoader::MainThreadBridgeBase::overrideTimeout(unsigned long timeoutMilliseconds)
 {
-    m_loaderProxy->postTaskToLoader(createCrossThreadTask(&MainThreadBridgeBase::mainThreadOverrideTimeout, AllowCrossThreadAccess(this), timeoutMilliseconds));
+    m_loaderProxy->postTaskToLoader(createCrossThreadTask(&MainThreadBridgeBase::mainThreadOverrideTimeout, crossThreadUnretained(this), timeoutMilliseconds));
 }
 
 void WorkerThreadableLoader::MainThreadBridgeBase::mainThreadCancel(ExecutionContext* context)
@@ -195,7 +195,7 @@
 
 void WorkerThreadableLoader::MainThreadBridgeBase::cancel()
 {
-    m_loaderProxy->postTaskToLoader(createCrossThreadTask(&MainThreadBridgeBase::mainThreadCancel, AllowCrossThreadAccess(this)));
+    m_loaderProxy->postTaskToLoader(createCrossThreadTask(&MainThreadBridgeBase::mainThreadCancel, crossThreadUnretained(this)));
     RefPtr<ThreadableLoaderClientWrapper> clientWrapper = m_workerClientWrapper;
     if (!clientWrapper->done()) {
         // If the client hasn't reached a termination state, then transition it by sending a cancellation error.
diff --git a/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp b/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp
index e6658bd..628b377 100644
--- a/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp
+++ b/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp
@@ -136,7 +136,7 @@
 
     for (const auto& entry : m_observers) {
         ExecutionContext* context = entry.key;
-        context->postTask(BLINK_FROM_HERE, createCrossThreadTask(&NetworkStateNotifier::notifyObserversOfConnectionChangeOnContext, AllowCrossThreadAccess(this), type, maxBandwidthMbps));
+        context->postTask(BLINK_FROM_HERE, createCrossThreadTask(&NetworkStateNotifier::notifyObserversOfConnectionChangeOnContext, crossThreadUnretained(this), type, maxBandwidthMbps));
     }
 }
 
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp
index efc696f2..666dd48 100644
--- a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp
+++ b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp
@@ -144,7 +144,7 @@
     if (m_askedToTerminate)
         return;
 
-    std::unique_ptr<ExecutionContextTask> task = createCrossThreadTask(&processMessageOnWorkerGlobalScope, message, passed(std::move(channels)), AllowCrossThreadAccess(&workerObjectProxy()));
+    std::unique_ptr<ExecutionContextTask> task = createCrossThreadTask(&processMessageOnWorkerGlobalScope, message, passed(std::move(channels)), crossThreadUnretained(&workerObjectProxy()));
     if (m_workerThread) {
         ++m_unconfirmedMessageCount;
         m_workerThread->postTask(BLINK_FROM_HERE, std::move(task));
@@ -221,7 +221,7 @@
     // cleared before this method gets called.
     DCHECK(!m_workerObject);
 
-    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::workerObjectDestroyedInternal, AllowCrossThreadAccess(this)));
+    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::workerObjectDestroyedInternal, crossThreadUnretained(this)));
 }
 
 void InProcessWorkerMessagingProxy::workerObjectDestroyedInternal()
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
index d183e1e..b68dc72 100644
--- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
+++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
@@ -50,7 +50,7 @@
 
 void InProcessWorkerObjectProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels)
 {
-    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::postMessageToWorkerObject, AllowCrossThreadAccess(m_messagingProxy), message, passed(std::move(channels))));
+    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::postMessageToWorkerObject, crossThreadUnretained(m_messagingProxy), message, passed(std::move(channels))));
 }
 
 void InProcessWorkerObjectProxy::postTaskToMainExecutionContext(std::unique_ptr<ExecutionContextTask> task)
@@ -60,47 +60,47 @@
 
 void InProcessWorkerObjectProxy::confirmMessageFromWorkerObject(bool hasPendingActivity)
 {
-    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::confirmMessageFromWorkerObject, AllowCrossThreadAccess(m_messagingProxy), hasPendingActivity));
+    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::confirmMessageFromWorkerObject, crossThreadUnretained(m_messagingProxy), hasPendingActivity));
 }
 
 void InProcessWorkerObjectProxy::reportPendingActivity(bool hasPendingActivity)
 {
-    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportPendingActivity, AllowCrossThreadAccess(m_messagingProxy), hasPendingActivity));
+    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportPendingActivity, crossThreadUnretained(m_messagingProxy), hasPendingActivity));
 }
 
 void InProcessWorkerObjectProxy::reportException(const String& errorMessage, std::unique_ptr<SourceLocation> location)
 {
-    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportException, AllowCrossThreadAccess(m_messagingProxy), errorMessage, passed(std::move(location))));
+    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportException, crossThreadUnretained(m_messagingProxy), errorMessage, passed(std::move(location))));
 }
 
 void InProcessWorkerObjectProxy::reportConsoleMessage(ConsoleMessage* consoleMessage)
 {
-    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportConsoleMessage, AllowCrossThreadAccess(m_messagingProxy), consoleMessage->source(), consoleMessage->level(), consoleMessage->message(), passed(consoleMessage->location()->clone())));
+    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportConsoleMessage, crossThreadUnretained(m_messagingProxy), consoleMessage->source(), consoleMessage->level(), consoleMessage->message(), passed(consoleMessage->location()->clone())));
 }
 
 void InProcessWorkerObjectProxy::postMessageToPageInspector(const String& message)
 {
     ExecutionContext* context = getExecutionContext();
     if (context->isDocument())
-        toDocument(context)->postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::postMessageToPageInspector, AllowCrossThreadAccess(m_messagingProxy), message));
+        toDocument(context)->postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::postMessageToPageInspector, crossThreadUnretained(m_messagingProxy), message));
 }
 
 void InProcessWorkerObjectProxy::postWorkerConsoleAgentEnabled()
 {
     ExecutionContext* context = getExecutionContext();
     if (context->isDocument())
-        toDocument(context)->postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::postWorkerConsoleAgentEnabled, AllowCrossThreadAccess(m_messagingProxy)));
+        toDocument(context)->postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::postWorkerConsoleAgentEnabled, crossThreadUnretained(m_messagingProxy)));
 }
 
 void InProcessWorkerObjectProxy::workerGlobalScopeClosed()
 {
-    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::terminateWorkerGlobalScope, AllowCrossThreadAccess(m_messagingProxy)));
+    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::terminateWorkerGlobalScope, crossThreadUnretained(m_messagingProxy)));
 }
 
 void InProcessWorkerObjectProxy::workerThreadTerminated()
 {
     // This will terminate the MessagingProxy.
-    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::workerThreadTerminated, AllowCrossThreadAccess(m_messagingProxy)));
+    getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::workerThreadTerminated, crossThreadUnretained(m_messagingProxy)));
 }
 
 InProcessWorkerObjectProxy::InProcessWorkerObjectProxy(InProcessWorkerMessagingProxy* messagingProxy)
diff --git a/third_party/WebKit/Source/core/workers/WorkerInspectorProxy.cpp b/third_party/WebKit/Source/core/workers/WorkerInspectorProxy.cpp
index c640a4a..cdaf0521 100644
--- a/third_party/WebKit/Source/core/workers/WorkerInspectorProxy.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerInspectorProxy.cpp
@@ -138,7 +138,7 @@
         return;
     DCHECK(!m_pageInspector);
     m_pageInspector = pageInspector;
-    m_workerThread->appendDebuggerTask(threadSafeBind(connectToWorkerGlobalScopeInspectorTask, AllowCrossThreadAccess(m_workerThread)));
+    m_workerThread->appendDebuggerTask(threadSafeBind(connectToWorkerGlobalScopeInspectorTask, crossThreadUnretained(m_workerThread)));
 }
 
 static void disconnectFromWorkerGlobalScopeInspectorTask(WorkerThread* workerThread)
@@ -152,7 +152,7 @@
     DCHECK(m_pageInspector == pageInspector);
     m_pageInspector = nullptr;
     if (m_workerThread)
-        m_workerThread->appendDebuggerTask(threadSafeBind(disconnectFromWorkerGlobalScopeInspectorTask, AllowCrossThreadAccess(m_workerThread)));
+        m_workerThread->appendDebuggerTask(threadSafeBind(disconnectFromWorkerGlobalScopeInspectorTask, crossThreadUnretained(m_workerThread)));
 }
 
 static void dispatchOnInspectorBackendTask(const String& message, WorkerThread* workerThread)
@@ -164,7 +164,7 @@
 void WorkerInspectorProxy::sendMessageToInspector(const String& message)
 {
     if (m_workerThread)
-        m_workerThread->appendDebuggerTask(threadSafeBind(dispatchOnInspectorBackendTask, message, AllowCrossThreadAccess(m_workerThread)));
+        m_workerThread->appendDebuggerTask(threadSafeBind(dispatchOnInspectorBackendTask, message, crossThreadUnretained(m_workerThread)));
 }
 
 void WorkerInspectorProxy::writeTimelineStartedEvent(const String& sessionId)
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
index 07896af..f334b93 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -194,7 +194,7 @@
         return;
 
     m_started = true;
-    workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::initializeOnWorkerThread, AllowCrossThreadAccess(this), passed(std::move(startupData))));
+    workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::initializeOnWorkerThread, crossThreadUnretained(this), passed(std::move(startupData))));
 }
 
 void WorkerThread::terminate()
@@ -253,7 +253,7 @@
         DCHECK(isCurrentThread());
         InspectorInstrumentation::asyncTaskScheduled(workerGlobalScope(), "Worker task", task.get());
     }
-    workerBackingThread().backingThread().postTask(location, threadSafeBind(&WorkerThread::performTaskOnWorkerThread, AllowCrossThreadAccess(this), passed(std::move(task)), isInstrumented));
+    workerBackingThread().backingThread().postTask(location, threadSafeBind(&WorkerThread::performTaskOnWorkerThread, crossThreadUnretained(this), passed(std::move(task)), isInstrumented));
 }
 
 void WorkerThread::appendDebuggerTask(std::unique_ptr<CrossThreadClosure> task)
@@ -264,13 +264,13 @@
         if (m_terminated)
             return;
     }
-    m_inspectorTaskRunner->appendTask(threadSafeBind(&WorkerThread::performDebuggerTaskOnWorkerThread, AllowCrossThreadAccess(this), passed(std::move(task))));
+    m_inspectorTaskRunner->appendTask(threadSafeBind(&WorkerThread::performDebuggerTaskOnWorkerThread, crossThreadUnretained(this), passed(std::move(task))));
     {
         MutexLocker lock(m_threadStateMutex);
         if (isolate() && !m_readyToShutdown)
             m_inspectorTaskRunner->interruptAndRunAllTasksDontWait(isolate());
     }
-    workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::performDebuggerTaskDontWaitOnWorkerThread, AllowCrossThreadAccess(this)));
+    workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::performDebuggerTaskDontWaitOnWorkerThread, crossThreadUnretained(this)));
 }
 
 void WorkerThread::startRunningDebuggerTasksOnPauseOnWorkerThread()
@@ -419,8 +419,8 @@
     }
 
     m_inspectorTaskRunner->kill();
-    workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::prepareForShutdownOnWorkerThread, AllowCrossThreadAccess(this)));
-    workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::performShutdownOnWorkerThread, AllowCrossThreadAccess(this)));
+    workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::prepareForShutdownOnWorkerThread, crossThreadUnretained(this)));
+    workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::performShutdownOnWorkerThread, crossThreadUnretained(this)));
 }
 
 void WorkerThread::forciblyTerminateExecution()
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
index 1d65034..1516192 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
@@ -189,7 +189,7 @@
             V8CacheOptionsDefault);
     m_workerThread->start(std::move(startupData));
 
-    m_workerThread->appendDebuggerTask(threadSafeBind(&waitForTermination, AllowCrossThreadAccess(m_workerThread.get())));
+    m_workerThread->appendDebuggerTask(threadSafeBind(&waitForTermination, crossThreadUnretained(m_workerThread.get())));
 
     // Wait for the debugger task.
     testing::enterRunLoop();
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h b/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h
index bd35df2..1d20c73 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h
+++ b/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h
@@ -131,7 +131,7 @@
     void waitForInit()
     {
         std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent());
-        workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WaitableEvent::signal, AllowCrossThreadAccess(completionEvent.get())));
+        workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WaitableEvent::signal, crossThreadUnretained(completionEvent.get())));
         completionEvent->wait();
     }
 
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp
index 4573680..417ea6e 100644
--- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp
+++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp
@@ -66,7 +66,7 @@
         : m_thread(useBackingThread ? std::move(useBackingThread) : WorkerBackingThread::create(Platform::current()->compositorThread()))
     {
         DCHECK(isMainThread());
-        m_thread->backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&BackingThreadHolder::initializeOnThread, AllowCrossThreadAccess(this)));
+        m_thread->backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&BackingThreadHolder::initializeOnThread, crossThreadUnretained(this)));
     }
 
     static Mutex& holderInstanceMutex()
@@ -87,7 +87,7 @@
     {
         DCHECK(isMainThread());
         WaitableEvent doneEvent;
-        m_thread->backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&BackingThreadHolder::shutdownOnThread, AllowCrossThreadAccess(this), AllowCrossThreadAccess(&doneEvent)));
+        m_thread->backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&BackingThreadHolder::shutdownOnThread, crossThreadUnretained(this), crossThreadUnretained(&doneEvent)));
         doneEvent.wait();
     }
 
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
index adb2ac49..94cceed 100644
--- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
+++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
@@ -135,8 +135,8 @@
     void checkWorkerCanExecuteScript(WorkerThread* worker)
     {
         std::unique_ptr<WaitableEvent> waitEvent = wrapUnique(new WaitableEvent());
-        worker->workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&CompositorWorkerThreadTest::executeScriptInWorker, AllowCrossThreadAccess(this),
-            AllowCrossThreadAccess(worker), AllowCrossThreadAccess(waitEvent.get())));
+        worker->workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&CompositorWorkerThreadTest::executeScriptInWorker, crossThreadUnretained(this),
+            crossThreadUnretained(worker), crossThreadUnretained(waitEvent.get())));
         waitEvent->wait();
     }
 
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp
index 7b28ea9..aec0a1e 100644
--- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp
+++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp
@@ -15,13 +15,13 @@
     , m_initializationPolicy(initializationPolicy)
     , m_waitableEvent(wrapUnique(new WaitableEvent()))
 {
-    m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&Thread::initialize, AllowCrossThreadAccess(this)));
+    m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&Thread::initialize, crossThreadUnretained(this)));
     m_waitableEvent->wait();
 }
 
 DataConsumerHandleTestUtil::Thread::~Thread()
 {
-    m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&Thread::shutdown, AllowCrossThreadAccess(this)));
+    m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&Thread::shutdown, crossThreadUnretained(this)));
     m_waitableEvent->wait();
 }
 
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h
index 39a11471..9b60dff 100644
--- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h
+++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h
@@ -499,7 +499,7 @@
             , m_event(wrapUnique(new WaitableEvent()))
             , m_isDone(false)
         {
-            m_thread->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(&HandleReaderRunner::start, AllowCrossThreadAccess(this), passed(std::move(handle))));
+            m_thread->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(&HandleReaderRunner::start, crossThreadUnretained(this), passed(std::move(handle))));
         }
         ~HandleReaderRunner()
         {
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp
index dfa3d1c..b4ad821 100644
--- a/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp
@@ -59,7 +59,7 @@
     {
         m_thread = wrapUnique(new Thread("src thread", Thread::WithExecutionContext));
         m_waitableEvent = wrapUnique(new WaitableEvent());
-        m_thread->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(&TeeCreationThread<Handle>::runInternal, AllowCrossThreadAccess(this), passed(std::move(src)), AllowCrossThreadAccess(dest1), AllowCrossThreadAccess(dest2)));
+        m_thread->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(&TeeCreationThread<Handle>::runInternal, crossThreadUnretained(this), passed(std::move(src)), crossThreadUnretained(dest1), crossThreadUnretained(dest2)));
         m_waitableEvent->wait();
     }
 
@@ -214,7 +214,7 @@
 
     // We can pass a raw pointer because the subsequent |wait| calls ensure
     // t->thread() is alive.
-    t->getThread()->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(postStop, AllowCrossThreadAccess(t->getThread())));
+    t->getThread()->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(postStop, crossThreadUnretained(t->getThread())));
 
     std::unique_ptr<HandleReadResult> res1 = r1.wait();
     std::unique_ptr<HandleReadResult> res2 = r2.wait();
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index e80ee0d..cdfc165 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -555,7 +555,7 @@
     creationInfo.glInfo = glInfo;
     creationInfo.scriptState = scriptState;
     WebTaskRunner* taskRunner = Platform::current()->mainThread()->getWebTaskRunner();
-    taskRunner->postTask(BLINK_FROM_HERE, threadSafeBind(&createContextProviderOnMainThread, AllowCrossThreadAccess(&creationInfo), AllowCrossThreadAccess(&waitableEvent)));
+    taskRunner->postTask(BLINK_FROM_HERE, threadSafeBind(&createContextProviderOnMainThread, crossThreadUnretained(&creationInfo), crossThreadUnretained(&waitableEvent)));
     waitableEvent.wait();
     return std::move(creationInfo.createdContextProvider);
 }
diff --git a/third_party/WebKit/Source/platform/CrossThreadCopier.h b/third_party/WebKit/Source/platform/CrossThreadCopier.h
index cfb46fa..82e46f0 100644
--- a/third_party/WebKit/Source/platform/CrossThreadCopier.h
+++ b/third_party/WebKit/Source/platform/CrossThreadCopier.h
@@ -155,6 +155,11 @@
 };
 
 template<typename T>
+struct CrossThreadCopier<WTF::UnretainedWrapper<T, WTF::CrossThreadAffinity>> : public CrossThreadCopierPassThrough<WTF::UnretainedWrapper<T, WTF::CrossThreadAffinity>> {
+    STATIC_ONLY(CrossThreadCopier);
+};
+
+template<typename T>
 struct CrossThreadCopier<WeakPtr<T>> : public CrossThreadCopierPassThrough<WeakPtr<T>> {
     STATIC_ONLY(CrossThreadCopier);
 };
@@ -217,42 +222,6 @@
     }
 };
 
-// |T| is a pointer type.
-template <typename T>
-struct AllowCrossThreadAccessWrapper {
-    STACK_ALLOCATED();
-public:
-    T value() const { return m_value; }
-private:
-    // Only constructible from AllowCrossThreadAccess*().
-    explicit AllowCrossThreadAccessWrapper(T value) : m_value(value) { }
-    template <typename U>
-    friend AllowCrossThreadAccessWrapper<U*> AllowCrossThreadAccess(U*);
-
-    // This raw pointer is safe since AllowCrossThreadAccessWrapper is
-    // always stack-allocated. Ideally this should be Member<T> if T is
-    // garbage-collected and T* otherwise, but we don't want to introduce
-    // another template magic just for distinguishing Member<T> from T*.
-    // From the perspective of GC, T* always works correctly.
-    GC_PLUGIN_IGNORE("")
-    T m_value;
-};
-
-template <typename T>
-struct CrossThreadCopier<AllowCrossThreadAccessWrapper<T>> {
-    STATIC_ONLY(CrossThreadCopier);
-    typedef T Type;
-    static Type copy(const AllowCrossThreadAccessWrapper<T>& wrapper) { return wrapper.value(); }
-};
-
-template <typename T>
-AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value)
-{
-    static_assert(!IsGarbageCollectedType<T>::value, "Use wrapCrossThreadPersistent() instead for garbage-collected pointers");
-    static_assert(!WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "Use PassRefPtr<T> instead for ThreadSafeRefCounted");
-    return AllowCrossThreadAccessWrapper<T*>(value);
-}
-
 } // namespace blink
 
 #endif // CrossThreadCopier_h
diff --git a/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp b/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp
index 6a150874..9f6cf6c 100644
--- a/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp
+++ b/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp
@@ -95,7 +95,7 @@
         // Start the asynchronous database loading process.
         m_thread = wrapUnique(Platform::current()->createThread("HRTF database loader"));
         // TODO(alexclarke): Should this be posted as a loading task?
-        m_thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&HRTFDatabaseLoader::loadTask, AllowCrossThreadAccess(this)));
+        m_thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&HRTFDatabaseLoader::loadTask, crossThreadUnretained(this)));
     }
 }
 
@@ -119,7 +119,7 @@
 
     TaskSynchronizer sync;
     // TODO(alexclarke): Should this be posted as a loading task?
-    m_thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&HRTFDatabaseLoader::cleanupTask, AllowCrossThreadAccess(this), AllowCrossThreadAccess(&sync)));
+    m_thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&HRTFDatabaseLoader::cleanupTask, crossThreadUnretained(this), crossThreadUnretained(&sync)));
     sync.waitForTaskCompletion();
     m_thread.reset();
 }
diff --git a/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp b/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp
index dfa6ab7..cfd53770 100644
--- a/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp
+++ b/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp
@@ -172,7 +172,7 @@
 
     // Now that we've buffered more input, post another task to the background thread.
     if (m_backgroundThread)
-        m_backgroundThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&ReverbConvolver::processInBackground, AllowCrossThreadAccess(this)));
+        m_backgroundThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&ReverbConvolver::processInBackground, crossThreadUnretained(this)));
 }
 
 void ReverbConvolver::reset()
diff --git a/third_party/WebKit/Source/platform/exported/Platform.cpp b/third_party/WebKit/Source/platform/exported/Platform.cpp
index c0f50a0..67fe8c1 100644
--- a/third_party/WebKit/Source/platform/exported/Platform.cpp
+++ b/third_party/WebKit/Source/platform/exported/Platform.cpp
@@ -66,7 +66,7 @@
 
 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* context)
 {
-    Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(function, AllowCrossThreadAccess(context)));
+    Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(function, crossThreadUnretained(context)));
 }
 
 void Platform::initialize(Platform* platform)
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
index 9ced026..60d56e6 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
@@ -361,10 +361,10 @@
     testThread->getWebTaskRunner()->postTask(
         location,
         threadSafeBind(&runCreateBridgeTask,
-            AllowCrossThreadAccess(bridgePtr),
-            AllowCrossThreadAccess(gl),
-            AllowCrossThreadAccess(testHost),
-            AllowCrossThreadAccess(bridgeCreatedEvent.get())));
+            crossThreadUnretained(bridgePtr),
+            crossThreadUnretained(gl),
+            crossThreadUnretained(testHost),
+            crossThreadUnretained(bridgeCreatedEvent.get())));
     bridgeCreatedEvent->wait();
 }
 
@@ -380,7 +380,7 @@
     testThread->getWebTaskRunner()->postTask(
         location,
         threadSafeBind(&runDestroyBridgeTask,
-            AllowCrossThreadAccess(bridgePtr),
+            crossThreadUnretained(bridgePtr),
             nullptr));
 }
 
@@ -390,8 +390,8 @@
     testThread->getWebTaskRunner()->postTask(
         location,
         threadSafeBind(&runDestroyBridgeTask,
-            AllowCrossThreadAccess(bridgePtr),
-            AllowCrossThreadAccess(bridgeDestroyedEvent.get())));
+            crossThreadUnretained(bridgePtr),
+            crossThreadUnretained(bridgeDestroyedEvent.get())));
     bridgeDestroyedEvent->wait();
 }
 
@@ -407,9 +407,9 @@
     testThread->getWebTaskRunner()->postTask(
         location,
         threadSafeBind(&runSetIsHiddenTask,
-            AllowCrossThreadAccess(bridge),
+            crossThreadUnretained(bridge),
             value,
-            AllowCrossThreadAccess(doneEvent)));
+            crossThreadUnretained(doneEvent)));
 }
 
 void postAndWaitSetIsHiddenTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridge* bridge, bool value)
@@ -587,8 +587,8 @@
     testThread->getWebTaskRunner()->postTask(
         location,
         threadSafeBind(&runRenderingTask,
-            AllowCrossThreadAccess(bridge),
-            AllowCrossThreadAccess(doneEvent.get())));
+            crossThreadUnretained(bridge),
+            crossThreadUnretained(doneEvent.get())));
     doneEvent->wait();
 }
 
@@ -934,7 +934,7 @@
     EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationAbortedDueToPendingDestruction))
         .WillOnce(testing::InvokeWithoutArgs(hibernationAbortedEvent.get(), &WaitableEvent::signal));
     postSetIsHiddenTask(BLINK_FROM_HERE, testThread.get(), bridge.get(), true);
-    testThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&Canvas2DLayerBridge::beginDestruction, AllowCrossThreadAccess(bridge.get())));
+    testThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&Canvas2DLayerBridge::beginDestruction, crossThreadUnretained(bridge.get())));
     hibernationAbortedEvent->wait();
 
     ::testing::Mock::VerifyAndClearExpectations(mockLoggerPtr);
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
index c0a04ccc..1c11ca1 100644
--- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
@@ -246,7 +246,7 @@
 
     // Create a thread to rasterize SkPicture.
     std::unique_ptr<WebThread> thread = wrapUnique(Platform::current()->createThread("RasterThread"));
-    thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&rasterizeMain, AllowCrossThreadAccess(m_surface->getCanvas()), AllowCrossThreadAccess(picture.get())));
+    thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&rasterizeMain, crossThreadUnretained(m_surface->getCanvas()), crossThreadUnretained(picture.get())));
     thread.reset();
     EXPECT_EQ(0, m_decodeRequestCount);
 
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
index 62e5ef5..806293c 100644
--- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -470,7 +470,7 @@
         Vector<std::unique_ptr<WebThread>, numberOfThreads> m_threads;
         for (int i = 0; i < numberOfThreads; i++) {
             m_threads.append(wrapUnique(Platform::current()->createThread("blink gc testing thread")));
-            m_threads.last()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(threadFunc, AllowCrossThreadAccess(tester)));
+            m_threads.last()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(threadFunc, crossThreadUnretained(tester)));
         }
         while (tester->m_threadsToFinish) {
             SafePointScope scope(BlinkGC::NoHeapPointersOnStack);
@@ -6681,7 +6681,7 @@
     MutexLocker mainThreadMutexLocker(mainThreadMutex());
     std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread"));
     DestructorLockingObject* object = nullptr;
-    workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMainForCrossThreadWeakPersistentTest, AllowCrossThreadAccess(&object)));
+    workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMainForCrossThreadWeakPersistentTest, crossThreadUnretained(&object)));
     parkMainThread();
 
     // Step 3: Set up a CrossThreadWeakPersistent.
diff --git a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp
index 25f85362..3c112bc 100644
--- a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp
+++ b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp
@@ -27,7 +27,7 @@
 TEST_F(BackgroundTaskRunnerTest, RunShortTaskOnBackgroundThread)
 {
     std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent());
-    BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&PingPongTask, AllowCrossThreadAccess(doneEvent.get())), BackgroundTaskRunner::TaskSizeShortRunningTask);
+    BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&PingPongTask, crossThreadUnretained(doneEvent.get())), BackgroundTaskRunner::TaskSizeShortRunningTask);
     // Test passes by not hanging on the following wait().
     doneEvent->wait();
 }
@@ -35,7 +35,7 @@
 TEST_F(BackgroundTaskRunnerTest, RunLongTaskOnBackgroundThread)
 {
     std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent());
-    BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&PingPongTask, AllowCrossThreadAccess(doneEvent.get())), BackgroundTaskRunner::TaskSizeLongRunningTask);
+    BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&PingPongTask, crossThreadUnretained(doneEvent.get())), BackgroundTaskRunner::TaskSizeLongRunningTask);
     // Test passes by not hanging on the following wait().
     doneEvent->wait();
 }
diff --git a/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp b/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp
index 79709e1..b1e3bb7 100644
--- a/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp
+++ b/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp
@@ -41,7 +41,7 @@
     std::unique_ptr<CompositorMutatorClient> mutatorClient;
     WaitableEvent doneEvent;
     if (WebThread* compositorThread = Platform::current()->compositorThread()) {
-        compositorThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&createCompositorMutatorClient, AllowCrossThreadAccess(&mutatorClient), AllowCrossThreadAccess(&doneEvent)));
+        compositorThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&createCompositorMutatorClient, crossThreadUnretained(&mutatorClient), crossThreadUnretained(&doneEvent)));
     } else {
         createCompositorMutatorClient(&mutatorClient, &doneEvent);
     }
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
index 80b9d7d..0ed1810 100644
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -230,7 +230,7 @@
 void ServiceWorkerGlobalScopeProxy::postMessageToPageInspector(const String& message)
 {
     DCHECK(m_embeddedWorker);
-    document().postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbeddedWorkerImpl::postMessageToPageInspector, AllowCrossThreadAccess(m_embeddedWorker), message));
+    document().postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbeddedWorkerImpl::postMessageToPageInspector, crossThreadUnretained(m_embeddedWorker), message));
 }
 
 void ServiceWorkerGlobalScopeProxy::didEvaluateWorkerScript(bool success)
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
index 51b411c..e8101a3 100644
--- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
@@ -231,7 +231,7 @@
 
 void WebSharedWorkerImpl::postMessageToPageInspector(const String& message)
 {
-    m_mainFrame->frame()->document()->postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread, AllowCrossThreadAccess(this), message));
+    m_mainFrame->frame()->document()->postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread, crossThreadUnretained(this), message));
 }
 
 void WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread(const String& message)
@@ -241,7 +241,7 @@
 
 void WebSharedWorkerImpl::workerGlobalScopeClosed()
 {
-    Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread, AllowCrossThreadAccess(this)));
+    Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread, crossThreadUnretained(this)));
 }
 
 void WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread()
@@ -257,7 +257,7 @@
 
 void WebSharedWorkerImpl::workerThreadTerminated()
 {
-    Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&WebSharedWorkerImpl::workerThreadTerminatedOnMainThread, AllowCrossThreadAccess(this)));
+    Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&WebSharedWorkerImpl::workerThreadTerminatedOnMainThread, crossThreadUnretained(this)));
 }
 
 void WebSharedWorkerImpl::workerThreadTerminatedOnMainThread()
diff --git a/third_party/WebKit/Source/web/tests/SpinLockTest.cpp b/third_party/WebKit/Source/web/tests/SpinLockTest.cpp
index 769d349..08a4796 100644
--- a/third_party/WebKit/Source/web/tests/SpinLockTest.cpp
+++ b/third_party/WebKit/Source/web/tests/SpinLockTest.cpp
@@ -80,8 +80,8 @@
     std::unique_ptr<WebThread> thread1 = wrapUnique(Platform::current()->createThread("thread1"));
     std::unique_ptr<WebThread> thread2 = wrapUnique(Platform::current()->createThread("thread2"));
 
-    thread1->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&threadMain, AllowCrossThreadAccess(static_cast<char*>(sharedBuffer))));
-    thread2->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&threadMain, AllowCrossThreadAccess(static_cast<char*>(sharedBuffer))));
+    thread1->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&threadMain, crossThreadUnretained(static_cast<char*>(sharedBuffer))));
+    thread2->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&threadMain, crossThreadUnretained(static_cast<char*>(sharedBuffer))));
 
     thread1.reset();
     thread2.reset();