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

Side by Side Diff: net/disk_cache/simple/simple_backend_impl.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | « net/disk_cache/cache_util_unittest.cc ('k') | net/disk_cache/simple/simple_index_file.cc » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/simple/simple_backend_impl.h" 5 #include "net/disk_cache/simple/simple_backend_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdlib> 8 #include <cstdlib>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // There is a convention among disk cache backends: looking at the magic in the 87 // There is a convention among disk cache backends: looking at the magic in the
88 // file "index" it should be sufficient to determine if the cache belongs to the 88 // file "index" it should be sufficient to determine if the cache belongs to the
89 // currently running backend. The Simple Backend stores its index in the file 89 // currently running backend. The Simple Backend stores its index in the file
90 // "the-real-index" (see simple_index.cc) and the file "index" only signifies 90 // "the-real-index" (see simple_index.cc) and the file "index" only signifies
91 // presence of the implementation's magic and version. There are two reasons for 91 // presence of the implementation's magic and version. There are two reasons for
92 // that: 92 // that:
93 // 1. Absence of the index is itself not a fatal error in the Simple Backend 93 // 1. Absence of the index is itself not a fatal error in the Simple Backend
94 // 2. The Simple Backend has pickled file format for the index making it hacky 94 // 2. The Simple Backend has pickled file format for the index making it hacky
95 // to have the magic in the right place. 95 // to have the magic in the right place.
96 bool FileStructureConsistent(const base::FilePath& path) { 96 bool FileStructureConsistent(const base::FilePath& path) {
97 if (!file_util::PathExists(path) && !file_util::CreateDirectory(path)) { 97 if (!base::PathExists(path) && !file_util::CreateDirectory(path)) {
98 LOG(ERROR) << "Failed to create directory: " << path.LossyDisplayName(); 98 LOG(ERROR) << "Failed to create directory: " << path.LossyDisplayName();
99 return false; 99 return false;
100 } 100 }
101 const base::FilePath fake_index = path.AppendASCII("index"); 101 const base::FilePath fake_index = path.AppendASCII("index");
102 base::PlatformFileError error; 102 base::PlatformFileError error;
103 base::PlatformFile fake_index_file = base::CreatePlatformFile( 103 base::PlatformFile fake_index_file = base::CreatePlatformFile(
104 fake_index, 104 fake_index,
105 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, 105 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
106 NULL, 106 NULL,
107 &error); 107 &error);
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 const CompletionCallback& callback, 523 const CompletionCallback& callback,
524 int error_code) { 524 int error_code) {
525 if (error_code == net::ERR_FAILED) { 525 if (error_code == net::ERR_FAILED) {
526 OpenNextEntry(iter, entry, callback); 526 OpenNextEntry(iter, entry, callback);
527 return; 527 return;
528 } 528 }
529 CallCompletionCallback(callback, error_code); 529 CallCompletionCallback(callback, error_code);
530 } 530 }
531 531
532 } // namespace disk_cache 532 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/cache_util_unittest.cc ('k') | net/disk_cache/simple/simple_index_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698