Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: Source/WebCore/dom/ScriptExecutionContext.cpp

Issue 6482007: Merge 76652 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/dom/ScriptExecutionContext.h ('k') | Source/WebCore/html/DOMURL.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 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 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 * 24 *
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "ScriptExecutionContext.h" 28 #include "ScriptExecutionContext.h"
29 29
30 #include "ActiveDOMObject.h" 30 #include "ActiveDOMObject.h"
31 #include "Blob.h" 31 #include "Blob.h"
32 #include "BlobURL.h" 32 #include "BlobURL.h"
33 #include "DOMURL.h"
33 #include "Database.h" 34 #include "Database.h"
34 #include "DatabaseTask.h" 35 #include "DatabaseTask.h"
35 #include "DatabaseThread.h" 36 #include "DatabaseThread.h"
36 #include "ErrorEvent.h" 37 #include "ErrorEvent.h"
37 #include "EventListener.h" 38 #include "EventListener.h"
38 #include "EventTarget.h" 39 #include "EventTarget.h"
39 #include "FileThread.h" 40 #include "FileThread.h"
40 #include "MessagePort.h" 41 #include "MessagePort.h"
41 #include "ScriptCallStack.h" 42 #include "ScriptCallStack.h"
42 #include "SecurityOrigin.h" 43 #include "SecurityOrigin.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (m_fileThread) { 114 if (m_fileThread) {
114 m_fileThread->stop(); 115 m_fileThread->stop();
115 m_fileThread = 0; 116 m_fileThread = 0;
116 } 117 }
117 #endif 118 #endif
118 119
119 #if ENABLE(BLOB) 120 #if ENABLE(BLOB)
120 HashSet<String>::iterator publicBlobURLsEnd = m_publicBlobURLs.end(); 121 HashSet<String>::iterator publicBlobURLsEnd = m_publicBlobURLs.end();
121 for (HashSet<String>::iterator iter = m_publicBlobURLs.begin(); iter != publ icBlobURLsEnd; ++iter) 122 for (HashSet<String>::iterator iter = m_publicBlobURLs.begin(); iter != publ icBlobURLsEnd; ++iter)
122 ThreadableBlobRegistry::unregisterBlobURL(KURL(ParsedURLString, *iter)); 123 ThreadableBlobRegistry::unregisterBlobURL(KURL(ParsedURLString, *iter));
124
125 HashSet<DOMURL*>::iterator domUrlsEnd = m_domUrls.end();
126 for (HashSet<DOMURL*>::iterator iter = m_domUrls.begin(); iter != domUrlsEnd ; ++iter) {
127 ASSERT((*iter)->scriptExecutionContext() == this);
128 (*iter)->contextDestroyed();
129 }
123 #endif 130 #endif
124 } 131 }
125 132
126 #if ENABLE(DATABASE) 133 #if ENABLE(DATABASE)
127 134
128 DatabaseThread* ScriptExecutionContext::databaseThread() 135 DatabaseThread* ScriptExecutionContext::databaseThread()
129 { 136 {
130 if (!m_databaseThread && !m_hasOpenDatabases) { 137 if (!m_databaseThread && !m_hasOpenDatabases) {
131 // Create the database thread on first request - but not if at least one database was already opened, 138 // Create the database thread on first request - but not if at least one database was already opened,
132 // because in that case we already had a database thread and terminated it and should not create another. 139 // because in that case we already had a database thread and terminated it and should not create another.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 { 194 {
188 ASSERT(port); 195 ASSERT(port);
189 #if ENABLE(WORKERS) 196 #if ENABLE(WORKERS)
190 ASSERT((isDocument() && isMainThread()) 197 ASSERT((isDocument() && isMainThread())
191 || (isWorkerContext() && currentThread() == static_cast<WorkerContext*>( this)->thread()->threadID())); 198 || (isWorkerContext() && currentThread() == static_cast<WorkerContext*>( this)->thread()->threadID()));
192 #endif 199 #endif
193 200
194 m_messagePorts.remove(port); 201 m_messagePorts.remove(port);
195 } 202 }
196 203
204 #if ENABLE(BLOB)
205 void ScriptExecutionContext::createdDomUrl(DOMURL* url)
206 {
207 ASSERT(url);
208 m_domUrls.add(url);
209 }
210
211 void ScriptExecutionContext::destroyedDomUrl(DOMURL* url)
212 {
213 ASSERT(url);
214 m_domUrls.remove(url);
215 }
216 #endif
217
197 bool ScriptExecutionContext::canSuspendActiveDOMObjects() 218 bool ScriptExecutionContext::canSuspendActiveDOMObjects()
198 { 219 {
199 // No protection against m_activeDOMObjects changing during iteration: canSu spend() shouldn't execute arbitrary JS. 220 // No protection against m_activeDOMObjects changing during iteration: canSu spend() shouldn't execute arbitrary JS.
200 HashMap<ActiveDOMObject*, void*>::iterator activeObjectsEnd = m_activeDOMObj ects.end(); 221 HashMap<ActiveDOMObject*, void*>::iterator activeObjectsEnd = m_activeDOMObj ects.end();
201 for (HashMap<ActiveDOMObject*, void*>::iterator iter = m_activeDOMObjects.be gin(); iter != activeObjectsEnd; ++iter) { 222 for (HashMap<ActiveDOMObject*, void*>::iterator iter = m_activeDOMObjects.be gin(); iter != activeObjectsEnd; ++iter) {
202 ASSERT(iter->first->scriptExecutionContext() == this); 223 ASSERT(iter->first->scriptExecutionContext() == this);
203 if (!iter->first->canSuspend()) 224 if (!iter->first->canSuspend())
204 return false; 225 return false;
205 } 226 }
206 return true; 227 return true;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 if (isWorkerContext()) 399 if (isWorkerContext())
379 return static_cast<WorkerContext*>(this)->script()->globalData(); 400 return static_cast<WorkerContext*>(this)->script()->globalData();
380 #endif 401 #endif
381 402
382 ASSERT_NOT_REACHED(); 403 ASSERT_NOT_REACHED();
383 return 0; 404 return 0;
384 } 405 }
385 #endif 406 #endif
386 407
387 } // namespace WebCore 408 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/dom/ScriptExecutionContext.h ('k') | Source/WebCore/html/DOMURL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698