diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-13 17:03:52 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-13 17:03:52 +0000 |
commit | 04741728117ac420a3b4fd483a96a3a087e79b17 (patch) | |
tree | e3265747f56d0a77c151bebae41f0d6ba8357aaa /android_webview/renderer | |
parent | 63e53c9725753134e65458fc8b61b313382dccb5 (diff) | |
download | chromium_src-04741728117ac420a3b4fd483a96a3a087e79b17.zip chromium_src-04741728117ac420a3b4fd483a96a3a087e79b17.tar.gz chromium_src-04741728117ac420a3b4fd483a96a3a087e79b17.tar.bz2 |
Fix race condition introduced in r242200 where AwContentsIoThreadClient is queried before a subframe's entry is added.
This happened because the entry was updated on the UI thread through WebContentsObserver::RenderFrameCreated. The race condition was that the IO thread could dispatch a resource request for that subframe before the map is updated.
The fix is to send a message from the renderer to the IO thread when a subframe is created so that the map is updated before any resouce requests arrive.
BUG=304341
R=mkosiba@chromium.org
Review URL: https://codereview.chromium.org/135443002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244521 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/renderer')
-rw-r--r-- | android_webview/renderer/aw_content_renderer_client.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/android_webview/renderer/aw_content_renderer_client.cc b/android_webview/renderer/aw_content_renderer_client.cc index 09f5a5c..cc2c3b3 100644 --- a/android_webview/renderer/aw_content_renderer_client.cc +++ b/android_webview/renderer/aw_content_renderer_client.cc @@ -21,6 +21,7 @@ #include "content/public/renderer/navigation_state.h" #include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_thread.h" +#include "content/public/renderer/render_view.h" #include "net/base/net_errors.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURL.h" @@ -116,6 +117,17 @@ bool AwContentRendererClient::HandleNavigation( void AwContentRendererClient::RenderFrameCreated( content::RenderFrame* render_frame) { new AwPermissionClient(render_frame); + + // TODO(jam): when a RenderFrame is per WebFrame, this can be simplified by + // getting a RenderFrame's WebFrame and calling its parent() method. + content::RenderFrame* parent_frame = + render_frame->GetRenderView()->GetMainRenderFrame(); + if (parent_frame && parent_frame != render_frame) { + // Avoid any race conditions from having the browser's UI thread tell the IO + // thread that a subframe was created. + RenderThread::Get()->Send(new AwViewHostMsg_SubFrameCreated( + parent_frame->GetRoutingID(), render_frame->GetRoutingID())); + } } void AwContentRendererClient::RenderViewCreated( |