OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/renderer/net/prescient_networking_dispatcher.h" | 5 #include "chrome/renderer/net/prescient_networking_dispatcher.h" |
6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
8 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
9 | 10 |
10 using WebKit::WebPrescientNetworking; | 11 using WebKit::WebPrescientNetworking; |
11 | 12 |
12 PrescientNetworkingDispatcher::~PrescientNetworkingDispatcher() { | 13 PrescientNetworkingDispatcher::~PrescientNetworkingDispatcher() { |
13 } | 14 } |
14 | 15 |
| 16 void PrescientNetworkingDispatcher::prefetchDNS( |
| 17 const WebKit::WebString& hostname) { |
| 18 if (hostname.isEmpty()) |
| 19 return; |
| 20 |
| 21 std::string hostname_utf8; |
| 22 UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8); |
| 23 net_predictor_.Resolve(hostname_utf8.data(), hostname_utf8.length()); |
| 24 } |
| 25 |
15 void PrescientNetworkingDispatcher::preconnect( | 26 void PrescientNetworkingDispatcher::preconnect( |
16 const WebKit::WebURL& url, | 27 const WebKit::WebURL& url, |
17 WebKit::WebPreconnectMotivation motivation) { | 28 WebKit::WebPreconnectMotivation motivation) { |
18 // FIXME(kouhei) actual pre-connecting is currently disabled. | 29 // FIXME(kouhei) actual pre-connecting is currently disabled. |
19 // This should shortly be enabled via Finch field trials in upcoming patch. | 30 // This should shortly be enabled via Finch field trials in upcoming patch. |
20 // content::RenderThread::Get()->Send(new ChromeViewHostMsg_Preconnect(url)); | 31 // content::RenderThread::Get()->Send(new ChromeViewHostMsg_Preconnect(url)); |
21 } | 32 } |
22 | 33 |
OLD | NEW |