Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stack> | 5 #include <stack> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 if (bytes_read > 0) | 62 if (bytes_read > 0) |
| 63 ReceiveData(request, bytes_read); | 63 ReceiveData(request, bytes_read); |
| 64 else | 64 else |
| 65 RequestComplete(); | 65 RequestComplete(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 const std::string& response_data() const { return response_data_; } | 68 const std::string& response_data() const { return response_data_; } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 void ReadSome(net::URLRequest* request) { | 71 void ReadSome(net::URLRequest* request) { |
| 72 // job() is not part of the URLRequest public API so it should not be | 72 if (!request->is_pending()) { |
|
wtc
2011/06/08 22:16:20
I wonder if we should test !request->status().is_i
| |
| 73 // used here. Bug 84783. | |
| 74 if (request->job()->is_done()) { | |
| 75 RequestComplete(); | 73 RequestComplete(); |
| 76 return; | 74 return; |
| 77 } | 75 } |
| 78 | 76 |
| 79 int bytes_read = 0; | 77 int bytes_read = 0; |
| 80 if (!request->Read(received_data_.get(), kBufferSize, &bytes_read)) { | 78 if (!request->Read(received_data_.get(), kBufferSize, &bytes_read)) { |
| 81 if (!request->status().is_io_pending()) { | 79 if (!request->status().is_io_pending()) { |
| 82 RequestComplete(); | 80 RequestComplete(); |
| 83 } | 81 } |
| 84 return; | 82 return; |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 463 | 461 |
| 464 TEST_F(BlobURLRequestJobTest, TestExtraHeaders) { | 462 TEST_F(BlobURLRequestJobTest, TestExtraHeaders) { |
| 465 RunTestOnIOThread(&BlobURLRequestJobTest::TestExtraHeaders); | 463 RunTestOnIOThread(&BlobURLRequestJobTest::TestExtraHeaders); |
| 466 } | 464 } |
| 467 | 465 |
| 468 } // namespace webkit_blob | 466 } // namespace webkit_blob |
| 469 | 467 |
| 470 // BlobURLRequestJobTest is expected to always live longer than the | 468 // BlobURLRequestJobTest is expected to always live longer than the |
| 471 // runnable methods. This lets us call NewRunnableMethod on its instances. | 469 // runnable methods. This lets us call NewRunnableMethod on its instances. |
| 472 DISABLE_RUNNABLE_METHOD_REFCOUNT(webkit_blob::BlobURLRequestJobTest); | 470 DISABLE_RUNNABLE_METHOD_REFCOUNT(webkit_blob::BlobURLRequestJobTest); |
| OLD | NEW |