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

Side by Side Diff: Source/core/workers/WorkerGlobalScope.cpp

Issue 248523003: Remove ActiveDOMObject::willStop, and introduce WorkerGlobalScope::TerminationObserver. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, W orkerThread* thread, double timeOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> wo rkerClients) 77 WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, W orkerThread* thread, double timeOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> wo rkerClients)
78 : m_url(url) 78 : m_url(url)
79 , m_userAgent(userAgent) 79 , m_userAgent(userAgent)
80 , m_script(adoptPtr(new WorkerScriptController(*this))) 80 , m_script(adoptPtr(new WorkerScriptController(*this)))
81 , m_thread(thread) 81 , m_thread(thread)
82 , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this))) 82 , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this)))
83 , m_closing(false) 83 , m_closing(false)
84 , m_eventQueue(WorkerEventQueue::create(this)) 84 , m_eventQueue(WorkerEventQueue::create(this))
85 , m_workerClients(workerClients) 85 , m_workerClients(workerClients)
86 , m_timeOrigin(timeOrigin) 86 , m_timeOrigin(timeOrigin)
87 , m_terminationObserver(nullptr)
87 { 88 {
88 ScriptWrappable::init(this); 89 ScriptWrappable::init(this);
89 setClient(this); 90 setClient(this);
90 setSecurityOrigin(SecurityOrigin::create(url)); 91 setSecurityOrigin(SecurityOrigin::create(url));
91 m_workerClients->reattachThread(); 92 m_workerClients->reattachThread();
92 } 93 }
93 94
94 WorkerGlobalScope::~WorkerGlobalScope() 95 WorkerGlobalScope::~WorkerGlobalScope()
95 { 96 {
96 } 97 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task) 178 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task)
178 { 179 {
179 thread()->runLoop().postTask(task); 180 thread()->runLoop().postTask(task);
180 } 181 }
181 182
182 void WorkerGlobalScope::clearInspector() 183 void WorkerGlobalScope::clearInspector()
183 { 184 {
184 m_workerInspectorController.clear(); 185 m_workerInspectorController.clear();
185 } 186 }
186 187
187 void WorkerGlobalScope::willStopActiveDOMObjects() 188 void WorkerGlobalScope::registerTerminationObserver(TerminationObserver* observe r)
188 { 189 {
189 lifecycleNotifier().notifyWillStopActiveDOMObjects(); 190 ASSERT(!m_terminationObserver);
191 ASSERT(observer);
192 m_terminationObserver = observer;
193 }
194
195 void WorkerGlobalScope::unregisterTerminationObserver(TerminationObserver* obser ver)
196 {
197 ASSERT(observer);
198 ASSERT(m_terminationObserver == observer);
199 m_terminationObserver = nullptr;
200 }
201
202 void WorkerGlobalScope::wasRequestedToTerminate()
203 {
haraken 2014/04/23 08:53:55 Shall we add ASSERT(isMainThread()) ?
tkent 2014/04/23 09:13:35 I'm not 100% sure this is always in the main threa
204 if (m_terminationObserver)
205 m_terminationObserver->wasRequestedToTerminate();
190 } 206 }
191 207
192 void WorkerGlobalScope::dispose() 208 void WorkerGlobalScope::dispose()
193 { 209 {
194 ASSERT(thread()->isCurrentThread()); 210 ASSERT(thread()->isCurrentThread());
195 211
196 clearScript(); 212 clearScript();
197 clearInspector(); 213 clearInspector();
198 setClient(0); 214 setClient(0);
199 215
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 void WorkerGlobalScope::trace(Visitor* visitor) 323 void WorkerGlobalScope::trace(Visitor* visitor)
308 { 324 {
309 visitor->trace(m_console); 325 visitor->trace(m_console);
310 visitor->trace(m_location); 326 visitor->trace(m_location);
311 visitor->trace(m_navigator); 327 visitor->trace(m_navigator);
312 visitor->trace(m_workerClients); 328 visitor->trace(m_workerClients);
313 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); 329 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor);
314 } 330 }
315 331
316 } // namespace WebCore 332 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698