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

Side by Side Diff: content/browser/loader/resource_hints_impl.h

Issue 2004453002: Add a Dns preresolve interface in //content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@predictor_dns_browsertest
Patch Set: Fix comment and add necessary include Created 4 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_HINTS_IMPL_H_
6 #define CONTENT_BROWSER_LOADER_RESOURCE_HINTS_IMPL_H_
7
8 #include <set>
9
10 #include "base/macros.h"
11 #include "net/base/address_list.h"
12 #include "net/dns/host_resolver.h"
13 #include "net/dns/single_request_host_resolver.h"
14 #include "net/url_request/url_request_context_getter.h"
15
16 namespace content {
17
18 // Scoped to the ResourceDispatcherHostImpl. This class manages DNS
19 // preresolutions. Once resource hints go through mojo it will also respond to
20 // mojo requests from Blink to preconnect / preresolve.
21 class ResourceHintsController {
kinuko 2016/05/23 14:07:26 I feel this class could be in its own header and c
Charlie Harrison 2016/05/23 17:12:30 Done.
22 public:
23 ResourceHintsController();
24 ~ResourceHintsController();
25 int PreresolveUrl(net::URLRequestContextGetter* getter,
26 const GURL& url,
27 const net::CompletionCallback& callback);
28
29 private:
30 struct DnsRequest {
kinuko 2016/05/23 14:07:26 nit: the definition of this struct could be in .cc
Charlie Harrison 2016/05/23 17:12:30 Done.
31 DnsRequest(net::HostResolver* resolver);
kinuko 2016/05/23 14:07:26 nit: explicit
Charlie Harrison 2016/05/23 17:12:30 Done.
32 net::SingleRequestHostResolver resolver;
33 net::AddressList addresses;
34 };
35
36 void OnResolveComplete(DnsRequest* request,
37 const net::CompletionCallback& callback,
38 int result);
39
40 std::set<DnsRequest*> pending_dns_requests_;
kinuko 2016/05/23 14:07:26 std::set<std::unique_ptr<DnsRequest>> ?
Charlie Harrison 2016/05/23 17:12:30 Is there an easy way to do this with unique pointe
41
42 DISALLOW_COPY_AND_ASSIGN(ResourceHintsController);
43 };
44
45 } // namespace content
46
47 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HINTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698