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

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

Issue 559553002: Merge ExecutionContextClient and ExecutionContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@tmp1
Patch Set: fix win build Created 6 years, 3 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) 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 , m_script(adoptPtr(new WorkerScriptController(*this))) 85 , m_script(adoptPtr(new WorkerScriptController(*this)))
86 , m_thread(thread) 86 , m_thread(thread)
87 , m_workerInspectorController(adoptRefWillBeNoop(new WorkerInspectorControll er(this))) 87 , m_workerInspectorController(adoptRefWillBeNoop(new WorkerInspectorControll er(this)))
88 , m_closing(false) 88 , m_closing(false)
89 , m_eventQueue(WorkerEventQueue::create(this)) 89 , m_eventQueue(WorkerEventQueue::create(this))
90 , m_workerClients(workerClients) 90 , m_workerClients(workerClients)
91 , m_timeOrigin(timeOrigin) 91 , m_timeOrigin(timeOrigin)
92 , m_terminationObserver(0) 92 , m_terminationObserver(0)
93 , m_messageStorage(ConsoleMessageStorage::createForWorker(this)) 93 , m_messageStorage(ConsoleMessageStorage::createForWorker(this))
94 { 94 {
95 setClient(this);
96 setSecurityOrigin(SecurityOrigin::create(url)); 95 setSecurityOrigin(SecurityOrigin::create(url));
97 m_workerClients->reattachThread(); 96 m_workerClients->reattachThread();
98 m_thread->setWorkerInspectorController(m_workerInspectorController.get()); 97 m_thread->setWorkerInspectorController(m_workerInspectorController.get());
99 } 98 }
100 99
101 WorkerGlobalScope::~WorkerGlobalScope() 100 WorkerGlobalScope::~WorkerGlobalScope()
102 { 101 {
103 } 102 }
104 103
105 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) 104 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicyHeaderType contentSecurityPolicyType)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 m_terminationObserver->wasRequestedToTerminate(); 208 m_terminationObserver->wasRequestedToTerminate();
210 } 209 }
211 210
212 void WorkerGlobalScope::dispose() 211 void WorkerGlobalScope::dispose()
213 { 212 {
214 ASSERT(thread()->isCurrentThread()); 213 ASSERT(thread()->isCurrentThread());
215 214
216 m_eventQueue->close(); 215 m_eventQueue->close();
217 clearScript(); 216 clearScript();
218 clearInspector(); 217 clearInspector();
219 setClient(0);
220
221 // We do not clear the thread field of the 218 // We do not clear the thread field of the
222 // WorkerGlobalScope. Other objects keep the worker global scope 219 // WorkerGlobalScope. Other objects keep the worker global scope
223 // alive because they need its thread field to check that work is 220 // alive because they need its thread field to check that work is
224 // being carried out on the right thread. We therefore cannot clear 221 // being carried out on the right thread. We therefore cannot clear
225 // the thread field before all references to the worker global 222 // the thread field before all references to the worker global
226 // scope are gone. 223 // scope are gone.
227 } 224 }
228 225
229 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState & exceptionState) 226 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState & exceptionState)
230 { 227 {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int, c onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr <ScriptCallStack>) 276 void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int, c onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr <ScriptCallStack>)
280 { 277 {
281 thread()->workerReportingProxy().reportException(errorMessage, lineNumber, c olumnNumber, sourceURL); 278 thread()->workerReportingProxy().reportException(errorMessage, lineNumber, c olumnNumber, sourceURL);
282 } 279 }
283 280
284 void WorkerGlobalScope::reportBlockedScriptExecutionToInspector(const String& di rectiveText) 281 void WorkerGlobalScope::reportBlockedScriptExecutionToInspector(const String& di rectiveText)
285 { 282 {
286 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); 283 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText);
287 } 284 }
288 285
289 void WorkerGlobalScope::addMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> prpCon soleMessage) 286 void WorkerGlobalScope::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> prpConsoleMessage)
290 { 287 {
291 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; 288 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage;
292 if (!isContextThread()) { 289 if (!isContextThread()) {
293 postTask(AddConsoleMessageTask::create(consoleMessage->source(), console Message->level(), consoleMessage->message())); 290 postTask(AddConsoleMessageTask::create(consoleMessage->source(), console Message->level(), consoleMessage->message()));
294 return; 291 return;
295 } 292 }
296 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage); 293 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage);
297 addMessageToWorkerConsole(consoleMessage.release()); 294 addMessageToWorkerConsole(consoleMessage.release());
298 } 295 }
299 296
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 visitor->trace(m_workerInspectorController); 343 visitor->trace(m_workerInspectorController);
347 visitor->trace(m_eventQueue); 344 visitor->trace(m_eventQueue);
348 visitor->trace(m_workerClients); 345 visitor->trace(m_workerClients);
349 visitor->trace(m_messageStorage); 346 visitor->trace(m_messageStorage);
350 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); 347 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor);
351 ExecutionContext::trace(visitor); 348 ExecutionContext::trace(visitor);
352 EventTargetWithInlineData::trace(visitor); 349 EventTargetWithInlineData::trace(visitor);
353 } 350 }
354 351
355 } // namespace blink 352 } // namespace blink
OLDNEW
« Source/core/testing/NullExecutionContext.cpp ('K') | « Source/core/workers/WorkerGlobalScope.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698