diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-29 20:38:11 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-29 20:38:11 +0000 |
commit | d14c7ac0a14a2dc3984022aeadf830a3e30c99f3 (patch) | |
tree | 14b94d459b30e5156fa32daf318a217f79392d32 /net | |
parent | 5d25637a208dbed17b10d31eb91221e6332a5e62 (diff) | |
download | chromium_src-d14c7ac0a14a2dc3984022aeadf830a3e30c99f3.zip chromium_src-d14c7ac0a14a2dc3984022aeadf830a3e30c99f3.tar.gz chromium_src-d14c7ac0a14a2dc3984022aeadf830a3e30c99f3.tar.bz2 |
Remove code path that passes a file handle to the renderer
Since the code now does range request without any caching
the code path for passing file handle is not used any more.
Changes:
1. Remove response_data_file in webkit_glue::ResourceResponseHead
2. Remove response_data_file in net::ResourceInfo
3. Remove code that passes file handle using IPC
4. Remove code that passes file hadnle from network layer to ResourceDispatcherHost
5. Remove MediaResourceHandler
6. Remove code in disk_cache that expose the file handle
7. Remove ChromeURLRequestContext::CreateOffTheRecordForMedia() so no more OTR request context for media, in OTR mode simply memory cache is used
8. Reset cache size for media cache to default
BUG=12249
BUG=12256
Review URL: http://codereview.chromium.org/113931
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17227 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/cache_type.h | 1 | ||||
-rw-r--r-- | net/base/load_flags.h | 5 | ||||
-rw-r--r-- | net/disk_cache/backend_unittest.cc | 7 | ||||
-rw-r--r-- | net/disk_cache/disk_cache.h | 23 | ||||
-rw-r--r-- | net/disk_cache/entry_impl.cc | 51 | ||||
-rw-r--r-- | net/disk_cache/entry_impl.h | 4 | ||||
-rw-r--r-- | net/disk_cache/entry_unittest.cc | 99 | ||||
-rw-r--r-- | net/disk_cache/histogram_macros.h | 3 | ||||
-rw-r--r-- | net/disk_cache/mem_entry_impl.h | 8 | ||||
-rw-r--r-- | net/http/http_cache.cc | 31 | ||||
-rw-r--r-- | net/http/http_cache_unittest.cc | 98 | ||||
-rw-r--r-- | net/http/http_network_transaction_unittest.cc | 2 | ||||
-rw-r--r-- | net/http/http_response_info.cc | 2 | ||||
-rw-r--r-- | net/http/http_response_info.h | 5 | ||||
-rw-r--r-- | net/url_request/url_request.h | 7 | ||||
-rw-r--r-- | net/url_request/url_request_file_job.cc | 18 | ||||
-rw-r--r-- | net/url_request/url_request_file_job.h | 1 |
17 files changed, 6 insertions, 359 deletions
diff --git a/net/base/cache_type.h b/net/base/cache_type.h index 4ba487f..341ce7a 100644 --- a/net/base/cache_type.h +++ b/net/base/cache_type.h @@ -12,7 +12,6 @@ enum CacheType { DISK_CACHE, // Disk is used as the backing storage. MEMORY_CACHE, // Data is stored only in memory. MEDIA_CACHE, // Optimized to handle media files. - TEMP_MEDIA_CACHE // Optimized for media files while off the record. }; } // namespace disk_cache diff --git a/net/base/load_flags.h b/net/base/load_flags.h index 09851ec..f60163f35 100644 --- a/net/base/load_flags.h +++ b/net/base/load_flags.h @@ -37,11 +37,6 @@ enum { // If present, upload progress messages should be provided to initiator. LOAD_ENABLE_UPLOAD_PROGRESS = 1 << 6, - // If present, try to download the resource to a standalone file. - // This hint tells the http cache to provide a native file handle - // of the cached file to the renderer process. - LOAD_ENABLE_DOWNLOAD_FILE = 1 << 7, - // If present, ignores certificate mismatches with the domain name. // (The default behavior is to trigger an OnSSLCertificateError callback.) LOAD_IGNORE_CERT_COMMON_NAME_INVALID = 1 << 8, diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index 2fbcfa9..bd510c0 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -1310,18 +1310,15 @@ TEST_F(DiskCacheTest, MultipleInstances) { ScopedTestCache store2(L"cache_test2"); ScopedTestCache store3(L"cache_test3"); - const int kNumberOfCaches = 3; + const int kNumberOfCaches = 2; scoped_ptr<disk_cache::Backend> cache[kNumberOfCaches]; cache[0].reset(disk_cache::CreateCacheBackend(store1.path_wstring(), false, 0, net::DISK_CACHE)); cache[1].reset(disk_cache::CreateCacheBackend(store2.path_wstring(), false, 0, net::MEDIA_CACHE)); - cache[2].reset(disk_cache::CreateCacheBackend(store3.path_wstring(), false, 0, - net::TEMP_MEDIA_CACHE)); - ASSERT_TRUE(cache[0].get() != NULL && cache[1].get() != NULL && - cache[2].get() != NULL); + ASSERT_TRUE(cache[0].get() != NULL && cache[1].get() != NULL); std::string key("the first key"); disk_cache::Entry* entry; diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h index 5eb6d2c..de40554 100644 --- a/net/disk_cache/disk_cache.h +++ b/net/disk_cache/disk_cache.h @@ -12,7 +12,6 @@ #include <vector> #include "base/basictypes.h" -#include "base/platform_file.h" #include "base/time.h" #include "net/base/cache_type.h" #include "net/base/completion_callback.h" @@ -155,28 +154,6 @@ class Entry { net::CompletionCallback* completion_callback, bool truncate) = 0; - // Prepares a target stream as an external file, returns a corresponding - // base::PlatformFile if successful, returns base::kInvalidPlatformFileValue - // if fails. If this call returns a valid base::PlatformFile value (i.e. - // not base::kInvalidPlatformFileValue), there is no guarantee that the file - // is truncated. Implementor can always return base::kInvalidPlatformFileValue - // if external file is not available in that particular implementation. - // The caller should close the file handle returned by this method or there - // will be a leak. - // With a stream prepared as an external file, the stream would always be - // kept in an external file since creation, even if the stream has 0 bytes. - // So we need to be cautious about using this option for preparing a stream or - // we will end up having a lot of empty cache files. Calling this method also - // means that all data written to the stream will always be written to file - // directly *without* buffering. - virtual base::PlatformFile UseExternalFile(int index) = 0; - - // Returns an asynchronous read file handle for the cache stream referenced by - // |index|. Values other than base::kInvalidPlatformFileValue are successful - // and the file handle should be managed by the caller, i.e. the caller should - // close the handle after use or there will be a leak. - virtual base::PlatformFile GetPlatformFile(int index) = 0; - protected: virtual ~Entry() {} }; diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc index a000785..e0853b7 100644 --- a/net/disk_cache/entry_impl.cc +++ b/net/disk_cache/entry_impl.cc @@ -81,7 +81,6 @@ EntryImpl::EntryImpl(BackendImpl* backend, Addr address) backend_ = backend; for (int i = 0; i < NUM_STREAMS; i++) { unreported_size_[i] = 0; - need_file_[i] = false; } } @@ -303,9 +302,7 @@ int EntryImpl::WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, backend_->OnEvent(Stats::WRITE_DATA); - // If we have prepared the cache as an external file, we should never use - // user_buffers_ and always write to file directly. - if (!need_file_[index] && user_buffers_[index].get()) { + if (user_buffers_[index].get()) { // Complete the operation locally. if (!buf_len) return 0; @@ -354,43 +351,6 @@ int EntryImpl::WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, return (completed || !completion_callback) ? buf_len : net::ERR_IO_PENDING; } -base::PlatformFile EntryImpl::UseExternalFile(int index) { - DCHECK(index >= 0 && index < NUM_STREAMS); - - Addr address(entry_.Data()->data_addr[index]); - - // We will not prepare the cache file since the entry is already initialized, - // just return the platform file backing the cache. - if (address.is_initialized()) - return GetPlatformFile(index); - - if (!backend_->CreateExternalFile(&address)) - return base::kInvalidPlatformFileValue; - - entry_.Data()->data_addr[index] = address.value(); - entry_.Store(); - - // Set the flag for this stream so we never use user_buffer_. - // TODO(hclam): do we need to save this information to EntryStore? - need_file_[index] = true; - - return GetPlatformFile(index); -} - -base::PlatformFile EntryImpl::GetPlatformFile(int index) { - DCHECK(index >= 0 && index < NUM_STREAMS); - - Addr address(entry_.Data()->data_addr[index]); - if (!address.is_initialized() || !address.is_separate_file()) - return base::kInvalidPlatformFileValue; - - return base::CreatePlatformFile(backend_->GetFileName(address), - base::PLATFORM_FILE_OPEN | - base::PLATFORM_FILE_READ | - base::PLATFORM_FILE_ASYNC, - NULL); -} - uint32 EntryImpl::GetHash() { return entry_.Data()->hash; } @@ -675,15 +635,6 @@ bool EntryImpl::PrepareTarget(int index, int offset, int buf_len, bool truncate) { Addr address(entry_.Data()->data_addr[index]); - // If we are instructed to use an external file, we should never buffer when - // writing. We are done with preparation of the target automatically, since - // we have already created the external file for writing. - if (need_file_[index]) { - // Make sure the stream is initialized and is kept in an external file. - DCHECK(address.is_initialized() && address.is_separate_file()); - return true; - } - if (address.is_initialized() || user_buffers_[index].get()) return GrowUserBuffer(index, offset, buf_len, truncate); diff --git a/net/disk_cache/entry_impl.h b/net/disk_cache/entry_impl.h index 71a960a..39ba186 100644 --- a/net/disk_cache/entry_impl.h +++ b/net/disk_cache/entry_impl.h @@ -33,8 +33,6 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, net::CompletionCallback* completion_callback, bool truncate); - virtual base::PlatformFile UseExternalFile(int index); - virtual base::PlatformFile GetPlatformFile(int index); inline CacheEntryBlock* entry() { return &entry_; @@ -146,8 +144,6 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { // data and key. int unreported_size_[NUM_STREAMS]; // Bytes not reported yet to the backend. bool doomed_; // True if this entry was removed from the cache. - bool need_file_[NUM_STREAMS]; // True if stream is prepared as an external - // file. DISALLOW_EVIL_CONSTRUCTORS(EntryImpl); }; diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index a79b3f7..e48acb5 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc @@ -832,102 +832,3 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyDoomedEntry) { InitCache(); DoomEntry(); } - -// Check that we can hint an entry to use external file and the return value -// is a valid file handle. -TEST_F(DiskCacheEntryTest, UseExternalFile) { - InitCache(); - - disk_cache::Entry* entry; - ASSERT_TRUE(cache_->CreateEntry("key", &entry)); - base::PlatformFile cache_file = entry->UseExternalFile(0); - - // We should have a valid file handle. - EXPECT_NE(base::kInvalidPlatformFileValue, cache_file); - scoped_refptr<disk_cache::File> file(new disk_cache::File(cache_file)); - - // 4KB. - size_t kDataSize = 0x1000; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kDataSize); - - CacheTestFillBuffer(buffer->data(), kDataSize, false); - ASSERT_EQ(0U, file->GetLength()); - ASSERT_EQ(kDataSize, static_cast<size_t>( - entry->WriteData(0, 0, buffer, kDataSize, NULL, false))); - ASSERT_EQ(kDataSize, file->GetLength()); - entry->Close(); -} - -// Make sure we can use Entry::GetPlatformFile on an entry stored in an external -// file and get a valid file handle. -TEST_F(DiskCacheEntryTest, GetPlatformFile) { - InitCache(); - - disk_cache::Entry* entry; - ASSERT_TRUE(cache_->CreateEntry("key", &entry)); - EXPECT_NE(base::kInvalidPlatformFileValue, entry->UseExternalFile(0)); - - size_t kDataSize = 50; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kDataSize); - - // Fill the data buffer and write it to cache. - CacheTestFillBuffer(buffer->data(), kDataSize, false); - ASSERT_EQ(kDataSize,static_cast<size_t>( - entry->WriteData(0, 0, buffer, kDataSize, NULL, false))); - - // Close the entry. - entry->Close(); - - // Open the entry again and get it's file handle. - ASSERT_TRUE(cache_->OpenEntry("key", &entry)); - base::PlatformFile cache_file = entry->GetPlatformFile(0); - - // Make sure it's a valid file handle and verify the size of the file. - scoped_refptr<disk_cache::File> file(new disk_cache::File(cache_file)); - ASSERT_EQ(kDataSize, file->GetLength()); - - entry->Close(); -} - -// Test the behavior of EntryImpl that small entries are kept in block files -// or buffer, and only entries above certain size would be stored in an -// external file, make sure GetPlatformFile() works with both cases without -// using UseExternalFile(). -TEST_F(DiskCacheEntryTest, GetPlatformFileVariableEntrySize) { - InitCache(); - - disk_cache::Entry* entry; - - // Make the buffer just larger than disk_cache::kMaxBlockSize. - const size_t kLargeDataSize = disk_cache::kMaxBlockSize + 1; - const size_t kSmallDataSize = kLargeDataSize / 2; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kLargeDataSize); - - // 1. First test with small entry. - ASSERT_TRUE(cache_->CreateEntry("small_entry", &entry)); - - CacheTestFillBuffer(buffer->data(), kSmallDataSize, false); - ASSERT_EQ(kSmallDataSize, static_cast<size_t>( - entry->WriteData(0, 0, buffer, kSmallDataSize, NULL, false))); - - // Make sure we don't get an external file. - ASSERT_EQ(base::kInvalidPlatformFileValue, entry->GetPlatformFile(0)); - - entry->Close(); - - // 2. Test with large entry. - ASSERT_TRUE(cache_->CreateEntry("large_entry", &entry)); - - CacheTestFillBuffer(buffer->data(), kLargeDataSize, false); - ASSERT_EQ(kLargeDataSize, static_cast<size_t>( - entry->WriteData(0, 0, buffer, kLargeDataSize, NULL, false))); - - base::PlatformFile cache_file = entry->GetPlatformFile(0); - EXPECT_NE(base::kInvalidPlatformFileValue, cache_file); - - // Make sure it's a valid file handle and verify the size of the file. - scoped_refptr<disk_cache::File> file(new disk_cache::File(cache_file)); - ASSERT_EQ(kLargeDataSize, file->GetLength()); - - entry->Close(); -} diff --git a/net/disk_cache/histogram_macros.h b/net/disk_cache/histogram_macros.h index ef88ccf..6ff66ea 100644 --- a/net/disk_cache/histogram_macros.h +++ b/net/disk_cache/histogram_macros.h @@ -56,9 +56,6 @@ case net::MEDIA_CACHE:\ UMA_HISTOGRAM_##type(my_name.data(), sample);\ break;\ - case net::TEMP_MEDIA_CACHE:\ - UMA_HISTOGRAM_##type(my_name.data(), sample);\ - break;\ default:\ NOTREACHED();\ break;\ diff --git a/net/disk_cache/mem_entry_impl.h b/net/disk_cache/mem_entry_impl.h index f51bf601..42fad96 100644 --- a/net/disk_cache/mem_entry_impl.h +++ b/net/disk_cache/mem_entry_impl.h @@ -29,14 +29,6 @@ class MemEntryImpl : public Entry { virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, net::CompletionCallback* completion_callback, bool truncate); - virtual base::PlatformFile UseExternalFile(int index) { - // MemEntryImpl doesn't support caching to an external file. - return base::kInvalidPlatformFileValue; - } - virtual base::PlatformFile GetPlatformFile(int index) { - // MemEntryImpl doesn't support caching to an external file. - return base::kInvalidPlatformFileValue; - } // Performs the initialization of a EntryImpl that will be added to the // cache. diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index 1beb36f..48178a6 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -587,15 +587,6 @@ void HttpCache::Transaction::SetRequest(const HttpRequestInfo* request) { if (cache_->mode() == RECORD) effective_load_flags_ |= LOAD_BYPASS_CACHE; - // If HttpCache has type MEDIA make sure LOAD_ENABLE_DOWNLOAD_FILE is set, - // otherwise make sure LOAD_ENABLE_DOWNLOAD_FILE is not set when HttpCache - // has type other than MEDIA. - if (cache_->type() == MEDIA_CACHE) { - DCHECK(effective_load_flags_ & LOAD_ENABLE_DOWNLOAD_FILE); - } else { - DCHECK(!(effective_load_flags_ & LOAD_ENABLE_DOWNLOAD_FILE)); - } - // Some headers imply load flags. The order here is significant. // // LOAD_DISABLE_CACHE : no cache read or write @@ -786,14 +777,6 @@ int HttpCache::Transaction::ReadResponseInfoFromEntry() { if (!HttpCache::ReadResponseInfo(entry_->disk_entry, &response_)) return ERR_CACHE_READ_FAILURE; - - // If the cache object is used for media file, we want the file handle of - // response data. - if (cache_->type() == MEDIA_CACHE) { - response_.response_data_file = - entry_->disk_entry->GetPlatformFile(kResponseContentIndex); - } - return OK; } @@ -854,20 +837,6 @@ void HttpCache::Transaction::TruncateResponseData() { if (!entry_) return; - // If the cache is for media files, we try to prepare the response data - // file as an external file and truncate it afterwards. - // Recipient of ResponseInfo should judge from |response_.response_data_file| - // to tell whether an external file of response data is available for reading - // or not. - // TODO(hclam): we should prepare the target stream as extern file only - // if we get a valid response from server, i.e. 200. We don't want empty - // cache files for redirection or external files for erroneous requests. - response_.response_data_file = base::kInvalidPlatformFileValue; - if (cache_->type() == MEDIA_CACHE) { - response_.response_data_file = - entry_->disk_entry->UseExternalFile(kResponseContentIndex); - } - // Truncate the stream. WriteToEntry(kResponseContentIndex, 0, NULL, 0); } diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index 7f84a36..ef127a2 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -6,7 +6,6 @@ #include "base/hash_tables.h" #include "base/message_loop.h" -#include "base/platform_file.h" #include "base/string_util.h" #include "net/base/net_errors.h" #include "net/base/load_flags.h" @@ -28,11 +27,11 @@ class MockDiskEntry : public disk_cache::Entry, public base::RefCounted<MockDiskEntry> { public: MockDiskEntry() - : test_mode_(0), doomed_(false), platform_file_(global_platform_file_) { + : test_mode_(0), doomed_(false) { } MockDiskEntry(const std::string& key) - : key_(key), doomed_(false), platform_file_(global_platform_file_) { + : key_(key), doomed_(false) { // // 'key' is prefixed with an identifier if it corresponds to a cached POST. // Skip past that to locate the actual URL. @@ -117,18 +116,6 @@ class MockDiskEntry : public disk_cache::Entry, return buf_len; } - base::PlatformFile UseExternalFile(int index) { - return platform_file_; - } - - base::PlatformFile GetPlatformFile(int index) { - return platform_file_; - } - - static void set_global_platform_file(base::PlatformFile platform_file) { - global_platform_file_ = platform_file; - } - private: // Unlike the callbacks for MockHttpTransaction, we want this one to run even // if the consumer called Close on the MockDiskEntry. We achieve that by @@ -145,13 +132,8 @@ class MockDiskEntry : public disk_cache::Entry, std::vector<char> data_[2]; int test_mode_; bool doomed_; - base::PlatformFile platform_file_; - static base::PlatformFile global_platform_file_; }; -base::PlatformFile MockDiskEntry::global_platform_file_ = - base::kInvalidPlatformFileValue; - class MockDiskCache : public disk_cache::Backend { public: MockDiskCache() : open_count_(0), create_count_(0), fail_requests_(0) { @@ -1257,79 +1239,3 @@ TEST(HttpCache, OutlivedTransactions) { delete cache; delete trans; } - -// Make sure Entry::UseExternalFile is called when a new entry is created in -// a HttpCache with MEDIA type. Also make sure Entry::GetPlatformFile is called -// when an entry is loaded from a HttpCache with MEDIA type. Also confirm we -// will receive a file handle in ResponseInfo from a media cache. -TEST(HttpCache, SimpleGET_MediaCache) { - // Initialize the HttpCache with MEDIA_CACHE type. - MockHttpCache cache; - cache.http_cache()->set_type(net::MEDIA_CACHE); - - // Define some fake file handles for testing. - base::PlatformFile kFakePlatformFile1, kFakePlatformFile2; -#if defined(OS_WIN) - kFakePlatformFile1 = reinterpret_cast<base::PlatformFile>(1); - kFakePlatformFile2 = reinterpret_cast<base::PlatformFile>(2); -#else - kFakePlatformFile1 = 1; - kFakePlatformFile2 = 2; -#endif - - ScopedMockTransaction trans_info(kSimpleGET_Transaction); - trans_info.load_flags |= net::LOAD_ENABLE_DOWNLOAD_FILE; - TestCompletionCallback callback; - - { - // Set the fake file handle to MockDiskEntry so cache is written with an - // entry created with our fake file handle. - MockDiskEntry::set_global_platform_file(kFakePlatformFile1); - - scoped_ptr<net::HttpTransaction> trans( - cache.http_cache()->CreateTransaction()); - ASSERT_TRUE(trans.get()); - - MockHttpRequest request(trans_info); - - int rv = trans->Start(&request, &callback); - if (rv == net::ERR_IO_PENDING) - rv = callback.WaitForResult(); - ASSERT_EQ(net::OK, rv); - - const net::HttpResponseInfo* response = trans->GetResponseInfo(); - ASSERT_TRUE(response); - - ASSERT_EQ(kFakePlatformFile1, response->response_data_file); - - ReadAndVerifyTransaction(trans.get(), trans_info); - } - - // Load only from cache so we would get the same file handle. - trans_info.load_flags |= net::LOAD_ONLY_FROM_CACHE; - - { - // Set a different file handle value to MockDiskEntry so any new entry - // created in the cache won't have the same file handle value. - MockDiskEntry::set_global_platform_file(kFakePlatformFile2); - - scoped_ptr<net::HttpTransaction> trans( - cache.http_cache()->CreateTransaction()); - ASSERT_TRUE(trans.get()); - - MockHttpRequest request(trans_info); - - int rv = trans->Start(&request, &callback); - if (rv == net::ERR_IO_PENDING) - rv = callback.WaitForResult(); - ASSERT_EQ(net::OK, rv); - - const net::HttpResponseInfo* response = trans->GetResponseInfo(); - ASSERT_TRUE(response); - - // Make sure we get the same file handle as in the first request. - ASSERT_EQ(kFakePlatformFile1, response->response_data_file); - - ReadAndVerifyTransaction(trans.get(), trans_info); - } -} diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 0dcb91e..c8435d2f 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -2598,8 +2598,6 @@ TEST_F(HttpNetworkTransactionTest, ResetStateForRestart) { EXPECT_EQ(NULL, trans->response_.auth_challenge.get()); EXPECT_EQ(NULL, trans->response_.headers.get()); EXPECT_EQ(false, trans->response_.was_cached); - EXPECT_EQ(base::kInvalidPlatformFileValue, - trans->response_.response_data_file); EXPECT_EQ(0, trans->response_.ssl_info.cert_status); EXPECT_FALSE(trans->response_.vary_data.is_valid()); } diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc index a94aa91..bc2fbe3 100644 --- a/net/http/http_response_info.cc +++ b/net/http/http_response_info.cc @@ -8,7 +8,7 @@ namespace net { HttpResponseInfo::HttpResponseInfo() - : was_cached(false), response_data_file(base::kInvalidPlatformFileValue) { + : was_cached(false) { } HttpResponseInfo::~HttpResponseInfo() { diff --git a/net/http/http_response_info.h b/net/http/http_response_info.h index d2803d1..88f89e7 100644 --- a/net/http/http_response_info.h +++ b/net/http/http_response_info.h @@ -5,7 +5,6 @@ #ifndef NET_HTTP_HTTP_RESPONSE_INFO_H_ #define NET_HTTP_HTTP_RESPONSE_INFO_H_ -#include "base/platform_file.h" #include "base/time.h" #include "net/base/auth.h" #include "net/base/ssl_info.h" @@ -50,10 +49,6 @@ class HttpResponseInfo { // The "Vary" header data for this response. HttpVaryData vary_data; - - // Platform specific file handle to the response data, if response data is - // not in a standalone file, its value is base::kInvalidPlatformFileValue. - base::PlatformFile response_data_file; }; } // namespace net diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index 7798fa7..16a3286 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -333,13 +333,6 @@ class URLRequest { return response_info_.ssl_info; } - // Returns the platform specific file handle for the standalone file that - // contains response data. base::kInvalidPlatformFileValue is returned if - // such file is not available. - base::PlatformFile response_data_file() { - return response_info_.response_data_file; - } - // Returns the cookie values included in the response, if the request is one // that can have cookies. Returns true if the request is a cookie-bearing // type, false otherwise. This method may only be called once the diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc index 7941424..67f4fb2 100644 --- a/net/url_request/url_request_file_job.cc +++ b/net/url_request/url_request_file_job.cc @@ -184,24 +184,6 @@ bool URLRequestFileJob::GetMimeType(std::string* mime_type) const { return net::GetMimeTypeFromFile(file_path_, mime_type); } -void URLRequestFileJob::GetResponseInfo(net::HttpResponseInfo* info) { - DCHECK(request_); - - // If we have enabled downloading the file, the requester expects to receive - // a file handle to the file. Since we are serving file:/// url requests we - // can provide such a handle if the file exists. - bool created; - if ((request_->load_flags() & net::LOAD_ENABLE_DOWNLOAD_FILE) && - stream_.IsOpen()) { - info->response_data_file = - base::CreatePlatformFile(file_path_.ToWStringHack(), - base::PLATFORM_FILE_OPEN | - base::PLATFORM_FILE_READ | - base::PLATFORM_FILE_ASYNC, - &created); - } -} - void URLRequestFileJob::SetExtraRequestHeaders(const std::string& headers) { // We only care about "Range" header here. std::vector<net::HttpByteRange> ranges; diff --git a/net/url_request/url_request_file_job.h b/net/url_request/url_request_file_job.h index 108a7cf..f7da8c1 100644 --- a/net/url_request/url_request_file_job.h +++ b/net/url_request/url_request_file_job.h @@ -31,7 +31,6 @@ class URLRequestFileJob : public URLRequestJob { virtual bool GetContentEncodings( std::vector<Filter::FilterType>* encoding_type); virtual bool GetMimeType(std::string* mime_type) const; - virtual void GetResponseInfo(net::HttpResponseInfo* info); virtual void SetExtraRequestHeaders(const std::string& headers); static URLRequest::ProtocolFactory Factory; |