| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 static std::unique_ptr<DatabaseCreationCallbackTask> create(Database* databa
se, DatabaseCallback* creationCallback) | 80 static std::unique_ptr<DatabaseCreationCallbackTask> create(Database* databa
se, DatabaseCallback* creationCallback) |
| 81 { | 81 { |
| 82 return wrapUnique(new DatabaseCreationCallbackTask(database, creationCal
lback)); | 82 return wrapUnique(new DatabaseCreationCallbackTask(database, creationCal
lback)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void performTask(ExecutionContext*) override | 85 void performTask(ExecutionContext*) override |
| 86 { | 86 { |
| 87 m_creationCallback->handleEvent(m_database.get()); | 87 m_creationCallback->handleEvent(m_database.get()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 String taskNameForInstrumentation() const override | |
| 91 { | |
| 92 return "openDatabase"; | |
| 93 } | |
| 94 | |
| 95 private: | 90 private: |
| 96 DatabaseCreationCallbackTask(Database* database, DatabaseCallback* callback) | 91 DatabaseCreationCallbackTask(Database* database, DatabaseCallback* callback) |
| 97 : m_database(database) | 92 : m_database(database) |
| 98 , m_creationCallback(callback) | 93 , m_creationCallback(callback) |
| 99 { | 94 { |
| 100 } | 95 } |
| 101 | 96 |
| 102 Persistent<Database> m_database; | 97 Persistent<Database> m_database; |
| 103 Persistent<DatabaseCallback> m_creationCallback; | 98 Persistent<DatabaseCallback> m_creationCallback; |
| 104 }; | 99 }; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 Database* database = openDatabaseInternal(context, name, | 207 Database* database = openDatabaseInternal(context, name, |
| 213 expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, er
ror, errorMessage); | 208 expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, er
ror, errorMessage); |
| 214 if (!database) | 209 if (!database) |
| 215 return nullptr; | 210 return nullptr; |
| 216 | 211 |
| 217 databaseContextFor(context)->setHasOpenDatabases(); | 212 databaseContextFor(context)->setHasOpenDatabases(); |
| 218 DatabaseClient::from(context)->didOpenDatabase(database, context->getSecurit
yOrigin()->host(), name, expectedVersion); | 213 DatabaseClient::from(context)->didOpenDatabase(database, context->getSecurit
yOrigin()->host(), name, expectedVersion); |
| 219 | 214 |
| 220 if (database->isNew() && creationCallback) { | 215 if (database->isNew() && creationCallback) { |
| 221 WTF_LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for databas
e %p\n", database); | 216 WTF_LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for databas
e %p\n", database); |
| 222 database->getExecutionContext()->postTask(BLINK_FROM_HERE, DatabaseCreat
ionCallbackTask::create(database, creationCallback)); | 217 database->getExecutionContext()->postTask(BLINK_FROM_HERE, DatabaseCreat
ionCallbackTask::create(database, creationCallback), "openDatabase"); |
| 223 } | 218 } |
| 224 | 219 |
| 225 ASSERT(database); | 220 ASSERT(database); |
| 226 return database; | 221 return database; |
| 227 } | 222 } |
| 228 | 223 |
| 229 String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, const String
& name, bool createIfDoesNotExist) | 224 String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, const String
& name, bool createIfDoesNotExist) |
| 230 { | 225 { |
| 231 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf
DoesNotExist); | 226 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf
DoesNotExist); |
| 232 } | 227 } |
| 233 | 228 |
| 234 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) | 229 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) |
| 235 { | 230 { |
| 236 context->addConsoleMessage(ConsoleMessage::create(StorageMessageSource, Erro
rMessageLevel, message)); | 231 context->addConsoleMessage(ConsoleMessage::create(StorageMessageSource, Erro
rMessageLevel, message)); |
| 237 } | 232 } |
| 238 | 233 |
| 239 } // namespace blink | 234 } // namespace blink |
| OLD | NEW |