| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 private: | 175 private: |
| 176 ~HostResolutionRequestRecorder() override {} | 176 ~HostResolutionRequestRecorder() override {} |
| 177 | 177 |
| 178 void AddToHistory(const std::string& hostname) { | 178 void AddToHistory(const std::string& hostname) { |
| 179 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 179 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 180 requested_hostnames_.push_back(hostname); | 180 requested_hostnames_.push_back(hostname); |
| 181 if (is_waiting_for_hostname_ && waiting_for_hostname_ == hostname) { | 181 if (is_waiting_for_hostname_ && waiting_for_hostname_ == hostname) { |
| 182 is_waiting_for_hostname_ = false; | 182 is_waiting_for_hostname_ = false; |
| 183 waiting_for_hostname_.clear(); | 183 waiting_for_hostname_.clear(); |
| 184 base::MessageLoop::current()->Quit(); | 184 base::MessageLoop::current()->QuitWhenIdle(); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 // The hostname which WaitUntilHostHasBeenRequested is currently waiting for | 188 // The hostname which WaitUntilHostHasBeenRequested is currently waiting for |
| 189 // to be requested. | 189 // to be requested. |
| 190 std::string waiting_for_hostname_; | 190 std::string waiting_for_hostname_; |
| 191 | 191 |
| 192 // Whether WaitUntilHostHasBeenRequested is waiting for a hostname to be | 192 // Whether WaitUntilHostHasBeenRequested is waiting for a hostname to be |
| 193 // requested and thus is running a nested message loop. | 193 // requested and thus is running a nested message loop. |
| 194 bool is_waiting_for_hostname_; | 194 bool is_waiting_for_hostname_; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 // Second navigation to content with an img. | 454 // Second navigation to content with an img. |
| 455 std::string img_content = | 455 std::string img_content = |
| 456 "<img src=\"" + preconnect_url.spec() + "test.gif\">"; | 456 "<img src=\"" + preconnect_url.spec() + "test.gif\">"; |
| 457 NavigateToDataURLWithContent(img_content); | 457 NavigateToDataURLWithContent(img_content); |
| 458 connection_listener_->WaitUntilFirstConnectionRead(); | 458 connection_listener_->WaitUntilFirstConnectionRead(); |
| 459 EXPECT_EQ(2u, connection_listener_->GetAcceptedSocketCount()); | 459 EXPECT_EQ(2u, connection_listener_->GetAcceptedSocketCount()); |
| 460 EXPECT_EQ(1u, connection_listener_->GetReadSocketCount()); | 460 EXPECT_EQ(1u, connection_listener_->GetReadSocketCount()); |
| 461 } | 461 } |
| 462 | 462 |
| 463 } // namespace chrome_browser_net | 463 } // namespace chrome_browser_net |
| OLD | NEW |