Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
|
Deprecated (see juliatuttle)
2015/02/10 17:48:42
2015?
mmenke
2015/02/10 18:10:14
Also, newer files shouldn't use the (c)
Pat Meenan
2015/02/10 18:44:49
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // A RendererPreconnect instance is maintained for each RenderThread. | |
| 6 // URL strings are typically added to the embedded queue during rendering. | |
| 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. | |
| 9 // The processing task gathers all buffered URLs, and send them via IPC | |
| 10 // to the browser. | |
| 11 // This class counts repeated requests for the same URL and requests that | |
| 12 // number of connections be preconnected. If multiple requests are sent | |
| 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 | |
| 15 // when the task is scheduled to accumulate multiple requests. | |
| 16 | |
| 17 #ifndef COMPONENTS_NETWORK_HINTS_RENDERER_RENDERER_PRECONNECT_H_ | |
| 18 #define COMPONENTS_NETWORK_HINTS_RENDERER_RENDERER_PRECONNECT_H_ | |
| 19 | |
| 20 #include <map> | |
| 21 #include <string> | |
|
mmenke
2015/02/10 18:10:14
I don't think this is used
Pat Meenan
2015/02/10 18:44:49
Removed. Leftover when I used strings instead of G
| |
| 22 | |
| 23 #include "base/basictypes.h" | |
| 24 #include "base/memory/weak_ptr.h" | |
| 25 #include "url/gurl.h" | |
| 26 | |
| 27 namespace network_hints { | |
| 28 | |
| 29 // An internal interface to the network_hints component for efficiently sending | |
| 30 // DNS prefetch requests to the net stack. | |
| 31 class RendererPreconnect { | |
| 32 public: | |
| 33 RendererPreconnect(); | |
| 34 ~RendererPreconnect(); | |
| 35 | |
| 36 // Push a name into the queue to be preconnected. | |
| 37 void Preconnect(const GURL &url); | |
| 38 | |
| 39 // SubmitPreconnect processes the buffered URLs, and submits them for | |
| 40 // preconnecting. Multiple requests for the same URL will increase the number | |
| 41 // of connections requested. | |
| 42 void SubmitPreconnect(); | |
| 43 | |
| 44 private: | |
| 45 // url_request_count_map_ contains (for each URL) a count for the number of | |
| 46 // times it was requested. | |
| 47 typedef std::map<GURL, int> UrlRequestCountMap; | |
| 48 UrlRequestCountMap url_request_count_map_; | |
| 49 | |
| 50 base::WeakPtrFactory<RendererPreconnect> weak_factory_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(RendererPreconnect); | |
| 53 }; // class RendererPreconnect | |
| 54 | |
| 55 } // namespace network_hints | |
| 56 | |
| 57 #endif // COMPONENTS_NETWORK_HINTS_RENDERER_RENDERER_PRECONNECT_H_ | |
| OLD | NEW |