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

Side by Side Diff: content/shell/utility/shell_content_utility_client.cc

Issue 2895353002: Fix host resolver being initialized after network requests arrive to the network service. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « content/public/common/network_service_test.mojom ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/shell/utility/shell_content_utility_client.h" 5 #include "content/shell/utility/shell_content_utility_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 public: 83 public:
84 static void Create(mojom::NetworkServiceTestRequest request) { 84 static void Create(mojom::NetworkServiceTestRequest request) {
85 // Leak this. 85 // Leak this.
86 new NetworkServiceTestImpl(std::move(request)); 86 new NetworkServiceTestImpl(std::move(request));
87 } 87 }
88 explicit NetworkServiceTestImpl(mojom::NetworkServiceTestRequest request) 88 explicit NetworkServiceTestImpl(mojom::NetworkServiceTestRequest request)
89 : binding_(this, std::move(request)) {} 89 : binding_(this, std::move(request)) {}
90 ~NetworkServiceTestImpl() override = default; 90 ~NetworkServiceTestImpl() override = default;
91 91
92 // mojom::NetworkServiceTest implementation. 92 // mojom::NetworkServiceTest implementation.
93 void AddRules(std::vector<mojom::RulePtr> rules) override { 93 void AddRules(std::vector<mojom::RulePtr> rules,
94 AddRulesCallback callback) override {
94 for (const auto& rule : rules) { 95 for (const auto& rule : rules) {
95 test_host_resolver_.host_resolver()->AddRule(rule->host_pattern, 96 test_host_resolver_.host_resolver()->AddRule(rule->host_pattern,
96 rule->replacement); 97 rule->replacement);
97 } 98 }
99 std::move(callback).Run();
98 } 100 }
99 101
100 private: 102 private:
101 mojo::Binding<mojom::NetworkServiceTest> binding_; 103 mojo::Binding<mojom::NetworkServiceTest> binding_;
102 104
103 TestHostResolver test_host_resolver_; 105 TestHostResolver test_host_resolver_;
104 106
105 DISALLOW_COPY_AND_ASSIGN(NetworkServiceTestImpl); 107 DISALLOW_COPY_AND_ASSIGN(NetworkServiceTestImpl);
106 }; 108 };
107 109
(...skipping 29 matching lines...) Expand all
137 139
138 void ShellContentUtilityClient::BindNetworkServiceTestRequest( 140 void ShellContentUtilityClient::BindNetworkServiceTestRequest(
139 const service_manager::BindSourceInfo& source_info, 141 const service_manager::BindSourceInfo& source_info,
140 mojom::NetworkServiceTestRequest request) { 142 mojom::NetworkServiceTestRequest request) {
141 DCHECK(!network_service_test_); 143 DCHECK(!network_service_test_);
142 network_service_test_ = 144 network_service_test_ =
143 base::MakeUnique<NetworkServiceTestImpl>(std::move(request)); 145 base::MakeUnique<NetworkServiceTestImpl>(std::move(request));
144 } 146 }
145 147
146 } // namespace content 148 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/network_service_test.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698