Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // See header file for description of RendererPreconnect class | 5 // See header file for description of RendererPreconnect class |
| 6 | 6 |
| 7 #include "components/network_hints/renderer/renderer_preconnect.h" | 7 #include "components/network_hints/renderer/renderer_preconnect.h" |
| 8 | 8 |
| 9 #include "components/network_hints/common/network_hints_common.h" | 9 #include "components/network_hints/common/network_hints_common.h" |
| 10 #include "components/network_hints/common/network_hints_messages.h" | 10 #include "components/network_hints/common/network_hints_param_traits.h" |
| 11 #include "content/public/renderer/render_thread.h" | 11 #include "content/public/renderer/render_thread.h" |
| 12 #include "services/shell/public/cpp/interface_provider.h" | |
| 12 | 13 |
| 13 using content::RenderThread; | 14 using content::RenderThread; |
| 14 | 15 |
| 15 namespace network_hints { | 16 namespace network_hints { |
| 16 | 17 |
| 17 RendererPreconnect::RendererPreconnect() { | 18 RendererPreconnect::RendererPreconnect() { |
| 18 } | 19 } |
| 19 | 20 |
| 20 RendererPreconnect::~RendererPreconnect() { | 21 RendererPreconnect::~RendererPreconnect() { |
| 21 } | 22 } |
| 22 | 23 |
| 23 void RendererPreconnect::Preconnect(const GURL& url, bool allow_credentials) { | 24 void RendererPreconnect::Preconnect(const GURL& url, bool allow_credentials) { |
| 24 if (!url.is_valid()) | 25 if (!url.is_valid()) |
| 25 return; | 26 return; |
| 26 | 27 |
| 27 RenderThread::Get()->Send( | 28 network_hints_->Preconnect(url, allow_credentials, 1); |
|
Sam McNally
2016/07/12 05:25:30
Is |network_hints_| connected here?
tibell
2016/07/12 07:14:24
Done.
| |
| 28 new NetworkHintsMsg_Preconnect(url, allow_credentials, 1)); | 29 } |
| 30 | |
| 31 void RendererPreconnect::EnsureConnected() { | |
| 32 DCHECK(content::RenderThread::Get()); | |
| 33 if (!network_hints_.is_bound()) { | |
| 34 RenderThread::Get()->GetRemoteInterfaces()->GetInterface( | |
| 35 mojo::GetProxy(&network_hints_)); | |
| 36 } | |
| 29 } | 37 } |
| 30 | 38 |
| 31 } // namespace network_hints | 39 } // namespace network_hints |
| OLD | NEW |