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

Side by Side Diff: chrome/browser/chromeos/drive/file_cache_metadata.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/drive/file_cache_metadata.h" 5 #include "chrome/browser/chromeos/drive/file_cache_metadata.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_enumerator.h" 9 #include "base/files/file_enumerator.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 FileCacheMetadata::~FileCacheMetadata() { 90 FileCacheMetadata::~FileCacheMetadata() {
91 AssertOnSequencedWorkerPool(); 91 AssertOnSequencedWorkerPool();
92 } 92 }
93 93
94 FileCacheMetadata::InitializeResult FileCacheMetadata::Initialize( 94 FileCacheMetadata::InitializeResult FileCacheMetadata::Initialize(
95 const base::FilePath& db_path) { 95 const base::FilePath& db_path) {
96 AssertOnSequencedWorkerPool(); 96 AssertOnSequencedWorkerPool();
97 97
98 bool created = !file_util::PathExists(db_path); 98 bool created = !base::PathExists(db_path);
99 99
100 leveldb::DB* level_db = NULL; 100 leveldb::DB* level_db = NULL;
101 leveldb::Options options; 101 leveldb::Options options;
102 options.create_if_missing = true; 102 options.create_if_missing = true;
103 leveldb::Status db_status = leveldb::DB::Open(options, db_path.AsUTF8Unsafe(), 103 leveldb::Status db_status = leveldb::DB::Open(options, db_path.AsUTF8Unsafe(),
104 &level_db); 104 &level_db);
105 105
106 // Delete the db and scan the physical cache. This will fix a corrupt db, but 106 // Delete the db and scan the physical cache. This will fix a corrupt db, but
107 // perhaps not other causes of failed DB::Open. 107 // perhaps not other causes of failed DB::Open.
108 DBOpenStatus uma_status = DB_OPEN_SUCCESS; 108 DBOpenStatus uma_status = DB_OPEN_SUCCESS;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 return make_scoped_ptr(new Iterator(iter.Pass())); 181 return make_scoped_ptr(new Iterator(iter.Pass()));
182 } 182 }
183 183
184 void FileCacheMetadata::AssertOnSequencedWorkerPool() { 184 void FileCacheMetadata::AssertOnSequencedWorkerPool() {
185 DCHECK(!blocking_task_runner_.get() || 185 DCHECK(!blocking_task_runner_.get() ||
186 blocking_task_runner_->RunsTasksOnCurrentThread()); 186 blocking_task_runner_->RunsTasksOnCurrentThread());
187 } 187 }
188 188
189 } // namespace internal 189 } // namespace internal
190 } // namespace drive 190 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_cache.cc ('k') | chrome/browser/chromeos/drive/file_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698