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

Side by Side Diff: third_party/WebKit/public/platform/WebFileSystem.h

Issue 1851293002: Remove BLINK_ASSERT() and BLINK_ASSERT_NOT_REACHED() macros. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check the |callbacks| for nullptr and use explicit delete. Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 // Indicates a non-sandboxed filesystem. 53 // Indicates a non-sandboxed filesystem.
54 TypeExternal, 54 TypeExternal,
55 }; 55 };
56 56
57 // Opens a FileSystem. 57 // Opens a FileSystem.
58 // WebFileSystemCallbacks::didOpenFileSystem() must be called with 58 // WebFileSystemCallbacks::didOpenFileSystem() must be called with
59 // a name and root path for the requested FileSystem when the operation 59 // a name and root path for the requested FileSystem when the operation
60 // is completed successfully. WebFileSystemCallbacks::didFail() must be 60 // is completed successfully. WebFileSystemCallbacks::didFail() must be
61 // called otherwise. 61 // called otherwise.
62 virtual void openFileSystem(const WebURL& storagePartition, const WebFileSys temType, WebFileSystemCallbacks) { BLINK_ASSERT_NOT_REACHED(); } 62 virtual void openFileSystem(const WebURL& storagePartition, const WebFileSys temType, WebFileSystemCallbacks) = 0;
63 63
64 // Resolves a filesystem URL. 64 // Resolves a filesystem URL.
65 // WebFileSystemCallbacks::didSucceed() must be called with filesystem 65 // WebFileSystemCallbacks::didSucceed() must be called with filesystem
66 // information (name, root path and type) and file metadata (file path and 66 // information (name, root path and type) and file metadata (file path and
67 // file type) when the operation is completed successfully. 67 // file type) when the operation is completed successfully.
68 // WebFileSystemCallbacks::didFail() must be called otherwise. 68 // WebFileSystemCallbacks::didFail() must be called otherwise.
69 virtual void resolveURL(const WebURL& fileSystemURL, WebFileSystemCallbacks) { BLINK_ASSERT_NOT_REACHED(); } 69 virtual void resolveURL(const WebURL& fileSystemURL, WebFileSystemCallbacks) = 0;
70 70
71 // Deletes FileSystem. 71 // Deletes FileSystem.
72 // WebFileSystemCallbacks::didSucceed() must be called when the operation 72 // WebFileSystemCallbacks::didSucceed() must be called when the operation
73 // is completed successfully. WebFileSystemCallbacks::didFail() must be 73 // is completed successfully. WebFileSystemCallbacks::didFail() must be
74 // called otherwise. 74 // called otherwise.
75 // All in-flight operations and following operations may fail after the 75 // All in-flight operations and following operations may fail after the
76 // FileSystem is deleted. 76 // FileSystem is deleted.
77 virtual void deleteFileSystem(const WebURL& storagePartition, const WebFileS ystemType, WebFileSystemCallbacks) { } 77 virtual void deleteFileSystem(const WebURL& storagePartition, const WebFileS ystemType, WebFileSystemCallbacks) { }
78 78
79 // Moves a file or directory at |srcPath| to |destPath|. 79 // Moves a file or directory at |srcPath| to |destPath|.
80 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. 80 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully.
81 // WebFileSystemCallbacks::didFail() must be called otherwise. 81 // WebFileSystemCallbacks::didFail() must be called otherwise.
82 virtual void move(const WebURL& srcPath, const WebURL& destPath, WebFileSyst emCallbacks) { BLINK_ASSERT_NOT_REACHED(); } 82 virtual void move(const WebURL& srcPath, const WebURL& destPath, WebFileSyst emCallbacks) = 0;
83 83
84 // Copies a file or directory at |srcPath| to |destPath|. 84 // Copies a file or directory at |srcPath| to |destPath|.
85 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. 85 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully.
86 // WebFileSystemCallbacks::didFail() must be called otherwise. 86 // WebFileSystemCallbacks::didFail() must be called otherwise.
87 virtual void copy(const WebURL& srcPath, const WebURL& destPath, WebFileSyst emCallbacks) { BLINK_ASSERT_NOT_REACHED(); } 87 virtual void copy(const WebURL& srcPath, const WebURL& destPath, WebFileSyst emCallbacks) = 0;
88 88
89 // Deletes a file or directory at a given |path|. 89 // Deletes a file or directory at a given |path|.
90 // It is an error to try to remove a directory that is not empty. 90 // It is an error to try to remove a directory that is not empty.
91 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. 91 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully.
92 // WebFileSystemCallbacks::didFail() must be called otherwise. 92 // WebFileSystemCallbacks::didFail() must be called otherwise.
93 virtual void remove(const WebURL& path, WebFileSystemCallbacks) { BLINK_ASSE RT_NOT_REACHED(); } 93 virtual void remove(const WebURL& path, WebFileSystemCallbacks) = 0;
94 94
95 // Deletes a file or directory recursively at a given |path|. 95 // Deletes a file or directory recursively at a given |path|.
96 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. 96 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully.
97 // WebFileSystemCallbacks::didFail() must be called otherwise. 97 // WebFileSystemCallbacks::didFail() must be called otherwise.
98 virtual void removeRecursively(const WebURL& path, WebFileSystemCallbacks) { BLINK_ASSERT_NOT_REACHED(); } 98 virtual void removeRecursively(const WebURL& path, WebFileSystemCallbacks) = 0;
99 99
100 // Retrieves the metadata information of the file or directory at the given |path|. 100 // Retrieves the metadata information of the file or directory at the given |path|.
101 // This may not always return the local platform path in remote filesystem c ases. 101 // This may not always return the local platform path in remote filesystem c ases.
102 // WebFileSystemCallbacks::didReadMetadata() must be called with a valid met adata when the retrieval is completed successfully. 102 // WebFileSystemCallbacks::didReadMetadata() must be called with a valid met adata when the retrieval is completed successfully.
103 // WebFileSystemCallbacks::didFail() must be called otherwise. 103 // WebFileSystemCallbacks::didFail() must be called otherwise.
104 virtual void readMetadata(const WebURL& path, WebFileSystemCallbacks) { BLIN K_ASSERT_NOT_REACHED(); } 104 virtual void readMetadata(const WebURL& path, WebFileSystemCallbacks) = 0;
105 105
106 // Creates a file at given |path|. 106 // Creates a file at given |path|.
107 // If the |path| doesn't exist, it creates a new file at |path|. 107 // If the |path| doesn't exist, it creates a new file at |path|.
108 // If |exclusive| is true, it fails if the |path| already exists. 108 // If |exclusive| is true, it fails if the |path| already exists.
109 // If |exclusive| is false, it succeeds if the |path| already exists or 109 // If |exclusive| is false, it succeeds if the |path| already exists or
110 // it has successfully created a new file at |path|. 110 // it has successfully created a new file at |path|.
111 // 111 //
112 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. 112 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully.
113 // WebFileSystemCallbacks::didFail() must be called otherwise. 113 // WebFileSystemCallbacks::didFail() must be called otherwise.
114 virtual void createFile(const WebURL& path, bool exclusive, WebFileSystemCal lbacks) { BLINK_ASSERT_NOT_REACHED(); } 114 virtual void createFile(const WebURL& path, bool exclusive, WebFileSystemCal lbacks) = 0;
115 115
116 // Creates a directory at a given |path|. 116 // Creates a directory at a given |path|.
117 // If the |path| doesn't exist, it creates a new directory at |path|. 117 // If the |path| doesn't exist, it creates a new directory at |path|.
118 // If |exclusive| is true, it fails if the |path| already exists. 118 // If |exclusive| is true, it fails if the |path| already exists.
119 // If |exclusive| is false, it succeeds if the |path| already exists or it h as successfully created a new directory at |path|. 119 // If |exclusive| is false, it succeeds if the |path| already exists or it h as successfully created a new directory at |path|.
120 // 120 //
121 // WebFileSystemCallbacks::didSucceed() must be called when 121 // WebFileSystemCallbacks::didSucceed() must be called when
122 // the operation is completed successfully. 122 // the operation is completed successfully.
123 // WebFileSystemCallbacks::didFail() must be called otherwise. 123 // WebFileSystemCallbacks::didFail() must be called otherwise.
124 virtual void createDirectory(const WebURL& path, bool exclusive, WebFileSyst emCallbacks) { BLINK_ASSERT_NOT_REACHED(); } 124 virtual void createDirectory(const WebURL& path, bool exclusive, WebFileSyst emCallbacks) = 0;
125 125
126 // Checks if a file exists at a given |path|. 126 // Checks if a file exists at a given |path|.
127 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. 127 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully.
128 // WebFileSystemCallbacks::didFail() must be called otherwise. 128 // WebFileSystemCallbacks::didFail() must be called otherwise.
129 virtual void fileExists(const WebURL& path, WebFileSystemCallbacks) { BLINK_ ASSERT_NOT_REACHED(); } 129 virtual void fileExists(const WebURL& path, WebFileSystemCallbacks) = 0;
130 130
131 // Checks if a directory exists at a given |path|. 131 // Checks if a directory exists at a given |path|.
132 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. 132 // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully.
133 // WebFileSystemCallbacks::didFail() must be called otherwise. 133 // WebFileSystemCallbacks::didFail() must be called otherwise.
134 virtual void directoryExists(const WebURL& path, WebFileSystemCallbacks) { B LINK_ASSERT_NOT_REACHED(); } 134 virtual void directoryExists(const WebURL& path, WebFileSystemCallbacks) = 0 ;
135 135
136 // Reads directory entries of a given directory at |path| and returns a call backs ID which can be used to wait for additional results. 136 // Reads directory entries of a given directory at |path| and returns a call backs ID which can be used to wait for additional results.
137 // WebFileSystemCallbacks::didReadDirectory() must be called when the operat ion is completed successfully. 137 // WebFileSystemCallbacks::didReadDirectory() must be called when the operat ion is completed successfully.
138 // WebFileSystemCallbacks::didFail() must be called otherwise. 138 // WebFileSystemCallbacks::didFail() must be called otherwise.
139 virtual int readDirectory(const WebURL& path, WebFileSystemCallbacks) { BLIN K_ASSERT_NOT_REACHED(); return 0; } 139 virtual int readDirectory(const WebURL& path, WebFileSystemCallbacks) = 0;
140 140
141 // Creates a WebFileWriter that can be used to write to the given file. 141 // Creates a WebFileWriter that can be used to write to the given file.
142 // WebFileSystemCallbacks::didCreateFileWriter() must be called with the cre ated WebFileWriter when the operation is completed successfully. 142 // WebFileSystemCallbacks::didCreateFileWriter() must be called with the cre ated WebFileWriter when the operation is completed successfully.
143 // WebFileSystemCallbacks::didFail() must be called otherwise. 143 // WebFileSystemCallbacks::didFail() must be called otherwise.
144 virtual void createFileWriter(const WebURL& path, WebFileWriterClient*, WebF ileSystemCallbacks) { BLINK_ASSERT_NOT_REACHED(); } 144 virtual void createFileWriter(const WebURL& path, WebFileWriterClient*, WebF ileSystemCallbacks) = 0;
145 145
146 // Creates a snapshot file for a given file specified by |path|. It returns the metadata of the created snapshot file. 146 // Creates a snapshot file for a given file specified by |path|. It returns the metadata of the created snapshot file.
147 // The returned metadata should include a local platform path to the snapsho t image. 147 // The returned metadata should include a local platform path to the snapsho t image.
148 // In local filesystem cases the backend may simply return the metadata of t he file itself (as well as readMetadata does), while in 148 // In local filesystem cases the backend may simply return the metadata of t he file itself (as well as readMetadata does), while in
149 // remote filesystem case the backend may download the file into a temporary snapshot file and return the metadata of the temporary file. 149 // remote filesystem case the backend may download the file into a temporary snapshot file and return the metadata of the temporary file.
150 // The returned metadata is used to create a File object for the |path|. 150 // The returned metadata is used to create a File object for the |path|.
151 // The snapshot file is supposed to be deleted when the last reference to a blink::File referring to it's path is dropped. 151 // The snapshot file is supposed to be deleted when the last reference to a blink::File referring to it's path is dropped.
152 // WebFileSystemCallbacks::didCreateSnapshotFile() with the metadata of the snapshot file must be called when the operation is completed successfully. 152 // WebFileSystemCallbacks::didCreateSnapshotFile() with the metadata of the snapshot file must be called when the operation is completed successfully.
153 // WebFileSystemCallbacks::didFail() must be called otherwise. 153 // WebFileSystemCallbacks::didFail() must be called otherwise.
154 virtual void createSnapshotFileAndReadMetadata(const WebURL& path, WebFileSy stemCallbacks) { BLINK_ASSERT_NOT_REACHED(); } 154 virtual void createSnapshotFileAndReadMetadata(const WebURL& path, WebFileSy stemCallbacks) = 0;
155 155
156 // Waits for additional results returned for the method call and returns tru e if possible. 156 // Waits for additional results returned for the method call and returns tru e if possible.
157 // Returns false if there is no running method call corresponding for the gi ven ID. 157 // Returns false if there is no running method call corresponding for the gi ven ID.
158 // |callbacksId| must be the value returned by the original method call. 158 // |callbacksId| must be the value returned by the original method call.
159 virtual bool waitForAdditionalResult(int callbacksId) { BLINK_ASSERT_NOT_REA CHED(); return false; } 159 virtual bool waitForAdditionalResult(int callbacksId) = 0;
160 160
161 protected: 161 protected:
162 virtual ~WebFileSystem() { } 162 virtual ~WebFileSystem() { }
163 }; 163 };
164 164
165 } // namespace blink 165 } // namespace blink
166 166
167 #endif 167 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698