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

Side by Side Diff: storage/browser/fileapi/sandbox_directory_database.cc

Issue 602043002: FileSystem: Make SandboxDirectoryDatabase::DestroyDatabase non-static for cleanup (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: remake Created 6 years, 2 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
« no previous file with comments | « storage/browser/fileapi/sandbox_directory_database.h ('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) 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 "storage/browser/fileapi/sandbox_directory_database.h" 5 #include "storage/browser/fileapi/sandbox_directory_database.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <set> 9 #include <set>
10 #include <stack> 10 #include <stack>
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 HandleError(FROM_HERE, status); 694 HandleError(FROM_HERE, status);
695 return false; 695 return false;
696 } 696 }
697 // The database must not yet exist; initialize it. 697 // The database must not yet exist; initialize it.
698 if (!StoreDefaultValues()) 698 if (!StoreDefaultValues())
699 return false; 699 return false;
700 700
701 return GetNextInteger(next); 701 return GetNextInteger(next);
702 } 702 }
703 703
704 // static 704 bool SandboxDirectoryDatabase::DestroyDatabase() {
705 bool SandboxDirectoryDatabase::DestroyDatabase(const base::FilePath& path, 705 db_.reset();
706 leveldb::Env* env_override) { 706 const std::string path =
707 std::string name = FilePathToString(path.Append(kDirectoryDatabaseName)); 707 FilePathToString(filesystem_data_directory_.Append(
708 kDirectoryDatabaseName));
708 leveldb::Options options; 709 leveldb::Options options;
709 if (env_override) 710 if (env_override_)
710 options.env = env_override; 711 options.env = env_override_;
711 leveldb::Status status = leveldb::DestroyDB(name, options); 712 leveldb::Status status = leveldb::DestroyDB(path, options);
712 if (status.ok()) 713 if (status.ok())
713 return true; 714 return true;
714 LOG(WARNING) << "Failed to destroy a database with status " << 715 LOG(WARNING) << "Failed to destroy a database with status " <<
715 status.ToString(); 716 status.ToString();
716 return false; 717 return false;
717 } 718 }
718 719
719 bool SandboxDirectoryDatabase::Init(RecoveryOption recovery_option) { 720 bool SandboxDirectoryDatabase::Init(RecoveryOption recovery_option) {
720 if (db_) 721 if (db_)
721 return true; 722 return true;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 931
931 void SandboxDirectoryDatabase::HandleError( 932 void SandboxDirectoryDatabase::HandleError(
932 const tracked_objects::Location& from_here, 933 const tracked_objects::Location& from_here,
933 const leveldb::Status& status) { 934 const leveldb::Status& status) {
934 LOG(ERROR) << "SandboxDirectoryDatabase failed at: " 935 LOG(ERROR) << "SandboxDirectoryDatabase failed at: "
935 << from_here.ToString() << " with error: " << status.ToString(); 936 << from_here.ToString() << " with error: " << status.ToString();
936 db_.reset(); 937 db_.reset();
937 } 938 }
938 939
939 } // namespace storage 940 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/fileapi/sandbox_directory_database.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698