OLD | NEW |
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_ISOLATED_CONTEXT_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_ISOLATED_CONTEXT_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_ISOLATED_CONTEXT_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_ISOLATED_CONTEXT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 #include "webkit/browser/fileapi/mount_points.h" | 18 #include "storage/browser/fileapi/mount_points.h" |
19 #include "webkit/browser/webkit_storage_browser_export.h" | 19 #include "storage/common/storage_export.h" |
20 #include "webkit/common/fileapi/file_system_types.h" | 20 #include "storage/common/fileapi/file_system_types.h" |
21 | 21 |
22 namespace fileapi { | 22 namespace storage { |
23 class FileSystemURL; | 23 class FileSystemURL; |
24 } | 24 } |
25 | 25 |
26 namespace fileapi { | 26 namespace storage { |
27 | 27 |
28 // Manages isolated filesystem mount points which have no well-known names | 28 // Manages isolated filesystem mount points which have no well-known names |
29 // and are identified by a string 'filesystem ID', which usually just looks | 29 // and are identified by a string 'filesystem ID', which usually just looks |
30 // like random value. | 30 // like random value. |
31 // This type of filesystem can be created on the fly and may go away when it has | 31 // This type of filesystem can be created on the fly and may go away when it has |
32 // no references from renderers. | 32 // no references from renderers. |
33 // Files in an isolated filesystem are registered with corresponding names and | 33 // Files in an isolated filesystem are registered with corresponding names and |
34 // identified by a filesystem URL like: | 34 // identified by a filesystem URL like: |
35 // | 35 // |
36 // filesystem:<origin>/isolated/<filesystem_id>/<name>/relative/path | 36 // filesystem:<origin>/isolated/<filesystem_id>/<name>/relative/path |
37 // | 37 // |
38 // Some methods of this class are virtual just for mocking. | 38 // Some methods of this class are virtual just for mocking. |
39 // | 39 // |
40 class WEBKIT_STORAGE_BROWSER_EXPORT IsolatedContext : public MountPoints { | 40 class STORAGE_EXPORT IsolatedContext : public MountPoints { |
41 public: | 41 public: |
42 class WEBKIT_STORAGE_BROWSER_EXPORT FileInfoSet { | 42 class STORAGE_EXPORT FileInfoSet { |
43 public: | 43 public: |
44 FileInfoSet(); | 44 FileInfoSet(); |
45 ~FileInfoSet(); | 45 ~FileInfoSet(); |
46 | 46 |
47 // Add the given |path| to the set and populates |registered_name| with | 47 // Add the given |path| to the set and populates |registered_name| with |
48 // the registered name assigned for the path. |path| needs to be | 48 // the registered name assigned for the path. |path| needs to be |
49 // absolute and should not contain parent references. | 49 // absolute and should not contain parent references. |
50 // Return false if the |path| is not valid and could not be added. | 50 // Return false if the |path| is not valid and could not be added. |
51 bool AddPath(const base::FilePath& path, std::string* registered_name); | 51 bool AddPath(const base::FilePath& path, std::string* registered_name); |
52 | 52 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 // This lock needs to be obtained when accessing the instance_map_. | 190 // This lock needs to be obtained when accessing the instance_map_. |
191 mutable base::Lock lock_; | 191 mutable base::Lock lock_; |
192 | 192 |
193 IDToInstance instance_map_; | 193 IDToInstance instance_map_; |
194 PathToID path_to_id_map_; | 194 PathToID path_to_id_map_; |
195 | 195 |
196 DISALLOW_COPY_AND_ASSIGN(IsolatedContext); | 196 DISALLOW_COPY_AND_ASSIGN(IsolatedContext); |
197 }; | 197 }; |
198 | 198 |
199 } // namespace fileapi | 199 } // namespace storage |
200 | 200 |
201 #endif // WEBKIT_BROWSER_FILEAPI_ISOLATED_CONTEXT_H_ | 201 #endif // WEBKIT_BROWSER_FILEAPI_ISOLATED_CONTEXT_H_ |
OLD | NEW |