| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Google, Inc. All Rights Reserved. | 3 * Copyright (C) 2011 Google, Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 120 } |
| 121 | 121 |
| 122 // This is called if the associated ExecutionContext is destructing while | 122 // This is called if the associated ExecutionContext is destructing while |
| 123 // we're still associated with it. That's our cue to disassociate and shutdown. | 123 // we're still associated with it. That's our cue to disassociate and shutdown. |
| 124 // To do this, we stop the database and let everything shutdown naturally | 124 // To do this, we stop the database and let everything shutdown naturally |
| 125 // because the database closing process may still make use of this context. | 125 // because the database closing process may still make use of this context. |
| 126 // It is not safe to just delete the context here. | 126 // It is not safe to just delete the context here. |
| 127 void DatabaseContext::contextDestroyed() { | 127 void DatabaseContext::contextDestroyed() { |
| 128 stopDatabases(); | 128 stopDatabases(); |
| 129 DatabaseManager::manager().unregisterDatabaseContext(this); | 129 DatabaseManager::manager().unregisterDatabaseContext(this); |
| 130 ActiveDOMObject::contextDestroyed(); | |
| 131 } | |
| 132 | |
| 133 // stop() is from stopActiveDOMObjects() which indicates that the owner | |
| 134 // LocalFrame is shutting down. Initiate the orderly shutdown by stopping the | |
| 135 // associated databases. | |
| 136 void DatabaseContext::stop() { | |
| 137 stopDatabases(); | |
| 138 } | 130 } |
| 139 | 131 |
| 140 DatabaseContext* DatabaseContext::backend() { | 132 DatabaseContext* DatabaseContext::backend() { |
| 141 return this; | 133 return this; |
| 142 } | 134 } |
| 143 | 135 |
| 144 DatabaseThread* DatabaseContext::databaseThread() { | 136 DatabaseThread* DatabaseContext::databaseThread() { |
| 145 if (!m_databaseThread && !m_hasOpenDatabases) { | 137 if (!m_databaseThread && !m_hasOpenDatabases) { |
| 146 // It's OK to ask for the m_databaseThread after we've requested | 138 // It's OK to ask for the m_databaseThread after we've requested |
| 147 // termination because we're still using it to execute the closing | 139 // termination because we're still using it to execute the closing |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 178 |
| 187 SecurityOrigin* DatabaseContext::getSecurityOrigin() const { | 179 SecurityOrigin* DatabaseContext::getSecurityOrigin() const { |
| 188 return getExecutionContext()->getSecurityOrigin(); | 180 return getExecutionContext()->getSecurityOrigin(); |
| 189 } | 181 } |
| 190 | 182 |
| 191 bool DatabaseContext::isContextThread() const { | 183 bool DatabaseContext::isContextThread() const { |
| 192 return getExecutionContext()->isContextThread(); | 184 return getExecutionContext()->isContextThread(); |
| 193 } | 185 } |
| 194 | 186 |
| 195 } // namespace blink | 187 } // namespace blink |
| OLD | NEW |