Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: third_party/WebKit/Source/core/dom/ExecutionContext.cpp

Issue 2433773006: Remove ExecutionContext::activeDOMObjectsAreStopped()
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 #include "platform/weborigin/SecurityPolicy.h" 41 #include "platform/weborigin/SecurityPolicy.h"
42 #include "wtf/PtrUtil.h" 42 #include "wtf/PtrUtil.h"
43 #include <memory> 43 #include <memory>
44 44
45 namespace blink { 45 namespace blink {
46 46
47 ExecutionContext::ExecutionContext() 47 ExecutionContext::ExecutionContext()
48 : m_circularSequentialID(0), 48 : m_circularSequentialID(0),
49 m_inDispatchErrorEvent(false), 49 m_inDispatchErrorEvent(false),
50 m_activeDOMObjectsAreSuspended(false), 50 m_activeDOMObjectsAreSuspended(false),
51 m_activeDOMObjectsAreStopped(false),
52 m_windowInteractionTokens(0), 51 m_windowInteractionTokens(0),
53 m_isRunSuspendableTasksScheduled(false), 52 m_isRunSuspendableTasksScheduled(false),
54 m_referrerPolicy(ReferrerPolicyDefault) {} 53 m_referrerPolicy(ReferrerPolicyDefault) {}
55 54
56 ExecutionContext::~ExecutionContext() {} 55 ExecutionContext::~ExecutionContext() {}
57 56
58 void ExecutionContext::suspendActiveDOMObjects() { 57 void ExecutionContext::suspendActiveDOMObjects() {
59 DCHECK(!m_activeDOMObjectsAreSuspended); 58 DCHECK(!m_activeDOMObjectsAreSuspended);
60 notifySuspendingActiveDOMObjects(); 59 notifySuspendingActiveDOMObjects();
61 m_activeDOMObjectsAreSuspended = true; 60 m_activeDOMObjectsAreSuspended = true;
62 } 61 }
63 62
64 void ExecutionContext::resumeActiveDOMObjects() { 63 void ExecutionContext::resumeActiveDOMObjects() {
65 DCHECK(m_activeDOMObjectsAreSuspended); 64 DCHECK(m_activeDOMObjectsAreSuspended);
66 m_activeDOMObjectsAreSuspended = false; 65 m_activeDOMObjectsAreSuspended = false;
67 notifyResumingActiveDOMObjects(); 66 notifyResumingActiveDOMObjects();
68 } 67 }
69 68
70 void ExecutionContext::postSuspendableTask( 69 void ExecutionContext::postSuspendableTask(
71 std::unique_ptr<SuspendableTask> task) { 70 std::unique_ptr<SuspendableTask> task) {
72 m_suspendedTasks.append(std::move(task)); 71 m_suspendedTasks.append(std::move(task));
73 if (!m_activeDOMObjectsAreSuspended) 72 if (!m_activeDOMObjectsAreSuspended)
74 postTask(BLINK_FROM_HERE, 73 postTask(BLINK_FROM_HERE,
75 createSameThreadTask(&ExecutionContext::runSuspendableTasks, 74 createSameThreadTask(&ExecutionContext::runSuspendableTasks,
76 wrapPersistent(this))); 75 wrapPersistent(this)));
77 } 76 }
78 77
79 void ExecutionContext::notifyContextDestroyed() { 78 void ExecutionContext::notifyContextDestroyed() {
80 m_activeDOMObjectsAreStopped = true;
81
82 Deque<std::unique_ptr<SuspendableTask>> suspendedTasks; 79 Deque<std::unique_ptr<SuspendableTask>> suspendedTasks;
83 suspendedTasks.swap(m_suspendedTasks); 80 suspendedTasks.swap(m_suspendedTasks);
84 for (Deque<std::unique_ptr<SuspendableTask>>::iterator it = 81 for (Deque<std::unique_ptr<SuspendableTask>>::iterator it =
85 suspendedTasks.begin(); 82 suspendedTasks.begin();
86 it != suspendedTasks.end(); ++it) 83 it != suspendedTasks.end(); ++it)
87 (*it)->contextDestroyed(); 84 (*it)->contextDestroyed();
88 ContextLifecycleNotifier::notifyContextDestroyed(); 85 ContextLifecycleNotifier::notifyContextDestroyed();
89 } 86 }
90 87
91 void ExecutionContext::suspendScheduledTasks() { 88 void ExecutionContext::suspendScheduledTasks() {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 267 }
271 268
272 DEFINE_TRACE(ExecutionContext) { 269 DEFINE_TRACE(ExecutionContext) {
273 visitor->trace(m_publicURLManager); 270 visitor->trace(m_publicURLManager);
274 visitor->trace(m_pendingExceptions); 271 visitor->trace(m_pendingExceptions);
275 ContextLifecycleNotifier::trace(visitor); 272 ContextLifecycleNotifier::trace(visitor);
276 Supplementable<ExecutionContext>::trace(visitor); 273 Supplementable<ExecutionContext>::trace(visitor);
277 } 274 }
278 275
279 } // namespace blink 276 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698