| 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) 2012 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2012 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 | 189 |
| 190 void ScriptExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* obj
ect) | 190 void ScriptExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* obj
ect) |
| 191 { | 191 { |
| 192 ASSERT(lifecycleNotifier()->contains(object)); | 192 ASSERT(lifecycleNotifier()->contains(object)); |
| 193 // Ensure all ActiveDOMObjects are suspended also newly created ones. | 193 // Ensure all ActiveDOMObjects are suspended also newly created ones. |
| 194 if (m_activeDOMObjectsAreSuspended) | 194 if (m_activeDOMObjectsAreSuspended) |
| 195 object->suspend(m_reasonForSuspendingActiveDOMObjects); | 195 object->suspend(m_reasonForSuspendingActiveDOMObjects); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void ScriptExecutionContext::wasObservedBy(ContextLifecycleObserver* observer, C
ontextLifecycleObserver::Type as) | |
| 199 { | |
| 200 lifecycleNotifier()->addObserver(observer, as); | |
| 201 } | |
| 202 | |
| 203 void ScriptExecutionContext::wasUnobservedBy(ContextLifecycleObserver* observer,
ContextLifecycleObserver::Type as) | |
| 204 { | |
| 205 lifecycleNotifier()->removeObserver(observer, as); | |
| 206 } | |
| 207 | |
| 208 void ScriptExecutionContext::closeMessagePorts() { | 198 void ScriptExecutionContext::closeMessagePorts() { |
| 209 HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end(); | 199 HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end(); |
| 210 for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter !=
messagePortsEnd; ++iter) { | 200 for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter !=
messagePortsEnd; ++iter) { |
| 211 ASSERT((*iter)->scriptExecutionContext() == this); | 201 ASSERT((*iter)->scriptExecutionContext() == this); |
| 212 (*iter)->close(); | 202 (*iter)->close(); |
| 213 } | 203 } |
| 214 } | 204 } |
| 215 | 205 |
| 216 bool ScriptExecutionContext::sanitizeScriptError(String& errorMessage, int& line
Number, String& sourceURL, CachedScript* cachedScript) | 206 bool ScriptExecutionContext::sanitizeScriptError(String& errorMessage, int& line
Number, String& sourceURL, CachedScript* cachedScript) |
| 217 { | 207 { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 284 } |
| 295 } | 285 } |
| 296 | 286 |
| 297 double ScriptExecutionContext::timerAlignmentInterval() const | 287 double ScriptExecutionContext::timerAlignmentInterval() const |
| 298 { | 288 { |
| 299 return DOMTimer::visiblePageAlignmentInterval(); | 289 return DOMTimer::visiblePageAlignmentInterval(); |
| 300 } | 290 } |
| 301 | 291 |
| 302 ContextLifecycleNotifier* ScriptExecutionContext::lifecycleNotifier() | 292 ContextLifecycleNotifier* ScriptExecutionContext::lifecycleNotifier() |
| 303 { | 293 { |
| 304 if (!m_lifecycleNotifier) | 294 return static_cast<ContextLifecycleNotifier*>(SimpleLifecycleContext::lifecy
cleNotifier()); |
| 305 m_lifecycleNotifier = const_cast<ScriptExecutionContext*>(this)->createL
ifecycleNotifier(); | |
| 306 return m_lifecycleNotifier.get(); | |
| 307 } | 295 } |
| 308 | 296 |
| 309 PassOwnPtr<ContextLifecycleNotifier> ScriptExecutionContext::createLifecycleNoti
fier() | 297 PassOwnPtr<SimpleLifecycleNotifier> ScriptExecutionContext::createLifecycleNotif
ier() |
| 310 { | 298 { |
| 311 return ContextLifecycleNotifier::create(this); | 299 return ContextLifecycleNotifier::create(this); |
| 312 } | 300 } |
| 313 | 301 |
| 314 void ScriptExecutionContext::reportMemoryUsage(MemoryObjectInfo* memoryObjectInf
o) const | 302 void ScriptExecutionContext::reportMemoryUsage(MemoryObjectInfo* memoryObjectInf
o) const |
| 315 { | 303 { |
| 316 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); | 304 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); |
| 317 SecurityContext::reportMemoryUsage(memoryObjectInfo); | 305 SecurityContext::reportMemoryUsage(memoryObjectInfo); |
| 318 info.addMember(m_messagePorts, "messagePorts"); | 306 info.addMember(m_messagePorts, "messagePorts"); |
| 319 info.addMember(m_lifecycleNotifier, "lifecycleObserver"); | |
| 320 info.addMember(m_timeouts, "timeouts"); | 307 info.addMember(m_timeouts, "timeouts"); |
| 321 info.addMember(m_pendingExceptions, "pendingExceptions"); | 308 info.addMember(m_pendingExceptions, "pendingExceptions"); |
| 322 info.addMember(m_publicURLManager, "publicURLManager"); | 309 info.addMember(m_publicURLManager, "publicURLManager"); |
| 323 } | 310 } |
| 324 | 311 |
| 325 ScriptExecutionContext::Task::~Task() | 312 ScriptExecutionContext::Task::~Task() |
| 326 { | 313 { |
| 327 } | 314 } |
| 328 | 315 |
| 329 void ScriptExecutionContext::setDatabaseContext(DatabaseContext* databaseContext
) | 316 void ScriptExecutionContext::setDatabaseContext(DatabaseContext* databaseContext
) |
| 330 { | 317 { |
| 331 m_databaseContext = databaseContext; | 318 m_databaseContext = databaseContext; |
| 332 } | 319 } |
| 333 | 320 |
| 334 } // namespace WebCore | 321 } // namespace WebCore |
| OLD | NEW |