OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 | 152 |
153 int chromiumCurrentTime(sqlite3_vfs *vfs, double *prNow) | 153 int chromiumCurrentTime(sqlite3_vfs *vfs, double *prNow) |
154 { | 154 { |
155 sqlite3_vfs* wrappedVfs = static_cast<sqlite3_vfs*>(vfs->pAppData); | 155 sqlite3_vfs* wrappedVfs = static_cast<sqlite3_vfs*>(vfs->pAppData); |
156 return wrappedVfs->xCurrentTime(wrappedVfs, prNow); | 156 return wrappedVfs->xCurrentTime(wrappedVfs, prNow); |
157 } | 157 } |
158 | 158 |
159 int chromiumGetLastError(sqlite3_vfs *vfs, int e, char* s) | 159 int chromiumGetLastError(sqlite3_vfs *vfs, int e, char* s) |
160 { | 160 { |
161 sqlite3_vfs* wrappedVfs = static_cast<sqlite3_vfs*>(vfs->pAppData); | 161 // xGetLastError() has never been used by SQLite. The implementation in os_
win.c indicates this is a reasonable implementation. |
162 return wrappedVfs->xGetLastError(wrappedVfs, e, s); | 162 *s = '\0'; |
| 163 return 0; |
163 } | 164 } |
164 | 165 |
165 } // namespace | 166 } // namespace |
166 | 167 |
167 void SQLiteFileSystem::registerSQLiteVFS() | 168 void SQLiteFileSystem::registerSQLiteVFS() |
168 { | 169 { |
169 sqlite3_vfs* wrappedVfs = sqlite3_vfs_find("win32"); | 170 sqlite3_vfs* wrappedVfs = sqlite3_vfs_find("win32"); |
| 171 |
| 172 // These are implemented by delegating to |wrappedVfs|. |
| 173 // TODO(shess): Implement local versions. |
| 174 ASSERT(wrappedVfs->xRandomness); |
| 175 ASSERT(wrappedVfs->xSleep); |
| 176 ASSERT(wrappedVfs->xCurrentTime); |
| 177 |
170 static sqlite3_vfs chromium_vfs = { | 178 static sqlite3_vfs chromium_vfs = { |
171 1, | 179 1, |
172 wrappedVfs->szOsFile, | 180 wrappedVfs->szOsFile, |
173 wrappedVfs->mxPathname, | 181 wrappedVfs->mxPathname, |
174 0, | 182 0, |
175 "chromium_vfs", | 183 "chromium_vfs", |
176 wrappedVfs, | 184 wrappedVfs, |
177 chromiumOpen, | 185 chromiumOpen, |
178 chromiumDelete, | 186 chromiumDelete, |
179 chromiumAccess, | 187 chromiumAccess, |
180 chromiumFullPathname, | 188 chromiumFullPathname, |
181 chromiumDlOpen, | 189 chromiumDlOpen, |
182 chromiumDlError, | 190 chromiumDlError, |
183 chromiumDlSym, | 191 chromiumDlSym, |
184 chromiumDlClose, | 192 chromiumDlClose, |
185 chromiumRandomness, | 193 chromiumRandomness, |
186 chromiumSleep, | 194 chromiumSleep, |
187 chromiumCurrentTime, | 195 chromiumCurrentTime, |
188 chromiumGetLastError | 196 chromiumGetLastError |
189 }; | 197 }; |
190 sqlite3_vfs_register(&chromium_vfs, 0); | 198 sqlite3_vfs_register(&chromium_vfs, 0); |
191 } | 199 } |
192 | 200 |
193 } // namespace blink | 201 } // namespace blink |
OLD | NEW |