| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 DatabaseManager::DatabaseManager() | 57 DatabaseManager::DatabaseManager() |
| 58 { | 58 { |
| 59 } | 59 } |
| 60 | 60 |
| 61 DatabaseManager::~DatabaseManager() {} | 61 DatabaseManager::~DatabaseManager() {} |
| 62 | 62 |
| 63 // This is just for ignoring DatabaseCallback::handleEvent()'s return value. | 63 // This is just for ignoring DatabaseCallback::handleEvent()'s return value. |
| 64 static void databaseCallbackHandleEvent(DatabaseCallback* callback, | 64 static void databaseCallbackHandleEvent(DatabaseCallback* callback, |
| 65 Database* database) { | 65 Database* database) { |
| 66 InspectorInstrumentation::AsyncTask asyncTask(database->getExecutionContext(), | 66 probe::AsyncTask asyncTask(database->getExecutionContext(), callback); |
| 67 callback); | |
| 68 callback->handleEvent(database); | 67 callback->handleEvent(database); |
| 69 } | 68 } |
| 70 | 69 |
| 71 DatabaseContext* DatabaseManager::existingDatabaseContextFor( | 70 DatabaseContext* DatabaseManager::existingDatabaseContextFor( |
| 72 ExecutionContext* context) { | 71 ExecutionContext* context) { |
| 73 ASSERT(m_databaseContextRegisteredCount >= 0); | 72 ASSERT(m_databaseContextRegisteredCount >= 0); |
| 74 ASSERT(m_databaseContextInstanceCount >= 0); | 73 ASSERT(m_databaseContextInstanceCount >= 0); |
| 75 ASSERT(m_databaseContextRegisteredCount <= m_databaseContextInstanceCount); | 74 ASSERT(m_databaseContextRegisteredCount <= m_databaseContextInstanceCount); |
| 76 return m_contextMap.at(context); | 75 return m_contextMap.at(context); |
| 77 } | 76 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 if (!database) | 190 if (!database) |
| 192 return nullptr; | 191 return nullptr; |
| 193 | 192 |
| 194 databaseContextFor(context)->setHasOpenDatabases(); | 193 databaseContextFor(context)->setHasOpenDatabases(); |
| 195 DatabaseClient::from(context)->didOpenDatabase( | 194 DatabaseClient::from(context)->didOpenDatabase( |
| 196 database, context->getSecurityOrigin()->host(), name, expectedVersion); | 195 database, context->getSecurityOrigin()->host(), name, expectedVersion); |
| 197 | 196 |
| 198 if (database->isNew() && creationCallback) { | 197 if (database->isNew() && creationCallback) { |
| 199 STORAGE_DVLOG(1) << "Scheduling DatabaseCreationCallbackTask for database " | 198 STORAGE_DVLOG(1) << "Scheduling DatabaseCreationCallbackTask for database " |
| 200 << database; | 199 << database; |
| 201 InspectorInstrumentation::asyncTaskScheduled( | 200 probe::asyncTaskScheduled(database->getExecutionContext(), "openDatabase", |
| 202 database->getExecutionContext(), "openDatabase", creationCallback); | 201 creationCallback); |
| 203 TaskRunnerHelper::get(TaskType::DatabaseAccess, | 202 TaskRunnerHelper::get(TaskType::DatabaseAccess, |
| 204 database->getExecutionContext()) | 203 database->getExecutionContext()) |
| 205 ->postTask(BLINK_FROM_HERE, WTF::bind(&databaseCallbackHandleEvent, | 204 ->postTask(BLINK_FROM_HERE, WTF::bind(&databaseCallbackHandleEvent, |
| 206 wrapPersistent(creationCallback), | 205 wrapPersistent(creationCallback), |
| 207 wrapPersistent(database))); | 206 wrapPersistent(database))); |
| 208 } | 207 } |
| 209 | 208 |
| 210 ASSERT(database); | 209 ASSERT(database); |
| 211 return database; | 210 return database; |
| 212 } | 211 } |
| 213 | 212 |
| 214 String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, | 213 String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, |
| 215 const String& name, | 214 const String& name, |
| 216 bool createIfDoesNotExist) { | 215 bool createIfDoesNotExist) { |
| 217 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, | 216 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, |
| 218 createIfDoesNotExist); | 217 createIfDoesNotExist); |
| 219 } | 218 } |
| 220 | 219 |
| 221 void DatabaseManager::logErrorMessage(ExecutionContext* context, | 220 void DatabaseManager::logErrorMessage(ExecutionContext* context, |
| 222 const String& message) { | 221 const String& message) { |
| 223 context->addConsoleMessage( | 222 context->addConsoleMessage( |
| 224 ConsoleMessage::create(StorageMessageSource, ErrorMessageLevel, message)); | 223 ConsoleMessage::create(StorageMessageSource, ErrorMessageLevel, message)); |
| 225 } | 224 } |
| 226 | 225 |
| 227 } // namespace blink | 226 } // namespace blink |
| OLD | NEW |