Commit 40696fd9 authored by hajimehoshi's avatar hajimehoshi Committed by Commit bot

Cache user agent string in FrameLoaderClientImpl instead of BlinkPlatformImpl

This CL makes FrameLoaderClientImpl cache user agent string instead of
BlinkPlatformImpl to avoid threading issue.

BUG=598479

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

Cr-Commit-Position: refs/heads/master@{#383915}
parent c6626baa
......@@ -427,12 +427,7 @@ blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() {
}
WebString BlinkPlatformImpl::userAgent() {
CR_DEFINE_STATIC_LOCAL(
blink::WebString, user_agent,
(blink::WebString::fromUTF8(GetContentClient()->GetUserAgent())));
DCHECK(user_agent ==
blink::WebString::fromUTF8(GetContentClient()->GetUserAgent()));
return user_agent;
return blink::WebString::fromUTF8(GetContentClient()->GetUserAgent());
}
WebData BlinkPlatformImpl::parseDataURL(const WebURL& url,
......
......@@ -748,7 +748,9 @@ String FrameLoaderClientImpl::userAgent()
if (!override.isEmpty())
return override;
return Platform::current()->userAgent();
if (m_userAgent.isEmpty())
m_userAgent = Platform::current()->userAgent();
return m_userAgent;
}
String FrameLoaderClientImpl::doNotTrackValue()
......
......@@ -192,6 +192,8 @@ private:
// The WebFrame that owns this object and manages its lifetime. Therefore,
// the web frame object is guaranteed to exist.
RawPtrWillBeMember<WebLocalFrameImpl> m_webFrame;
String m_userAgent;
};
DEFINE_TYPE_CASTS(FrameLoaderClientImpl, FrameLoaderClient, client, client->isFrameLoaderClientImpl(), client.isFrameLoaderClientImpl());
......
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