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 | |
| 73 // used here. Bug 84783. | |
| 72 if (request->job()->is_done()) { | 74 if (request->job()->is_done()) { |
|
wtc
2011/06/03 18:24:40
I believe we can replace this with
if (!reques
rvargas (doing something else)
2011/06/03 18:47:42
I added your comment to the bug report.
| |
| 73 RequestComplete(); | 75 RequestComplete(); |
| 74 return; | 76 return; |
| 75 } | 77 } |
| 76 | 78 |
| 77 int bytes_read = 0; | 79 int bytes_read = 0; |
| 78 if (!request->Read(received_data_.get(), kBufferSize, &bytes_read)) { | 80 if (!request->Read(received_data_.get(), kBufferSize, &bytes_read)) { |
| 79 if (!request->status().is_io_pending()) { | 81 if (!request->status().is_io_pending()) { |
| 80 RequestComplete(); | 82 RequestComplete(); |
| 81 } | 83 } |
| 82 return; | 84 return; |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 | 463 |
| 462 TEST_F(BlobURLRequestJobTest, TestExtraHeaders) { | 464 TEST_F(BlobURLRequestJobTest, TestExtraHeaders) { |
| 463 RunTestOnIOThread(&BlobURLRequestJobTest::TestExtraHeaders); | 465 RunTestOnIOThread(&BlobURLRequestJobTest::TestExtraHeaders); |
| 464 } | 466 } |
| 465 | 467 |
| 466 } // namespace webkit_blob | 468 } // namespace webkit_blob |
| 467 | 469 |
| 468 // BlobURLRequestJobTest is expected to always live longer than the | 470 // BlobURLRequestJobTest is expected to always live longer than the |
| 469 // runnable methods. This lets us call NewRunnableMethod on its instances. | 471 // runnable methods. This lets us call NewRunnableMethod on its instances. |
| 470 DISABLE_RUNNABLE_METHOD_REFCOUNT(webkit_blob::BlobURLRequestJobTest); | 472 DISABLE_RUNNABLE_METHOD_REFCOUNT(webkit_blob::BlobURLRequestJobTest); |
| OLD | NEW |