| 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 "net/test/embedded_test_server/embedded_test_server.h" | 5 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 void EmbeddedTestServer::OnReadCompleted(HttpConnection* connection, int rv) { | 370 void EmbeddedTestServer::OnReadCompleted(HttpConnection* connection, int rv) { |
| 371 DCHECK_NE(ERR_IO_PENDING, rv); | 371 DCHECK_NE(ERR_IO_PENDING, rv); |
| 372 if (HandleReadResult(connection, rv)) | 372 if (HandleReadResult(connection, rv)) |
| 373 ReadData(connection); | 373 ReadData(connection); |
| 374 } | 374 } |
| 375 | 375 |
| 376 bool EmbeddedTestServer::HandleReadResult(HttpConnection* connection, int rv) { | 376 bool EmbeddedTestServer::HandleReadResult(HttpConnection* connection, int rv) { |
| 377 DCHECK(io_thread_->task_runner()->BelongsToCurrentThread()); | 377 DCHECK(io_thread_->task_runner()->BelongsToCurrentThread()); |
| 378 if (connection_listener_) | 378 if (connection_listener_) |
| 379 connection_listener_->ReadFromSocket(*connection->socket_); | 379 connection_listener_->ReadFromSocket(*connection->socket_, rv); |
| 380 if (rv <= 0) { | 380 if (rv <= 0) { |
| 381 DidClose(connection); | 381 DidClose(connection); |
| 382 return false; | 382 return false; |
| 383 } | 383 } |
| 384 | 384 |
| 385 // Once a single complete request has been received, there is no further need | 385 // Once a single complete request has been received, there is no further need |
| 386 // for the connection and it may be destroyed once the response has been sent. | 386 // for the connection and it may be destroyed once the response has been sent. |
| 387 if (connection->ConsumeData(rv)) | 387 if (connection->ConsumeData(rv)) |
| 388 return false; | 388 return false; |
| 389 | 389 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 run_loop.QuitClosure())) { | 430 run_loop.QuitClosure())) { |
| 431 return false; | 431 return false; |
| 432 } | 432 } |
| 433 run_loop.Run(); | 433 run_loop.Run(); |
| 434 | 434 |
| 435 return true; | 435 return true; |
| 436 } | 436 } |
| 437 | 437 |
| 438 } // namespace test_server | 438 } // namespace test_server |
| 439 } // namespace net | 439 } // namespace net |
| OLD | NEW |