Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: net/disk_cache/backend_impl.cc

Issue 1709: CreateDirectory() should check if an existing path is actually a directory... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/path_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/backend_impl.h" 5 #include "net/disk_cache/backend_impl.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/histogram.h" 8 #include "base/histogram.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 IndexHeader header; 723 IndexHeader header;
724 header.table_len = DesiredIndexTableLen(max_size_); 724 header.table_len = DesiredIndexTableLen(max_size_);
725 725
726 if (!file->Write(&header, sizeof(header), 0)) 726 if (!file->Write(&header, sizeof(header), 0))
727 return false; 727 return false;
728 728
729 return file->SetLength(GetIndexSize(header.table_len)); 729 return file->SetLength(GetIndexSize(header.table_len));
730 } 730 }
731 731
732 bool BackendImpl::InitBackingStore(bool* file_created) { 732 bool BackendImpl::InitBackingStore(bool* file_created) {
733 // This call fails if the folder exists.
734 file_util::CreateDirectory(path_); 733 file_util::CreateDirectory(path_);
735 734
736 std::wstring index_name(path_); 735 std::wstring index_name(path_);
737 file_util::AppendToPath(&index_name, kIndexName); 736 file_util::AppendToPath(&index_name, kIndexName);
738 737
739 scoped_refptr<disk_cache::File> file(new disk_cache::File( 738 scoped_refptr<disk_cache::File> file(new disk_cache::File(
740 CreateOSFile(index_name.c_str(), OS_FILE_READ | OS_FILE_WRITE | 739 CreateOSFile(index_name.c_str(), OS_FILE_READ | OS_FILE_WRITE |
741 OS_FILE_SHARE_READ | OS_FILE_OPEN_ALWAYS, file_created))); 740 OS_FILE_SHARE_READ | OS_FILE_OPEN_ALWAYS, file_created)));
742 741
743 if (!file->IsValid()) 742 if (!file->IsValid())
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 1104
1106 return num_dirty; 1105 return num_dirty;
1107 } 1106 }
1108 1107
1109 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) { 1108 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) {
1110 RankingsNode* rankings = cache_entry->rankings()->Data(); 1109 RankingsNode* rankings = cache_entry->rankings()->Data();
1111 return !rankings->pointer; 1110 return !rankings->pointer;
1112 } 1111 }
1113 1112
1114 } // namespace disk_cache 1113 } // namespace disk_cache
OLDNEW
« no previous file with comments | « base/path_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698