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

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

Issue 178663004: Oilpan: move WorkerGlobalScope to oilpan's heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 9 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
« no previous file with comments | « Source/core/workers/WorkerGlobalScope.h ('k') | Source/core/workers/WorkerGlobalScope.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 , m_timeOrigin(timeOrigin) 86 , m_timeOrigin(timeOrigin)
87 { 87 {
88 ScriptWrappable::init(this); 88 ScriptWrappable::init(this);
89 setClient(this); 89 setClient(this);
90 setSecurityOrigin(SecurityOrigin::create(url)); 90 setSecurityOrigin(SecurityOrigin::create(url));
91 m_workerClients->reattachThread(); 91 m_workerClients->reattachThread();
92 } 92 }
93 93
94 WorkerGlobalScope::~WorkerGlobalScope() 94 WorkerGlobalScope::~WorkerGlobalScope()
95 { 95 {
96 ASSERT(thread()->isCurrentThread()); 96 #if !ENABLE(OILPAN)
97 97 dispose();
98 // Notify proxy that we are going away. This can free the WorkerThread objec t, so do not access it after this. 98 #endif
99 thread()->workerReportingProxy().workerGlobalScopeDestroyed();
100
101 setClient(0);
102 } 99 }
103 100
104 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) 101 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicyHeaderType contentSecurityPolicyType)
105 { 102 {
106 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); 103 setContentSecurityPolicy(ContentSecurityPolicy::create(this));
107 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicyHeaderSourceHTTP); 104 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicyHeaderSourceHTTP);
108 } 105 }
109 106
110 ExecutionContext* WorkerGlobalScope::executionContext() const 107 ExecutionContext* WorkerGlobalScope::executionContext() const
111 { 108 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task) 180 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task)
184 { 181 {
185 thread()->runLoop().postTask(task); 182 thread()->runLoop().postTask(task);
186 } 183 }
187 184
188 void WorkerGlobalScope::clearInspector() 185 void WorkerGlobalScope::clearInspector()
189 { 186 {
190 m_workerInspectorController.clear(); 187 m_workerInspectorController.clear();
191 } 188 }
192 189
190 void WorkerGlobalScope::dispose()
191 {
192 ASSERT(thread()->isCurrentThread());
193
194 // Notify proxy that we are going away. This can free the WorkerThread objec t, so do not access it after this.
195 thread()->workerReportingProxy().workerGlobalScopeDestroyed();
196
197 clearScript();
198 clearInspector();
199 setClient(0);
200 // NOTE: the thread reference isn't cleared, as the execution context's
201 // thread is accessed by other GCed objects being finalized/destructed.
haraken 2014/03/10 07:10:03 Thanks sof for the clarification! Now I think this
Mads Ager (chromium) 2014/03/10 08:51:14 Is the issue here that lifecycle observers will ac
202 }
203
193 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState & exceptionState) 204 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState & exceptionState)
194 { 205 {
195 ASSERT(contentSecurityPolicy()); 206 ASSERT(contentSecurityPolicy());
196 Vector<String>::const_iterator urlsEnd = urls.end(); 207 Vector<String>::const_iterator urlsEnd = urls.end();
197 Vector<KURL> completedURLs; 208 Vector<KURL> completedURLs;
198 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) { 209 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) {
199 const KURL& url = executionContext()->completeURL(*it); 210 const KURL& url = executionContext()->completeURL(*it);
200 if (!url.isValid()) { 211 if (!url.isValid()) {
201 exceptionState.throwDOMException(SyntaxError, "The URL '" + *it + "' is invalid."); 212 exceptionState.throwDOMException(SyntaxError, "The URL '" + *it + "' is invalid.");
202 return; 213 return;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 bool WorkerGlobalScope::idleNotification() 285 bool WorkerGlobalScope::idleNotification()
275 { 286 {
276 return script()->idleNotification(); 287 return script()->idleNotification();
277 } 288 }
278 289
279 WorkerEventQueue* WorkerGlobalScope::eventQueue() const 290 WorkerEventQueue* WorkerGlobalScope::eventQueue() const
280 { 291 {
281 return m_eventQueue.get(); 292 return m_eventQueue.get();
282 } 293 }
283 294
295 void WorkerGlobalScope::trace(Visitor* visitor)
296 {
297 visitor->trace(m_console);
298 visitor->trace(m_location);
299 visitor->trace(m_navigator);
300 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor);
301 }
302
284 } // namespace WebCore 303 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerGlobalScope.h ('k') | Source/core/workers/WorkerGlobalScope.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698