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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 | 93 |
94 void ExecutionContext::suspendScheduledTasks() { | 94 void ExecutionContext::suspendScheduledTasks() { |
95 suspendActiveDOMObjects(); | 95 suspendActiveDOMObjects(); |
96 tasksWereSuspended(); | 96 tasksWereSuspended(); |
97 } | 97 } |
98 | 98 |
99 void ExecutionContext::resumeScheduledTasks() { | 99 void ExecutionContext::resumeScheduledTasks() { |
100 resumeActiveDOMObjects(); | 100 resumeActiveDOMObjects(); |
101 tasksWereResumed(); | 101 tasksWereResumed(); |
102 // We need finish stack unwiding before running next task because it can suspe
nd this context. | 102 // We need finish stack unwiding before running next task because it can |
| 103 // suspend this context. |
103 if (m_isRunSuspendableTasksScheduled) | 104 if (m_isRunSuspendableTasksScheduled) |
104 return; | 105 return; |
105 m_isRunSuspendableTasksScheduled = true; | 106 m_isRunSuspendableTasksScheduled = true; |
106 postTask(BLINK_FROM_HERE, | 107 postTask(BLINK_FROM_HERE, |
107 createSameThreadTask(&ExecutionContext::runSuspendableTasks, | 108 createSameThreadTask(&ExecutionContext::runSuspendableTasks, |
108 wrapPersistent(this))); | 109 wrapPersistent(this))); |
109 } | 110 } |
110 | 111 |
111 void ExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object) { | 112 void ExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object) { |
112 #if DCHECK_IS_ON() | 113 #if DCHECK_IS_ON() |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 "'no-referrer', 'no-referrer-when-downgrade', 'origin', " | 252 "'no-referrer', 'no-referrer-when-downgrade', 'origin', " |
252 "'origin-when-cross-origin', or 'unsafe-url'. The referrer policy " | 253 "'origin-when-cross-origin', or 'unsafe-url'. The referrer policy " |
253 "has been left unchanged.")); | 254 "has been left unchanged.")); |
254 return; | 255 return; |
255 } | 256 } |
256 | 257 |
257 setReferrerPolicy(referrerPolicy); | 258 setReferrerPolicy(referrerPolicy); |
258 } | 259 } |
259 | 260 |
260 void ExecutionContext::setReferrerPolicy(ReferrerPolicy referrerPolicy) { | 261 void ExecutionContext::setReferrerPolicy(ReferrerPolicy referrerPolicy) { |
261 // When a referrer policy has already been set, the latest value takes precede
nce. | 262 // When a referrer policy has already been set, the latest value takes |
| 263 // precedence. |
262 UseCounter::count(this, UseCounter::SetReferrerPolicy); | 264 UseCounter::count(this, UseCounter::SetReferrerPolicy); |
263 if (m_referrerPolicy != ReferrerPolicyDefault) | 265 if (m_referrerPolicy != ReferrerPolicyDefault) |
264 UseCounter::count(this, UseCounter::ResetReferrerPolicy); | 266 UseCounter::count(this, UseCounter::ResetReferrerPolicy); |
265 | 267 |
266 m_referrerPolicy = referrerPolicy; | 268 m_referrerPolicy = referrerPolicy; |
267 } | 269 } |
268 | 270 |
269 void ExecutionContext::removeURLFromMemoryCache(const KURL& url) { | 271 void ExecutionContext::removeURLFromMemoryCache(const KURL& url) { |
270 memoryCache()->removeURLFromCache(url); | 272 memoryCache()->removeURLFromCache(url); |
271 } | 273 } |
272 | 274 |
273 DEFINE_TRACE(ExecutionContext) { | 275 DEFINE_TRACE(ExecutionContext) { |
274 visitor->trace(m_publicURLManager); | 276 visitor->trace(m_publicURLManager); |
275 visitor->trace(m_pendingExceptions); | 277 visitor->trace(m_pendingExceptions); |
276 ContextLifecycleNotifier::trace(visitor); | 278 ContextLifecycleNotifier::trace(visitor); |
277 Supplementable<ExecutionContext>::trace(visitor); | 279 Supplementable<ExecutionContext>::trace(visitor); |
278 } | 280 } |
279 | 281 |
280 } // namespace blink | 282 } // namespace blink |
OLD | NEW |