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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 , m_userAgent(userAgent) | 82 , m_userAgent(userAgent) |
83 , m_script(adoptPtr(new WorkerScriptController(this))) | 83 , m_script(adoptPtr(new WorkerScriptController(this))) |
84 , m_thread(thread) | 84 , m_thread(thread) |
85 , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this))) | 85 , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this))) |
86 , m_closing(false) | 86 , m_closing(false) |
87 , m_eventQueue(WorkerEventQueue::create(this)) | 87 , m_eventQueue(WorkerEventQueue::create(this)) |
88 , m_timeOrigin(timeOrigin) | 88 , m_timeOrigin(timeOrigin) |
89 , m_workerClients(workerClients) | 89 , m_workerClients(workerClients) |
90 { | 90 { |
91 ScriptWrappable::init(this); | 91 ScriptWrappable::init(this); |
| 92 setClient(this); |
92 setSecurityOrigin(SecurityOrigin::create(url)); | 93 setSecurityOrigin(SecurityOrigin::create(url)); |
93 m_workerClients->reattachThread(); | 94 m_workerClients->reattachThread(); |
94 } | 95 } |
95 | 96 |
96 WorkerGlobalScope::~WorkerGlobalScope() | 97 WorkerGlobalScope::~WorkerGlobalScope() |
97 { | 98 { |
98 ASSERT(thread()->isCurrentThread()); | 99 ASSERT(thread()->isCurrentThread()); |
99 | 100 |
100 // Make sure we have no observers. | 101 // Make sure we have no observers. |
101 notifyObserversOfStop(); | 102 notifyObserversOfStop(); |
102 | 103 |
103 // Notify proxy that we are going away. This can free the WorkerThread objec
t, so do not access it after this. | 104 // Notify proxy that we are going away. This can free the WorkerThread objec
t, so do not access it after this. |
104 thread()->workerReportingProxy().workerGlobalScopeDestroyed(); | 105 thread()->workerReportingProxy().workerGlobalScopeDestroyed(); |
| 106 |
| 107 setClient(0); |
105 } | 108 } |
106 | 109 |
107 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic
y, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) | 110 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic
y, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) |
108 { | 111 { |
109 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); | 112 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); |
110 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType)
; | 113 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType)
; |
111 } | 114 } |
112 | 115 |
113 ExecutionContext* WorkerGlobalScope::executionContext() const | 116 ExecutionContext* WorkerGlobalScope::executionContext() const |
114 { | 117 { |
(...skipping 23 matching lines...) Expand all Loading... |
138 String WorkerGlobalScope::userAgent(const KURL&) const | 141 String WorkerGlobalScope::userAgent(const KURL&) const |
139 { | 142 { |
140 return m_userAgent; | 143 return m_userAgent; |
141 } | 144 } |
142 | 145 |
143 void WorkerGlobalScope::disableEval(const String& errorMessage) | 146 void WorkerGlobalScope::disableEval(const String& errorMessage) |
144 { | 147 { |
145 m_script->disableEval(errorMessage); | 148 m_script->disableEval(errorMessage); |
146 } | 149 } |
147 | 150 |
| 151 double WorkerGlobalScope::timerAlignmentInterval() const |
| 152 { |
| 153 return DOMTimer::visiblePageAlignmentInterval(); |
| 154 } |
| 155 |
148 WorkerLocation* WorkerGlobalScope::location() const | 156 WorkerLocation* WorkerGlobalScope::location() const |
149 { | 157 { |
150 if (!m_location) | 158 if (!m_location) |
151 m_location = WorkerLocation::create(m_url); | 159 m_location = WorkerLocation::create(m_url); |
152 return m_location.get(); | 160 return m_location.get(); |
153 } | 161 } |
154 | 162 |
155 void WorkerGlobalScope::close() | 163 void WorkerGlobalScope::close() |
156 { | 164 { |
157 if (m_closing) | 165 if (m_closing) |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 bool WorkerGlobalScope::idleNotification() | 322 bool WorkerGlobalScope::idleNotification() |
315 { | 323 { |
316 return script()->idleNotification(); | 324 return script()->idleNotification(); |
317 } | 325 } |
318 | 326 |
319 WorkerEventQueue* WorkerGlobalScope::eventQueue() const | 327 WorkerEventQueue* WorkerGlobalScope::eventQueue() const |
320 { | 328 { |
321 return m_eventQueue.get(); | 329 return m_eventQueue.get(); |
322 } | 330 } |
323 | 331 |
| 332 PassOwnPtr<LifecycleNotifier> WorkerGlobalScope::createLifecycleNotifier() |
| 333 { |
| 334 return ContextLifecycleNotifier::create(this); |
| 335 } |
| 336 |
324 } // namespace WebCore | 337 } // namespace WebCore |
OLD | NEW |