prefetching DNS and chromium android webview

939 views
Skip to first unread message

James

unread,
Jan 8, 2015, 11:50:31 PM1/8/15
to chromi...@chromium.org
Greetings,

I am learning DNS prefetching used in Chromium, especially in Chromium Android-Webview. I found by default the page load by Chrome (v39) will automatically do prefetch DNS. However the same page loaded with Android-Webview in Kitkat doesn't have this ability, even in html I specify <rel "dns-prefetch" ...> stuff. I used remote debugger (Chroe://Inspect) to get this result by inspecting WebView on Android device.

Here are my several questions:

1. If there is anyway, programmatically or manually, turn prefetching DNS on in Chromium WebView?
2. If it's not, is there any plan to make it avaible in Lollipop?
3. If answers to above are all "No", what's the starting point to port this feature? Is there any design document I can refer? I found some code under src/components/dns_prefetch/. Is this right part I should port to android-webview?

Thank you very much,

James


Torne (Richard Coles)

unread,
Jan 9, 2015, 4:31:46 AM1/9/15
to johndo...@gmail.com, Chromium-dev
On 9 January 2015 at 04:50, James <johndo...@gmail.com> wrote:
Greetings,

I am learning DNS prefetching used in Chromium, especially in Chromium Android-Webview. I found by default the page load by Chrome (v39) will automatically do prefetch DNS. However the same page loaded with Android-Webview in Kitkat doesn't have this ability, even in html I specify <rel "dns-prefetch" ...> stuff. I used remote debugger (Chroe://Inspect) to get this result by inspecting WebView on Android device.

Here are my several questions:

1. If there is anyway, programmatically or manually, turn prefetching DNS on in Chromium WebView?

No; the dns prefetching component is not currently part of the webview as far as I can see.
 
2. If it's not, is there any plan to make it avaible in Lollipop?

Lollipop is already out, so it's too late for plans to add features to it. :) I'm not aware of a specific plan to enable this in a future release, but it seems like something we should consider.
 
3. If answers to above are all "No", what's the starting point to port this feature? Is there any design document I can refer? I found some code under src/components/dns_prefetch/. Is this right part I should port to android-webview?

That appears to be the right thing. This component is not currently used in WebView because the point in Chrome where it gets hooked up and enabled seems to be in src/chrome/browser/net/predictor.{h,cc} and no code from src/chrome is used in WebView. To add this support to WebView you'd need to wire up and enable it from somewhere in src/android_webview, ideally without duplicating existing code from src/chrome too much (it may be that this would require some refactoring to move more of the predictor implementation to a component, as components are allowed to be shared between webview and chrome, but I haven't looked at the code in great detail). I don't know if there are design docs for this feature.
 
Thank you very much,

James


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

PhistucK

unread,
Jan 9, 2015, 5:24:18 AM1/9/15
to Richard Coles, johndo...@gmail.com, Chromium-dev
Comments inline.


PhistucK

On Fri, Jan 9, 2015 at 11:31 AM, Torne (Richard Coles) <to...@chromium.org> wrote:
On 9 January 2015 at 04:50, James <johndo...@gmail.com> wrote:
Greetings,

I am learning DNS prefetching used in Chromium, especially in Chromium Android-Webview. I found by default the page load by Chrome (v39) will automatically do prefetch DNS. However the same page loaded with Android-Webview in Kitkat doesn't have this ability, even in html I specify <rel "dns-prefetch" ...> stuff. I used remote debugger (Chroe://Inspect) to get this result by inspecting WebView on Android device.

Here are my several questions:

1. If there is anyway, programmatically or manually, turn prefetching DNS on in Chromium WebView?

No; the dns prefetching component is not currently part of the webview as far as I can see.
 
2. If it's not, is there any plan to make it avaible in Lollipop?

Lollipop is already out, so it's too late for plans to add features to it. :) I'm not aware of a specific plan to enable this in a future release, but it seems like something we should consider.

​The WebView is updateable in Lollipop, so you can still plan for it! Yay! :)​

 
 
3. If answers to above are all "No", what's the starting point to port this feature? Is there any design document I can refer? I found some code under src/components/dns_prefetch/. Is this right part I should port to android-webview?

That appears to be the right thing. This component is not currently used in WebView because the point in Chrome where it gets hooked up and enabled seems to be in src/chrome/browser/net/predictor.{h,cc} and no code from src/chrome is used in WebView. To add this support to WebView you'd need to wire up and enable it from somewhere in src/android_webview, ideally without duplicating existing code from src/chrome too much (it may be that this would require some refactoring to move more of the predictor implementation to a component, as components are allowed to be shared between webview and chrome, but I haven't looked at the code in great detail). I don't know if there are design docs for this feature.
 
Thank you very much,

James


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.

Torne (Richard Coles)

unread,
Jan 9, 2015, 5:36:11 AM1/9/15
to PhistucK, johndo...@gmail.com, Chromium-dev
On 9 January 2015 at 10:23, PhistucK <phis...@gmail.com> wrote:
Comments inline.


PhistucK

On Fri, Jan 9, 2015 at 11:31 AM, Torne (Richard Coles) <to...@chromium.org> wrote:
On 9 January 2015 at 04:50, James <johndo...@gmail.com> wrote:
Greetings,

I am learning DNS prefetching used in Chromium, especially in Chromium Android-Webview. I found by default the page load by Chrome (v39) will automatically do prefetch DNS. However the same page loaded with Android-Webview in Kitkat doesn't have this ability, even in html I specify <rel "dns-prefetch" ...> stuff. I used remote debugger (Chroe://Inspect) to get this result by inspecting WebView on Android device.

Here are my several questions:

1. If there is anyway, programmatically or manually, turn prefetching DNS on in Chromium WebView?

No; the dns prefetching component is not currently part of the webview as far as I can see.
 
2. If it's not, is there any plan to make it avaible in Lollipop?

Lollipop is already out, so it's too late for plans to add features to it. :) I'm not aware of a specific plan to enable this in a future release, but it seems like something we should consider.

​The WebView is updateable in Lollipop, so you can still plan for it! Yay! :)​

Possibly. We can't add Java side APIs to the WebView via an update without also updating Android itself, though - the Java classes an app actually uses are still part of the system, and only the implementations of them can be updated.

I can imagine someone wanting an API to control whether DNS prefetching is enabled in their app, and that would need to wait for a platform update, so whether this feature could be added in a WebView update would have to depend on what we thought about that after considering it.
Message has been deleted

James

unread,
Jan 13, 2015, 6:54:29 PM1/13/15
to chromi...@chromium.org
I spent some time to build Chromium on Linux,  and ChromeShell.apk, AndroidWebview.apk  for android, and found all of them do not support prefetch dns on Android. On linux, it woks fine. The codebase is latest updated today. 

The html doc is like below:

<head>
<link rel="dns-prefetch" href="//www.alibaba.com">
</head>

<body>
<a href="http://www.alibaba.com"> alibaba</a>
</body>

Since Chrome on linux and Mac all support prefetch by default, I just assume ChromeShell.apk will support this feature. But my test result is negative. I kind of suspect my test approaches though it's proved right on desktop. Any one can confirm even for ChromeShell.apk it won't support dns-prefetch. 

Thanks,
James

Reply all
Reply to author
Forward
0 new messages