Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: components/network_hints/renderer/renderer_preconnect.h

Issue 2144533002: Convert network hints to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add untracked dependency on mojom Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // A RendererPreconnect instance is maintained for each RenderThread. 5 // A RendererPreconnect instance is maintained for each RenderThread.
6 // URL strings are typically added to the embedded queue during rendering. 6 // URL strings are typically added to the embedded queue during rendering.
7 // The first addition to the queue (transitioning from empty to having 7 // The first addition to the queue (transitioning from empty to having
8 // some names) causes a processing task to be added to the Renderer Thread. 8 // some names) causes a processing task to be added to the Renderer Thread.
9 // The processing task gathers all buffered URLs, and send them via IPC 9 // The processing task gathers all buffered URLs, and send them via IPC
10 // to the browser. 10 // to the browser.
11 // This class counts repeated requests for the same URL and requests that 11 // This class counts repeated requests for the same URL and requests that
12 // number of connections be preconnected. If multiple requests are sent 12 // number of connections be preconnected. If multiple requests are sent
13 // separately the net stack will just keep re-using the first pending 13 // separately the net stack will just keep re-using the first pending
14 // connection so we allow for the time between the parsing of the tags and 14 // connection so we allow for the time between the parsing of the tags and
15 // when the task is scheduled to accumulate multiple requests. 15 // when the task is scheduled to accumulate multiple requests.
16 16
17 #ifndef COMPONENTS_NETWORK_HINTS_RENDERER_RENDERER_PRECONNECT_H_ 17 #ifndef COMPONENTS_NETWORK_HINTS_RENDERER_RENDERER_PRECONNECT_H_
18 #define COMPONENTS_NETWORK_HINTS_RENDERER_RENDERER_PRECONNECT_H_ 18 #define COMPONENTS_NETWORK_HINTS_RENDERER_RENDERER_PRECONNECT_H_
19 19
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "components/network_hints/public/interfaces/network_hints.mojom.h"
21 #include "url/gurl.h" 22 #include "url/gurl.h"
22 23
23 namespace network_hints { 24 namespace network_hints {
24 25
25 // An internal interface to the network_hints component for efficiently sending 26 // An internal interface to the network_hints component for efficiently sending
26 // preconnect requests to the net stack. 27 // preconnect requests to the net stack.
27 class RendererPreconnect { 28 class RendererPreconnect {
28 public: 29 public:
29 RendererPreconnect(); 30 RendererPreconnect();
30 ~RendererPreconnect(); 31 ~RendererPreconnect();
31 32
32 // Submit a preconnect request for a single connection. 33 // Submit a preconnect request for a single connection.
33 void Preconnect(const GURL& url, bool allow_credentials); 34 void Preconnect(const GURL& url, bool allow_credentials);
34 35
35 private: 36 private:
37 // Get a connected NetworkHints.
38 mojom::NetworkHints& GetNetworkHints();
39
40 // Don't use directly. Instead call |GetNetworkHints()|.
41 mojom::NetworkHintsPtr network_hints_;
36 42
37 DISALLOW_COPY_AND_ASSIGN(RendererPreconnect); 43 DISALLOW_COPY_AND_ASSIGN(RendererPreconnect);
38 }; // class RendererPreconnect 44 }; // class RendererPreconnect
39 45
40 } // namespace network_hints 46 } // namespace network_hints
41 47
42 #endif // COMPONENTS_NETWORK_HINTS_RENDERER_RENDERER_PRECONNECT_H_ 48 #endif // COMPONENTS_NETWORK_HINTS_RENDERER_RENDERER_PRECONNECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698