| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 125 | 125 |
| 126 // This is called if the associated ScriptExecutionContext is destructing while | 126 // This is called if the associated ScriptExecutionContext is destructing while |
| 127 // we're still associated with it. That's our cue to disassociate and shutdown. | 127 // we're still associated with it. That's our cue to disassociate and shutdown. |
| 128 // To do this, we stop the database and let everything shutdown naturally | 128 // To do this, we stop the database and let everything shutdown naturally |
| 129 // because the database closing process may still make use of this context. | 129 // because the database closing process may still make use of this context. |
| 130 // It is not safe to just delete the context here. | 130 // It is not safe to just delete the context here. |
| 131 void DatabaseContext::contextDestroyed() | 131 void DatabaseContext::contextDestroyed() |
| 132 { | 132 { |
| 133 stopDatabases(); | 133 stopDatabases(); |
| 134 ActiveDOMObject::contextDestroyed(); | 134 |
| 135 // Normally, willDestroyActiveDOMObject() is called in ~ActiveDOMObject(). |
| 136 // However, we're here because the destructor hasn't been called, and the |
| 137 // ScriptExecutionContext we're associated with is about to be destructed. |
| 138 // So, go ahead an unregister self from the ActiveDOMObject list, and |
| 139 // set m_scriptExecutionContext to 0 so that ~ActiveDOMObject() doesn't |
| 140 // try to do so again. |
| 141 m_scriptExecutionContext->willDestroyActiveDOMObject(this); |
| 142 m_scriptExecutionContext = 0; |
| 135 } | 143 } |
| 136 | 144 |
| 137 // stop() is from stopActiveDOMObjects() which indicates that the owner Frame | 145 // stop() is from stopActiveDOMObjects() which indicates that the owner Frame |
| 138 // or WorkerThread is shutting down. Initiate the orderly shutdown by stopping | 146 // or WorkerThread is shutting down. Initiate the orderly shutdown by stopping |
| 139 // the associated databases. | 147 // the associated databases. |
| 140 void DatabaseContext::stop() | 148 void DatabaseContext::stop() |
| 141 { | 149 { |
| 142 stopDatabases(); | 150 stopDatabases(); |
| 143 } | 151 } |
| 144 | 152 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 if (m_scriptExecutionContext->isDocument()) { | 205 if (m_scriptExecutionContext->isDocument()) { |
| 198 Document* document = toDocument(m_scriptExecutionContext); | 206 Document* document = toDocument(m_scriptExecutionContext); |
| 199 return document->page(); | 207 return document->page(); |
| 200 } | 208 } |
| 201 ASSERT(m_scriptExecutionContext->isWorkerContext()); | 209 ASSERT(m_scriptExecutionContext->isWorkerContext()); |
| 202 // allowDatabaseAccess is not yet implemented for workers. | 210 // allowDatabaseAccess is not yet implemented for workers. |
| 203 return true; | 211 return true; |
| 204 } | 212 } |
| 205 | 213 |
| 206 } // namespace WebCore | 214 } // namespace WebCore |
| OLD | NEW |