| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_HINTS_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_HINTS_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_HINTS_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_HINTS_H_ |
| 7 | 7 |
| 8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
| 9 #include "net/base/completion_callback.h" |
| 9 #include "net/http/http_request_info.h" | 10 #include "net/http/http_request_info.h" |
| 10 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 11 | 12 |
| 12 class GURL; | 13 class GURL; |
| 13 | 14 |
| 14 namespace net { | 15 namespace content { |
| 15 class URLRequestContextGetter; | 16 class ResourceContext; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 | 20 |
| 20 // A Preconnect instance maintains state while a TCP/IP connection is made, and | 21 // A Preconnect instance maintains state while a TCP/IP connection is made, and |
| 21 // then released into the pool of available connections for future use. | 22 // then released into the pool of available connections for future use. |
| 22 | 23 |
| 23 // Tries to preconnect. |count| may be used to request more than one connection | 24 // Tries to preconnect. |count| may be used to request more than one connection |
| 24 // be established in parallel. Note that the net stack has logic so multiple | 25 // be established in parallel. Note that the net stack has logic so multiple |
| 25 // calls to preconnect a given url within a short time frame will automatically | 26 // calls to preconnect a given url within a short time frame will automatically |
| 26 // coalesce. |allow_credentials| corresponds to the fetch spec. | 27 // coalesce. |allow_credentials| corresponds to the fetch spec. |
| 27 // Note: This should only be called on the IO thread, with a valid | 28 // Note: This should only be called on the IO thread, with a valid |
| 28 // URLRequestContextGetter. | 29 // URLRequestContextGetter. |
| 29 CONTENT_EXPORT void PreconnectUrl( | 30 CONTENT_EXPORT void PreconnectUrl( |
| 30 net::URLRequestContextGetter* getter, | 31 content::ResourceContext* resource_context, |
| 31 const GURL& url, | 32 const GURL& url, |
| 32 const GURL& first_party_for_cookies, | 33 const GURL& first_party_for_cookies, |
| 33 int count, | 34 int count, |
| 34 bool allow_credentials, | 35 bool allow_credentials, |
| 35 net::HttpRequestInfo::RequestMotivation motivation); | 36 net::HttpRequestInfo::RequestMotivation motivation); |
| 36 | 37 |
| 38 // Issues a DNS request to |url|. Note that these requests are sent to the host |
| 39 // resolver with priority net::IDLE. |
| 40 CONTENT_EXPORT int PreresolveUrl(content::ResourceContext* resource_context, |
| 41 const GURL& url, |
| 42 const net::CompletionCallback& callback); |
| 43 |
| 37 } // namespace content | 44 } // namespace content |
| 38 | 45 |
| 39 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_HINTS_H_ | 46 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_HINTS_H_ |
| OLD | NEW |