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

Side by Side Diff: webkit/browser/fileapi/sandbox_origin_database.h

Issue 145693005: [FileAPI] Replace default leveldb::Env with leveldb::MemEnv in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_H_
6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_H_ 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "webkit/browser/fileapi/sandbox_origin_database_interface.h" 13 #include "webkit/browser/fileapi/sandbox_origin_database_interface.h"
14 14
15 namespace leveldb { 15 namespace leveldb {
16 class DB; 16 class DB;
17 class Env;
17 class Status; 18 class Status;
18 } 19 }
19 20
20 namespace tracked_objects { 21 namespace tracked_objects {
21 class Location; 22 class Location;
22 } 23 }
23 24
24 namespace fileapi { 25 namespace fileapi {
25 26
26 // All methods of this class other than the constructor may be used only from 27 // All methods of this class other than the constructor may be used only from
27 // the browser's FILE thread. The constructor may be used on any thread. 28 // the browser's FILE thread. The constructor may be used on any thread.
28 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE SandboxOriginDatabase 29 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE SandboxOriginDatabase
29 : public SandboxOriginDatabaseInterface { 30 : public SandboxOriginDatabaseInterface {
30 public: 31 public:
31 // Only one instance of SandboxOriginDatabase should exist for a given path 32 // Only one instance of SandboxOriginDatabase should exist for a given path
32 // at a given time. 33 // at a given time.
33 explicit SandboxOriginDatabase(const base::FilePath& file_system_directory); 34 SandboxOriginDatabase(const base::FilePath& file_system_directory,
35 leveldb::Env* env_override);
34 virtual ~SandboxOriginDatabase(); 36 virtual ~SandboxOriginDatabase();
35 37
36 // SandboxOriginDatabaseInterface overrides. 38 // SandboxOriginDatabaseInterface overrides.
37 virtual bool HasOriginPath(const std::string& origin) OVERRIDE; 39 virtual bool HasOriginPath(const std::string& origin) OVERRIDE;
38 virtual bool GetPathForOrigin(const std::string& origin, 40 virtual bool GetPathForOrigin(const std::string& origin,
39 base::FilePath* directory) OVERRIDE; 41 base::FilePath* directory) OVERRIDE;
40 virtual bool RemovePathForOrigin(const std::string& origin) OVERRIDE; 42 virtual bool RemovePathForOrigin(const std::string& origin) OVERRIDE;
41 virtual bool ListAllOrigins(std::vector<OriginRecord>* origins) OVERRIDE; 43 virtual bool ListAllOrigins(std::vector<OriginRecord>* origins) OVERRIDE;
42 virtual void DropDatabase() OVERRIDE; 44 virtual void DropDatabase() OVERRIDE;
43 45
(...skipping 13 matching lines...) Expand all
57 }; 59 };
58 60
59 bool Init(InitOption init_option, RecoveryOption recovery_option); 61 bool Init(InitOption init_option, RecoveryOption recovery_option);
60 bool RepairDatabase(const std::string& db_path); 62 bool RepairDatabase(const std::string& db_path);
61 void HandleError(const tracked_objects::Location& from_here, 63 void HandleError(const tracked_objects::Location& from_here,
62 const leveldb::Status& status); 64 const leveldb::Status& status);
63 void ReportInitStatus(const leveldb::Status& status); 65 void ReportInitStatus(const leveldb::Status& status);
64 bool GetLastPathNumber(int* number); 66 bool GetLastPathNumber(int* number);
65 67
66 base::FilePath file_system_directory_; 68 base::FilePath file_system_directory_;
69 leveldb::Env* env_override_;
67 scoped_ptr<leveldb::DB> db_; 70 scoped_ptr<leveldb::DB> db_;
68 base::Time last_reported_time_; 71 base::Time last_reported_time_;
69 DISALLOW_COPY_AND_ASSIGN(SandboxOriginDatabase); 72 DISALLOW_COPY_AND_ASSIGN(SandboxOriginDatabase);
70 }; 73 };
71 74
72 } // namespace fileapi 75 } // namespace fileapi
73 76
74 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_H_ 77 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_H_
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/sandbox_file_system_backend_delegate.cc ('k') | webkit/browser/fileapi/sandbox_origin_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698