OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/disk_cache/entry_impl.h" | 5 #include "net/disk_cache/entry_impl.h" |
6 | 6 |
7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 return GetPlatformFile(index); | 372 return GetPlatformFile(index); |
373 } | 373 } |
374 | 374 |
375 base::PlatformFile EntryImpl::GetPlatformFile(int index) { | 375 base::PlatformFile EntryImpl::GetPlatformFile(int index) { |
376 DCHECK(index >= 0 && index < NUM_STREAMS); | 376 DCHECK(index >= 0 && index < NUM_STREAMS); |
377 | 377 |
378 Addr address(entry_.Data()->data_addr[index]); | 378 Addr address(entry_.Data()->data_addr[index]); |
379 if (!address.is_initialized() || !address.is_separate_file()) | 379 if (!address.is_initialized() || !address.is_separate_file()) |
380 return base::kInvalidPlatformFileValue; | 380 return base::kInvalidPlatformFileValue; |
381 | 381 |
382 File* cache_file = GetExternalFile(address, index); | 382 return base::CreatePlatformFile(backend_->GetFileName(address), |
383 if (!cache_file) | 383 base::PLATFORM_FILE_OPEN | |
384 return base::kInvalidPlatformFileValue; | 384 base::PLATFORM_FILE_READ | |
385 | 385 base::PLATFORM_FILE_ASYNC, |
386 return cache_file->platform_file(); | 386 NULL); |
387 } | 387 } |
388 | 388 |
389 uint32 EntryImpl::GetHash() { | 389 uint32 EntryImpl::GetHash() { |
390 return entry_.Data()->hash; | 390 return entry_.Data()->hash; |
391 } | 391 } |
392 | 392 |
393 bool EntryImpl::CreateEntry(Addr node_address, const std::string& key, | 393 bool EntryImpl::CreateEntry(Addr node_address, const std::string& key, |
394 uint32 hash) { | 394 uint32 hash) { |
395 Trace("Create entry In"); | 395 Trace("Create entry In"); |
396 EntryStore* entry_store = entry_.Data(); | 396 EntryStore* entry_store = entry_.Data(); |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), | 842 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), |
843 entry_.address().value(), node_.address().value()); | 843 entry_.address().value(), node_.address().value()); |
844 | 844 |
845 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], | 845 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], |
846 entry_.Data()->data_addr[1], entry_.Data()->long_key); | 846 entry_.Data()->data_addr[1], entry_.Data()->long_key); |
847 | 847 |
848 Trace(" doomed: %d 0x%p 0x%x", doomed_, pointer, dirty); | 848 Trace(" doomed: %d 0x%p 0x%x", doomed_, pointer, dirty); |
849 } | 849 } |
850 | 850 |
851 } // namespace disk_cache | 851 } // namespace disk_cache |
OLD | NEW |