Chromium Code Reviews| 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) 2009, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 , m_timeOrigin(timeOrigin) | 86 , m_timeOrigin(timeOrigin) |
| 87 { | 87 { |
| 88 ScriptWrappable::init(this); | 88 ScriptWrappable::init(this); |
| 89 setClient(this); | 89 setClient(this); |
| 90 setSecurityOrigin(SecurityOrigin::create(url)); | 90 setSecurityOrigin(SecurityOrigin::create(url)); |
| 91 m_workerClients->reattachThread(); | 91 m_workerClients->reattachThread(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 WorkerGlobalScope::~WorkerGlobalScope() | 94 WorkerGlobalScope::~WorkerGlobalScope() |
| 95 { | 95 { |
| 96 #if !ENABLE(OILPAN) | |
| 97 dispose(); | |
| 98 #endif | |
| 99 } | 96 } |
| 100 | 97 |
| 101 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) | 98 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) |
| 102 { | 99 { |
| 103 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); | 100 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); |
| 104 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicyHeaderSourceHTTP); | 101 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicyHeaderSourceHTTP); |
| 105 } | 102 } |
| 106 | 103 |
| 107 ExecutionContext* WorkerGlobalScope::executionContext() const | 104 ExecutionContext* WorkerGlobalScope::executionContext() const |
| 108 { | 105 { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 | 186 |
| 190 void WorkerGlobalScope::willStopActiveDOMObjects() | 187 void WorkerGlobalScope::willStopActiveDOMObjects() |
| 191 { | 188 { |
| 192 lifecycleNotifier().notifyWillStopActiveDOMObjects(); | 189 lifecycleNotifier().notifyWillStopActiveDOMObjects(); |
| 193 } | 190 } |
| 194 | 191 |
| 195 void WorkerGlobalScope::dispose() | 192 void WorkerGlobalScope::dispose() |
| 196 { | 193 { |
| 197 ASSERT(thread()->isCurrentThread()); | 194 ASSERT(thread()->isCurrentThread()); |
| 198 | 195 |
| 199 // Notify proxy that we are going away. This can free the WorkerThread objec t, so do not access it after this. | |
| 200 thread()->workerReportingProxy().workerGlobalScopeDestroyed(); | |
| 201 | |
| 202 clearScript(); | 196 clearScript(); |
| 203 clearInspector(); | 197 clearInspector(); |
| 204 setClient(0); | 198 setClient(0); |
| 205 | 199 |
| 206 // The thread reference isn't currently cleared, as the execution | 200 removeAllLifecycleObservers(); |
|
Mads Ager (chromium)
2014/03/17 06:46:14
This seems subtle enough that we should probably h
sof
2014/03/17 07:46:41
Yes, tried to clarify the reason for explicitly do
| |
| 207 // context's thread is accessed by GCed lifetime objects when | 201 clearThread(); |
| 208 // they're finalized. | |
| 209 // FIXME: oilpan: avoid by explicitly removing the WorkerGlobalScope | |
| 210 // as an observable context right here. | |
| 211 } | 202 } |
| 212 | 203 |
| 213 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState & exceptionState) | 204 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState & exceptionState) |
| 214 { | 205 { |
| 215 ASSERT(contentSecurityPolicy()); | 206 ASSERT(contentSecurityPolicy()); |
| 216 Vector<String>::const_iterator urlsEnd = urls.end(); | 207 Vector<String>::const_iterator urlsEnd = urls.end(); |
| 217 Vector<KURL> completedURLs; | 208 Vector<KURL> completedURLs; |
| 218 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) { | 209 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) { |
| 219 const KURL& url = executionContext()->completeURL(*it); | 210 const KURL& url = executionContext()->completeURL(*it); |
| 220 if (!url.isValid()) { | 211 if (!url.isValid()) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 { | 296 { |
| 306 visitor->trace(m_console); | 297 visitor->trace(m_console); |
| 307 visitor->trace(m_location); | 298 visitor->trace(m_location); |
| 308 visitor->trace(m_navigator); | 299 visitor->trace(m_navigator); |
| 309 #if ENABLE(OILPAN) | 300 #if ENABLE(OILPAN) |
| 310 HeapSupplementable<WorkerGlobalScope>::trace(visitor); | 301 HeapSupplementable<WorkerGlobalScope>::trace(visitor); |
| 311 #endif | 302 #endif |
| 312 } | 303 } |
| 313 | 304 |
| 314 } // namespace WebCore | 305 } // namespace WebCore |
| OLD | NEW |