| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "modules/webdatabase/DatabaseManager.h" | 26 #include "modules/webdatabase/DatabaseManager.h" |
| 27 | 27 |
| 28 #include "bindings/core/v8/ExceptionMessages.h" | 28 #include "bindings/core/v8/ExceptionMessages.h" |
| 29 #include "bindings/core/v8/ExceptionState.h" | 29 #include "bindings/core/v8/ExceptionState.h" |
| 30 #include "core/dom/ExceptionCode.h" | 30 #include "core/dom/ExceptionCode.h" |
| 31 #include "core/dom/ExecutionContext.h" | 31 #include "core/dom/ExecutionContext.h" |
| 32 #include "core/dom/ExecutionContextTask.h" | 32 #include "core/dom/ExecutionContextTask.h" |
| 33 #include "core/dom/TaskRunnerHelper.h" |
| 33 #include "core/inspector/ConsoleMessage.h" | 34 #include "core/inspector/ConsoleMessage.h" |
| 34 #include "modules/webdatabase/Database.h" | 35 #include "modules/webdatabase/Database.h" |
| 35 #include "modules/webdatabase/DatabaseCallback.h" | 36 #include "modules/webdatabase/DatabaseCallback.h" |
| 36 #include "modules/webdatabase/DatabaseClient.h" | 37 #include "modules/webdatabase/DatabaseClient.h" |
| 37 #include "modules/webdatabase/DatabaseContext.h" | 38 #include "modules/webdatabase/DatabaseContext.h" |
| 38 #include "modules/webdatabase/DatabaseTask.h" | 39 #include "modules/webdatabase/DatabaseTask.h" |
| 39 #include "modules/webdatabase/DatabaseTracker.h" | 40 #include "modules/webdatabase/DatabaseTracker.h" |
| 40 #include "modules/webdatabase/StorageLog.h" | 41 #include "modules/webdatabase/StorageLog.h" |
| 41 #include "platform/weborigin/SecurityOrigin.h" | 42 #include "platform/weborigin/SecurityOrigin.h" |
| 42 #include "public/platform/WebTraceLocation.h" | 43 #include "public/platform/WebTraceLocation.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 return nullptr; | 203 return nullptr; |
| 203 | 204 |
| 204 databaseContextFor(context)->setHasOpenDatabases(); | 205 databaseContextFor(context)->setHasOpenDatabases(); |
| 205 DatabaseClient::from(context)->didOpenDatabase( | 206 DatabaseClient::from(context)->didOpenDatabase( |
| 206 database, context->getSecurityOrigin()->host(), name, expectedVersion); | 207 database, context->getSecurityOrigin()->host(), name, expectedVersion); |
| 207 | 208 |
| 208 if (database->isNew() && creationCallback) { | 209 if (database->isNew() && creationCallback) { |
| 209 STORAGE_DVLOG(1) << "Scheduling DatabaseCreationCallbackTask for database " | 210 STORAGE_DVLOG(1) << "Scheduling DatabaseCreationCallbackTask for database " |
| 210 << database; | 211 << database; |
| 211 database->getExecutionContext()->postTask( | 212 database->getExecutionContext()->postTask( |
| 212 BLINK_FROM_HERE, createSameThreadTask(&databaseCallbackHandleEvent, | 213 TaskType::DatabaseAccess, BLINK_FROM_HERE, |
| 213 wrapPersistent(creationCallback), | 214 createSameThreadTask(&databaseCallbackHandleEvent, |
| 214 wrapPersistent(database)), | 215 wrapPersistent(creationCallback), |
| 216 wrapPersistent(database)), |
| 215 "openDatabase"); | 217 "openDatabase"); |
| 216 } | 218 } |
| 217 | 219 |
| 218 ASSERT(database); | 220 ASSERT(database); |
| 219 return database; | 221 return database; |
| 220 } | 222 } |
| 221 | 223 |
| 222 String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, | 224 String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, |
| 223 const String& name, | 225 const String& name, |
| 224 bool createIfDoesNotExist) { | 226 bool createIfDoesNotExist) { |
| 225 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, | 227 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, |
| 226 createIfDoesNotExist); | 228 createIfDoesNotExist); |
| 227 } | 229 } |
| 228 | 230 |
| 229 void DatabaseManager::logErrorMessage(ExecutionContext* context, | 231 void DatabaseManager::logErrorMessage(ExecutionContext* context, |
| 230 const String& message) { | 232 const String& message) { |
| 231 context->addConsoleMessage( | 233 context->addConsoleMessage( |
| 232 ConsoleMessage::create(StorageMessageSource, ErrorMessageLevel, message)); | 234 ConsoleMessage::create(StorageMessageSource, ErrorMessageLevel, message)); |
| 233 } | 235 } |
| 234 | 236 |
| 235 } // namespace blink | 237 } // namespace blink |
| OLD | NEW |