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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 } | 74 } |
75 | 75 |
76 virtual bool isCleanupTask() const { return true; } | 76 virtual bool isCleanupTask() const { return true; } |
77 }; | 77 }; |
78 | 78 |
79 WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, W orkerThread* thread, double timeOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> wo rkerClients) | 79 WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, W orkerThread* thread, double timeOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> wo rkerClients) |
80 : m_url(url) | 80 : m_url(url) |
81 , m_userAgent(userAgent) | 81 , m_userAgent(userAgent) |
82 , m_script(adoptPtr(new WorkerScriptController(*this))) | 82 , m_script(adoptPtr(new WorkerScriptController(*this))) |
83 , m_thread(thread) | 83 , m_thread(thread) |
84 , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this))) | 84 , m_workerInspectorController(adoptRefWillBeNoop(new WorkerInspectorControll er(this))) |
85 , m_closing(false) | 85 , m_closing(false) |
86 , m_eventQueue(WorkerEventQueue::create(this)) | 86 , m_eventQueue(WorkerEventQueue::create(this)) |
87 , m_workerClients(workerClients) | 87 , m_workerClients(workerClients) |
88 , m_timeOrigin(timeOrigin) | 88 , m_timeOrigin(timeOrigin) |
89 , m_terminationObserver(0) | 89 , m_terminationObserver(0) |
90 { | 90 { |
91 ScriptWrappable::init(this); | 91 ScriptWrappable::init(this); |
92 setClient(this); | 92 setClient(this); |
93 setSecurityOrigin(SecurityOrigin::create(url)); | 93 setSecurityOrigin(SecurityOrigin::create(url)); |
94 m_workerClients->reattachThread(); | 94 m_workerClients->reattachThread(); |
95 m_thread->setWorkerInspectorController(m_workerInspectorController); | |
95 } | 96 } |
96 | 97 |
97 WorkerGlobalScope::~WorkerGlobalScope() | 98 WorkerGlobalScope::~WorkerGlobalScope() |
98 { | 99 { |
99 } | 100 } |
100 | 101 |
101 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) | 102 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) |
102 { | 103 { |
103 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); | 104 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); |
104 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicyHeaderSourceHTTP); | 105 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicyHeaderSourceHTTP); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 if (!m_navigator) | 176 if (!m_navigator) |
176 m_navigator = WorkerNavigator::create(m_userAgent); | 177 m_navigator = WorkerNavigator::create(m_userAgent); |
177 return m_navigator.get(); | 178 return m_navigator.get(); |
178 } | 179 } |
179 | 180 |
180 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task) | 181 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task) |
181 { | 182 { |
182 thread()->runLoop().postTask(task); | 183 thread()->runLoop().postTask(task); |
183 } | 184 } |
184 | 185 |
186 // FIXME: Called twice, from WorkerThreadShutdownFinishTask and WorkerGlobalScop e::dispose. | |
185 void WorkerGlobalScope::clearInspector() | 187 void WorkerGlobalScope::clearInspector() |
186 { | 188 { |
189 if (!m_workerInspectorController) | |
190 return; | |
191 m_workerInspectorController->dispose(); | |
192 thread()->setWorkerInspectorController(nullptr); | |
yurys
2014/07/03 03:25:54
The reference stored in WorkerThread should be cle
keishi
2014/07/03 23:53:53
Done.
| |
187 m_workerInspectorController.clear(); | 193 m_workerInspectorController.clear(); |
188 } | 194 } |
189 | 195 |
190 void WorkerGlobalScope::registerTerminationObserver(TerminationObserver* observe r) | 196 void WorkerGlobalScope::registerTerminationObserver(TerminationObserver* observe r) |
191 { | 197 { |
192 ASSERT(!m_terminationObserver); | 198 ASSERT(!m_terminationObserver); |
193 ASSERT(observer); | 199 ASSERT(observer); |
194 m_terminationObserver = observer; | 200 m_terminationObserver = observer; |
195 } | 201 } |
196 | 202 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 void WorkerGlobalScope::countDeprecation(UseCounter::Feature) const | 337 void WorkerGlobalScope::countDeprecation(UseCounter::Feature) const |
332 { | 338 { |
333 // FIXME: How should we count features for shared/service workers? | 339 // FIXME: How should we count features for shared/service workers? |
334 } | 340 } |
335 | 341 |
336 void WorkerGlobalScope::trace(Visitor* visitor) | 342 void WorkerGlobalScope::trace(Visitor* visitor) |
337 { | 343 { |
338 visitor->trace(m_console); | 344 visitor->trace(m_console); |
339 visitor->trace(m_location); | 345 visitor->trace(m_location); |
340 visitor->trace(m_navigator); | 346 visitor->trace(m_navigator); |
347 visitor->trace(m_workerInspectorController); | |
341 visitor->trace(m_eventQueue); | 348 visitor->trace(m_eventQueue); |
342 visitor->trace(m_workerClients); | 349 visitor->trace(m_workerClients); |
343 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); | 350 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); |
344 ExecutionContext::trace(visitor); | 351 ExecutionContext::trace(visitor); |
345 EventTargetWithInlineData::trace(visitor); | 352 EventTargetWithInlineData::trace(visitor); |
346 } | 353 } |
347 | 354 |
348 } // namespace WebCore | 355 } // namespace WebCore |
OLD | NEW |