0

Speculatively use memory barriers for loading and storing g_context,

which points to a data structure that might otherwise not be fetched
together with the pointer.

BUG=NONE
R=rogerta@chromium.org

Review URL: https://codereview.chromium.org/327783003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277418 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
glider@chromium.org
2014-06-16 13:56:07 +00:00
parent 19e21ae08a
commit 573f0908d9

@ -188,7 +188,7 @@ AtomicWord g_context;
bool FinancialPing::SetURLRequestContext(
net::URLRequestContextGetter* context) {
base::subtle::NoBarrier_Store(
base::subtle::Release_Store(
&g_context, reinterpret_cast<AtomicWord>(context));
return true;
}
@ -218,7 +218,7 @@ bool send_financial_ping_interrupted_for_test = false;
void ShutdownCheck(base::WeakPtr<base::RunLoop> weak) {
if (!weak.get())
return;
if (!base::subtle::NoBarrier_Load(&g_context)) {
if (!base::subtle::Acquire_Load(&g_context)) {
send_financial_ping_interrupted_for_test = true;
weak->QuitClosure().Run();
return;
@ -295,7 +295,7 @@ bool FinancialPing::PingServer(const char* request, std::string* response) {
// the method is running.
net::URLRequestContextGetter* context =
reinterpret_cast<net::URLRequestContextGetter*>(
base::subtle::NoBarrier_Load(&g_context));
base::subtle::Acquire_Load(&g_context));
// Browser shutdown will cause the context to be reset to NULL.
if (!context)