Index: components/network_hints/renderer/renderer_preconnect.cc |
diff --git a/components/network_hints/renderer/renderer_preconnect.cc b/components/network_hints/renderer/renderer_preconnect.cc |
index b353cb1cb4a4ff9025f084bb69a5d04d40e65e26..61d1f2605463b6cb1e03ac0a3c208f8757649cdc 100644 |
--- a/components/network_hints/renderer/renderer_preconnect.cc |
+++ b/components/network_hints/renderer/renderer_preconnect.cc |
@@ -7,8 +7,9 @@ |
#include "components/network_hints/renderer/renderer_preconnect.h" |
#include "components/network_hints/common/network_hints_common.h" |
-#include "components/network_hints/common/network_hints_messages.h" |
+#include "components/network_hints/public/cpp/network_hints_param_traits.h" |
#include "content/public/renderer/render_thread.h" |
+#include "services/shell/public/cpp/interface_provider.h" |
using content::RenderThread; |
@@ -24,8 +25,16 @@ void RendererPreconnect::Preconnect(const GURL& url, bool allow_credentials) { |
if (!url.is_valid()) |
return; |
- RenderThread::Get()->Send( |
- new NetworkHintsMsg_Preconnect(url, allow_credentials, 1)); |
+ GetNetworkHints().Preconnect(url, allow_credentials, 1); |
+} |
+ |
+mojom::NetworkHints& RendererPreconnect::GetNetworkHints() { |
+ DCHECK(content::RenderThread::Get()); |
+ if (!network_hints_) { |
dcheng
2016/07/20 13:59:50
Some places like to cache this interface ptr while
tibell
2016/07/21 00:12:07
Caching is preferred if you don't know for sure th
dcheng
2016/07/21 02:43:13
I guess it's inevitable, but I think it's a bit to
tibell
2016/07/21 05:09:45
Agreed. sammc@ has a CL that makes InterfacePtr do
|
+ RenderThread::Get()->GetRemoteInterfaces()->GetInterface( |
+ mojo::GetProxy(&network_hints_)); |
+ } |
+ return *network_hints_; |
} |
} // namespace network_hints |