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

Side by Side Diff: chrome/browser/policy/cloud/resource_cache.cc

Issue 16950028: Move file_util::Delete to the 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) 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 "chrome/browser/policy/cloud/resource_cache.h" 5 #include "chrome/browser/policy/cloud/resource_cache.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 18 matching lines...) Expand all
29 file_util::CreateDirectory(cache_path.DirName()); 29 file_util::CreateDirectory(cache_path.DirName());
30 leveldb::Options options; 30 leveldb::Options options;
31 options.create_if_missing = true; 31 options.create_if_missing = true;
32 leveldb::DB* db = NULL; 32 leveldb::DB* db = NULL;
33 leveldb::Status status = 33 leveldb::Status status =
34 leveldb::DB::Open(options, cache_path.AsUTF8Unsafe(), &db); 34 leveldb::DB::Open(options, cache_path.AsUTF8Unsafe(), &db);
35 if (!status.ok()) { 35 if (!status.ok()) {
36 LOG(WARNING) << "Failed to open leveldb at " << cache_path.AsUTF8Unsafe() 36 LOG(WARNING) << "Failed to open leveldb at " << cache_path.AsUTF8Unsafe()
37 << ": " << status.ToString(); 37 << ": " << status.ToString();
38 // Maybe the database is busted; drop everything and try to create it again. 38 // Maybe the database is busted; drop everything and try to create it again.
39 file_util::Delete(cache_path, true); 39 base::Delete(cache_path, true);
40 status = leveldb::DB::Open(options, cache_path.AsUTF8Unsafe(), &db); 40 status = leveldb::DB::Open(options, cache_path.AsUTF8Unsafe(), &db);
41 41
42 if (!status.ok()) 42 if (!status.ok())
43 LOG(WARNING) << "Failed to open a new leveldb after wiping: " 43 LOG(WARNING) << "Failed to open a new leveldb after wiping: "
44 << status.ToString(); 44 << status.ToString();
45 } 45 }
46 db_.reset(db); 46 db_.reset(db);
47 } 47 }
48 48
49 ResourceCache::~ResourceCache() { 49 ResourceCache::~ResourceCache() {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 size = reinterpret_cast<const size_t*>(path.data() + offset - sizeof(size_t)); 179 size = reinterpret_cast<const size_t*>(path.data() + offset - sizeof(size_t));
180 if (*size != path.size() - offset) { 180 if (*size != path.size() - offset) {
181 NOTREACHED(); 181 NOTREACHED();
182 return EmptyString(); 182 return EmptyString();
183 } 183 }
184 184
185 return path.substr(offset, *size); 185 return path.substr(offset, *size);
186 } 186 }
187 187
188 } // namespace policy 188 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/pepper_flash_settings_manager.cc ('k') | chrome/browser/policy/cloud/user_cloud_policy_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698