| 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 19 matching lines...) Expand all Loading... |
| 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/inspector/ConsoleMessage.h" | 33 #include "core/inspector/ConsoleMessage.h" |
| 34 #include "modules/webdatabase/Database.h" | 34 #include "modules/webdatabase/Database.h" |
| 35 #include "modules/webdatabase/DatabaseCallback.h" | 35 #include "modules/webdatabase/DatabaseCallback.h" |
| 36 #include "modules/webdatabase/DatabaseClient.h" | 36 #include "modules/webdatabase/DatabaseClient.h" |
| 37 #include "modules/webdatabase/DatabaseContext.h" | 37 #include "modules/webdatabase/DatabaseContext.h" |
| 38 #include "modules/webdatabase/DatabaseTask.h" | 38 #include "modules/webdatabase/DatabaseTask.h" |
| 39 #include "modules/webdatabase/DatabaseTracker.h" | 39 #include "modules/webdatabase/DatabaseTracker.h" |
| 40 #include "platform/Logging.h" | 40 #include "modules/webdatabase/StorageLog.h" |
| 41 #include "platform/weborigin/SecurityOrigin.h" | 41 #include "platform/weborigin/SecurityOrigin.h" |
| 42 #include "public/platform/WebTraceLocation.h" | 42 #include "public/platform/WebTraceLocation.h" |
| 43 #include "wtf/PtrUtil.h" | 43 #include "wtf/PtrUtil.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 static DatabaseManager* s_databaseManager; | 47 static DatabaseManager* s_databaseManager; |
| 48 | 48 |
| 49 DatabaseManager& DatabaseManager::manager() | 49 DatabaseManager& DatabaseManager::manager() |
| 50 { | 50 { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 case DatabaseError::InvalidDatabaseState: | 139 case DatabaseError::InvalidDatabaseState: |
| 140 exceptionState.throwDOMException(InvalidStateError, errorMessage); | 140 exceptionState.throwDOMException(InvalidStateError, errorMessage); |
| 141 return; | 141 return; |
| 142 default: | 142 default: |
| 143 ASSERT_NOT_REACHED(); | 143 ASSERT_NOT_REACHED(); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 static void logOpenDatabaseError(ExecutionContext* context, const String& name) | 147 static void logOpenDatabaseError(ExecutionContext* context, const String& name) |
| 148 { | 148 { |
| 149 WTF_LOG(StorageAPI, "Database %s for origin %s not allowed to be established
", name.ascii().data(), | 149 STORAGE_DVLOG(1) << "Database " << name << " for origin " << context->getSec
urityOrigin()->toString() << " not allowed to be established"; |
| 150 context->getSecurityOrigin()->toString().ascii().data()); | |
| 151 } | 150 } |
| 152 | 151 |
| 153 Database* DatabaseManager::openDatabaseInternal(ExecutionContext* context, | 152 Database* DatabaseManager::openDatabaseInternal(ExecutionContext* context, |
| 154 const String& name, const String& expectedVersion, const String& displayName
, | 153 const String& name, const String& expectedVersion, const String& displayName
, |
| 155 unsigned estimatedSize, bool setVersionInNewDatabase, DatabaseError& error,
String& errorMessage) | 154 unsigned estimatedSize, bool setVersionInNewDatabase, DatabaseError& error,
String& errorMessage) |
| 156 { | 155 { |
| 157 ASSERT(error == DatabaseError::None); | 156 ASSERT(error == DatabaseError::None); |
| 158 | 157 |
| 159 DatabaseContext* backendContext = databaseContextFor(context)->backend(); | 158 DatabaseContext* backendContext = databaseContextFor(context)->backend(); |
| 160 if (DatabaseTracker::tracker().canEstablishDatabase(backendContext, name, di
splayName, estimatedSize, error)) { | 159 if (DatabaseTracker::tracker().canEstablishDatabase(backendContext, name, di
splayName, estimatedSize, error)) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 189 bool setVersionInNewDatabase = !creationCallback; | 188 bool setVersionInNewDatabase = !creationCallback; |
| 190 Database* database = openDatabaseInternal(context, name, | 189 Database* database = openDatabaseInternal(context, name, |
| 191 expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, er
ror, errorMessage); | 190 expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, er
ror, errorMessage); |
| 192 if (!database) | 191 if (!database) |
| 193 return nullptr; | 192 return nullptr; |
| 194 | 193 |
| 195 databaseContextFor(context)->setHasOpenDatabases(); | 194 databaseContextFor(context)->setHasOpenDatabases(); |
| 196 DatabaseClient::from(context)->didOpenDatabase(database, context->getSecurit
yOrigin()->host(), name, expectedVersion); | 195 DatabaseClient::from(context)->didOpenDatabase(database, context->getSecurit
yOrigin()->host(), name, expectedVersion); |
| 197 | 196 |
| 198 if (database->isNew() && creationCallback) { | 197 if (database->isNew() && creationCallback) { |
| 199 WTF_LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for databas
e %p\n", database); | 198 STORAGE_DVLOG(1) << "Scheduling DatabaseCreationCallbackTask for databas
e " << database; |
| 200 database->getExecutionContext()->postTask(BLINK_FROM_HERE, createSameThr
eadTask(&databaseCallbackHandleEvent, wrapPersistent(creationCallback), wrapPers
istent(database)), "openDatabase"); | 199 database->getExecutionContext()->postTask(BLINK_FROM_HERE, createSameThr
eadTask(&databaseCallbackHandleEvent, wrapPersistent(creationCallback), wrapPers
istent(database)), "openDatabase"); |
| 201 } | 200 } |
| 202 | 201 |
| 203 ASSERT(database); | 202 ASSERT(database); |
| 204 return database; | 203 return database; |
| 205 } | 204 } |
| 206 | 205 |
| 207 String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, const String
& name, bool createIfDoesNotExist) | 206 String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, const String
& name, bool createIfDoesNotExist) |
| 208 { | 207 { |
| 209 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf
DoesNotExist); | 208 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf
DoesNotExist); |
| 210 } | 209 } |
| 211 | 210 |
| 212 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) | 211 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) |
| 213 { | 212 { |
| 214 context->addConsoleMessage(ConsoleMessage::create(StorageMessageSource, Erro
rMessageLevel, message)); | 213 context->addConsoleMessage(ConsoleMessage::create(StorageMessageSource, Erro
rMessageLevel, message)); |
| 215 } | 214 } |
| 216 | 215 |
| 217 } // namespace blink | 216 } // namespace blink |
| OLD | NEW |