| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 return INVALID_STATE_ERR; | 216 return INVALID_STATE_ERR; |
| 217 } | 217 } |
| 218 ASSERT_NOT_REACHED(); | 218 ASSERT_NOT_REACHED(); |
| 219 return 0; // Make some older compilers happy. | 219 return 0; // Make some older compilers happy. |
| 220 } | 220 } |
| 221 | 221 |
| 222 static void logOpenDatabaseError(ScriptExecutionContext* context, const String&
name) | 222 static void logOpenDatabaseError(ScriptExecutionContext* context, const String&
name) |
| 223 { | 223 { |
| 224 UNUSED_PARAM(context); | 224 UNUSED_PARAM(context); |
| 225 UNUSED_PARAM(name); | 225 UNUSED_PARAM(name); |
| 226 LOG(StorageAPI, "Database %s for origin %s not allowed to be established", n
ame.ascii().data(), | 226 LOG_INFO(StorageAPI, "Database %s for origin %s not allowed to be establishe
d", name.ascii().data(), |
| 227 context->securityOrigin()->toString().ascii().data()); | 227 context->securityOrigin()->toString().ascii().data()); |
| 228 } | 228 } |
| 229 | 229 |
| 230 PassRefPtr<DatabaseBackendBase> DatabaseManager::openDatabaseBackend(ScriptExecu
tionContext* context, | 230 PassRefPtr<DatabaseBackendBase> DatabaseManager::openDatabaseBackend(ScriptExecu
tionContext* context, |
| 231 DatabaseType type, const String& name, const String& expectedVersion, const
String& displayName, | 231 DatabaseType type, const String& name, const String& expectedVersion, const
String& displayName, |
| 232 unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError& er
ror, String& errorMessage) | 232 unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError& er
ror, String& errorMessage) |
| 233 { | 233 { |
| 234 ASSERT(error == DatabaseError::None); | 234 ASSERT(error == DatabaseError::None); |
| 235 | 235 |
| 236 RefPtr<DatabaseContext> databaseContext = databaseContextFor(context); | 236 RefPtr<DatabaseContext> databaseContext = databaseContextFor(context); |
| 237 RefPtr<DatabaseBackendContext> backendContext = databaseContext->backend(); | 237 RefPtr<DatabaseBackendContext> backendContext = databaseContext->backend(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 if (!backend) | 302 if (!backend) |
| 303 return 0; | 303 return 0; |
| 304 | 304 |
| 305 RefPtr<Database> database = Database::create(context, backend); | 305 RefPtr<Database> database = Database::create(context, backend); |
| 306 | 306 |
| 307 RefPtr<DatabaseContext> databaseContext = databaseContextFor(context); | 307 RefPtr<DatabaseContext> databaseContext = databaseContextFor(context); |
| 308 databaseContext->setHasOpenDatabases(); | 308 databaseContext->setHasOpenDatabases(); |
| 309 InspectorInstrumentation::didOpenDatabase(context, database, context->securi
tyOrigin()->host(), name, expectedVersion); | 309 InspectorInstrumentation::didOpenDatabase(context, database, context->securi
tyOrigin()->host(), name, expectedVersion); |
| 310 | 310 |
| 311 if (backend->isNew() && creationCallback.get()) { | 311 if (backend->isNew() && creationCallback.get()) { |
| 312 LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for database %p
\n", database.get()); | 312 LOG_INFO(StorageAPI, "Scheduling DatabaseCreationCallbackTask for databa
se %p\n", database.get()); |
| 313 database->m_scriptExecutionContext->postTask(DatabaseCreationCallbackTas
k::create(database, creationCallback)); | 313 database->m_scriptExecutionContext->postTask(DatabaseCreationCallbackTas
k::create(database, creationCallback)); |
| 314 } | 314 } |
| 315 | 315 |
| 316 ASSERT(database); | 316 ASSERT(database); |
| 317 return database.release(); | 317 return database.release(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 PassRefPtr<DatabaseSync> DatabaseManager::openDatabaseSync(ScriptExecutionContex
t* context, | 320 PassRefPtr<DatabaseSync> DatabaseManager::openDatabaseSync(ScriptExecutionContex
t* context, |
| 321 const String& name, const String& expectedVersion, const String& displayName
, | 321 const String& name, const String& expectedVersion, const String& displayName
, |
| 322 unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback,
DatabaseError& error) | 322 unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback,
DatabaseError& error) |
| 323 { | 323 { |
| 324 ASSERT(context->isContextThread()); | 324 ASSERT(context->isContextThread()); |
| 325 ASSERT(error == DatabaseError::None); | 325 ASSERT(error == DatabaseError::None); |
| 326 | 326 |
| 327 bool setVersionInNewDatabase = !creationCallback; | 327 bool setVersionInNewDatabase = !creationCallback; |
| 328 String errorMessage; | 328 String errorMessage; |
| 329 RefPtr<DatabaseBackendBase> backend = openDatabaseBackend(context, DatabaseT
ype::Sync, name, | 329 RefPtr<DatabaseBackendBase> backend = openDatabaseBackend(context, DatabaseT
ype::Sync, name, |
| 330 expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, er
ror, errorMessage); | 330 expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, er
ror, errorMessage); |
| 331 if (!backend) | 331 if (!backend) |
| 332 return 0; | 332 return 0; |
| 333 | 333 |
| 334 RefPtr<DatabaseSync> database = DatabaseSync::create(context, backend); | 334 RefPtr<DatabaseSync> database = DatabaseSync::create(context, backend); |
| 335 | 335 |
| 336 if (backend->isNew() && creationCallback.get()) { | 336 if (backend->isNew() && creationCallback.get()) { |
| 337 LOG(StorageAPI, "Invoking the creation callback for database %p\n", data
base.get()); | 337 LOG_INFO(StorageAPI, "Invoking the creation callback for database %p\n",
database.get()); |
| 338 creationCallback->handleEvent(database.get()); | 338 creationCallback->handleEvent(database.get()); |
| 339 } | 339 } |
| 340 | 340 |
| 341 ASSERT(database); | 341 ASSERT(database); |
| 342 return database.release(); | 342 return database.release(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 bool DatabaseManager::hasOpenDatabases(ScriptExecutionContext* context) | 345 bool DatabaseManager::hasOpenDatabases(ScriptExecutionContext* context) |
| 346 { | 346 { |
| 347 RefPtr<DatabaseContext> databaseContext = existingDatabaseContextFor(context
); | 347 RefPtr<DatabaseContext> databaseContext = existingDatabaseContextFor(context
); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 } | 429 } |
| 430 | 430 |
| 431 void DatabaseManager::logErrorMessage(ScriptExecutionContext* context, const Str
ing& message) | 431 void DatabaseManager::logErrorMessage(ScriptExecutionContext* context, const Str
ing& message) |
| 432 { | 432 { |
| 433 context->addConsoleMessage(StorageMessageSource, ErrorMessageLevel, message)
; | 433 context->addConsoleMessage(StorageMessageSource, ErrorMessageLevel, message)
; |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace WebCore | 436 } // namespace WebCore |
| 437 | 437 |
| 438 #endif // ENABLE(SQL_DATABASE) | 438 #endif // ENABLE(SQL_DATABASE) |
| OLD | NEW |