| 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 22 matching lines...) Expand all Loading... |
| 33 #include "core/dom/ExecutionContextTask.h" | 33 #include "core/dom/ExecutionContextTask.h" |
| 34 #include "core/inspector/ConsoleMessage.h" | 34 #include "core/inspector/ConsoleMessage.h" |
| 35 #include "modules/webdatabase/Database.h" | 35 #include "modules/webdatabase/Database.h" |
| 36 #include "modules/webdatabase/DatabaseCallback.h" | 36 #include "modules/webdatabase/DatabaseCallback.h" |
| 37 #include "modules/webdatabase/DatabaseClient.h" | 37 #include "modules/webdatabase/DatabaseClient.h" |
| 38 #include "modules/webdatabase/DatabaseContext.h" | 38 #include "modules/webdatabase/DatabaseContext.h" |
| 39 #include "modules/webdatabase/DatabaseTask.h" | 39 #include "modules/webdatabase/DatabaseTask.h" |
| 40 #include "modules/webdatabase/DatabaseTracker.h" | 40 #include "modules/webdatabase/DatabaseTracker.h" |
| 41 #include "platform/Logging.h" | 41 #include "platform/Logging.h" |
| 42 #include "platform/weborigin/SecurityOrigin.h" | 42 #include "platform/weborigin/SecurityOrigin.h" |
| 43 #include "public/platform/WebTraceLocation.h" |
| 43 #include "wtf/MainThread.h" | 44 #include "wtf/MainThread.h" |
| 44 | 45 |
| 45 namespace blink { | 46 namespace blink { |
| 46 | 47 |
| 47 static DatabaseManager* s_databaseManager; | 48 static DatabaseManager* s_databaseManager; |
| 48 | 49 |
| 49 DatabaseManager& DatabaseManager::manager() | 50 DatabaseManager& DatabaseManager::manager() |
| 50 { | 51 { |
| 51 ASSERT(isMainThread()); | 52 ASSERT(isMainThread()); |
| 52 if (!s_databaseManager) | 53 if (!s_databaseManager) |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 Database* database = openDatabaseInternal(context, name, | 213 Database* database = openDatabaseInternal(context, name, |
| 213 expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, er
ror, errorMessage); | 214 expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, er
ror, errorMessage); |
| 214 if (!database) | 215 if (!database) |
| 215 return nullptr; | 216 return nullptr; |
| 216 | 217 |
| 217 databaseContextFor(context)->setHasOpenDatabases(); | 218 databaseContextFor(context)->setHasOpenDatabases(); |
| 218 DatabaseClient::from(context)->didOpenDatabase(database, context->securityOr
igin()->host(), name, expectedVersion); | 219 DatabaseClient::from(context)->didOpenDatabase(database, context->securityOr
igin()->host(), name, expectedVersion); |
| 219 | 220 |
| 220 if (database->isNew() && creationCallback) { | 221 if (database->isNew() && creationCallback) { |
| 221 WTF_LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for databas
e %p\n", database); | 222 WTF_LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for databas
e %p\n", database); |
| 222 database->executionContext()->postTask(DatabaseCreationCallbackTask::cre
ate(database, creationCallback)); | 223 database->executionContext()->postTask(FROM_HERE, DatabaseCreationCallba
ckTask::create(database, creationCallback)); |
| 223 } | 224 } |
| 224 | 225 |
| 225 ASSERT(database); | 226 ASSERT(database); |
| 226 return database; | 227 return database; |
| 227 } | 228 } |
| 228 | 229 |
| 229 String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, const String
& name, bool createIfDoesNotExist) | 230 String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, const String
& name, bool createIfDoesNotExist) |
| 230 { | 231 { |
| 231 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf
DoesNotExist); | 232 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf
DoesNotExist); |
| 232 } | 233 } |
| 233 | 234 |
| 234 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) | 235 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) |
| 235 { | 236 { |
| 236 context->addConsoleMessage(ConsoleMessage::create(StorageMessageSource, Erro
rMessageLevel, message)); | 237 context->addConsoleMessage(ConsoleMessage::create(StorageMessageSource, Erro
rMessageLevel, message)); |
| 237 } | 238 } |
| 238 | 239 |
| 239 } // namespace blink | 240 } // namespace blink |
| OLD | NEW |