| 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) 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 23 matching lines...) Expand all Loading... |
| 34 #include "bindings/core/v8/ScriptValue.h" | 34 #include "bindings/core/v8/ScriptValue.h" |
| 35 #include "core/dom/ActiveDOMObject.h" | 35 #include "core/dom/ActiveDOMObject.h" |
| 36 #include "core/dom/AddConsoleMessageTask.h" | 36 #include "core/dom/AddConsoleMessageTask.h" |
| 37 #include "core/dom/ContextLifecycleNotifier.h" | 37 #include "core/dom/ContextLifecycleNotifier.h" |
| 38 #include "core/dom/DOMURL.h" | 38 #include "core/dom/DOMURL.h" |
| 39 #include "core/dom/ExceptionCode.h" | 39 #include "core/dom/ExceptionCode.h" |
| 40 #include "core/dom/MessagePort.h" | 40 #include "core/dom/MessagePort.h" |
| 41 #include "core/events/ErrorEvent.h" | 41 #include "core/events/ErrorEvent.h" |
| 42 #include "core/events/Event.h" | 42 #include "core/events/Event.h" |
| 43 #include "core/inspector/ConsoleMessage.h" | 43 #include "core/inspector/ConsoleMessage.h" |
| 44 #include "core/inspector/ConsoleMessageStorage.h" |
| 44 #include "core/inspector/InspectorConsoleInstrumentation.h" | 45 #include "core/inspector/InspectorConsoleInstrumentation.h" |
| 45 #include "core/inspector/ScriptCallStack.h" | 46 #include "core/inspector/ScriptCallStack.h" |
| 46 #include "core/inspector/WorkerInspectorController.h" | 47 #include "core/inspector/WorkerInspectorController.h" |
| 47 #include "core/loader/WorkerThreadableLoader.h" | 48 #include "core/loader/WorkerThreadableLoader.h" |
| 48 #include "core/frame/LocalDOMWindow.h" | 49 #include "core/frame/LocalDOMWindow.h" |
| 49 #include "core/workers/WorkerNavigator.h" | 50 #include "core/workers/WorkerNavigator.h" |
| 50 #include "core/workers/WorkerClients.h" | 51 #include "core/workers/WorkerClients.h" |
| 51 #include "core/workers/WorkerConsole.h" | 52 #include "core/workers/WorkerConsole.h" |
| 52 #include "core/workers/WorkerLocation.h" | 53 #include "core/workers/WorkerLocation.h" |
| 53 #include "core/workers/WorkerNavigator.h" | 54 #include "core/workers/WorkerNavigator.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 82 : m_url(url) | 83 : m_url(url) |
| 83 , m_userAgent(userAgent) | 84 , m_userAgent(userAgent) |
| 84 , m_script(adoptPtr(new WorkerScriptController(*this))) | 85 , m_script(adoptPtr(new WorkerScriptController(*this))) |
| 85 , m_thread(thread) | 86 , m_thread(thread) |
| 86 , m_workerInspectorController(adoptRefWillBeNoop(new WorkerInspectorControll
er(this))) | 87 , m_workerInspectorController(adoptRefWillBeNoop(new WorkerInspectorControll
er(this))) |
| 87 , m_closing(false) | 88 , m_closing(false) |
| 88 , m_eventQueue(WorkerEventQueue::create(this)) | 89 , m_eventQueue(WorkerEventQueue::create(this)) |
| 89 , m_workerClients(workerClients) | 90 , m_workerClients(workerClients) |
| 90 , m_timeOrigin(timeOrigin) | 91 , m_timeOrigin(timeOrigin) |
| 91 , m_terminationObserver(0) | 92 , m_terminationObserver(0) |
| 93 , m_messageStorage(ConsoleMessageStorage::createForWorker(this)) |
| 92 { | 94 { |
| 93 ScriptWrappable::init(this); | 95 ScriptWrappable::init(this); |
| 94 setClient(this); | 96 setClient(this); |
| 95 setSecurityOrigin(SecurityOrigin::create(url)); | 97 setSecurityOrigin(SecurityOrigin::create(url)); |
| 96 m_workerClients->reattachThread(); | 98 m_workerClients->reattachThread(); |
| 97 m_thread->setWorkerInspectorController(m_workerInspectorController.get()); | 99 m_thread->setWorkerInspectorController(m_workerInspectorController.get()); |
| 98 } | 100 } |
| 99 | 101 |
| 100 WorkerGlobalScope::~WorkerGlobalScope() | 102 WorkerGlobalScope::~WorkerGlobalScope() |
| 101 { | 103 { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 postTask(AddConsoleMessageTask::create(consoleMessage->source(), console
Message->level(), consoleMessage->message())); | 301 postTask(AddConsoleMessageTask::create(consoleMessage->source(), console
Message->level(), consoleMessage->message())); |
| 300 return; | 302 return; |
| 301 } | 303 } |
| 302 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage); | 304 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage); |
| 303 addMessageToWorkerConsole(consoleMessage.release()); | 305 addMessageToWorkerConsole(consoleMessage.release()); |
| 304 } | 306 } |
| 305 | 307 |
| 306 void WorkerGlobalScope::addMessageToWorkerConsole(PassRefPtrWillBeRawPtr<Console
Message> consoleMessage) | 308 void WorkerGlobalScope::addMessageToWorkerConsole(PassRefPtrWillBeRawPtr<Console
Message> consoleMessage) |
| 307 { | 309 { |
| 308 ASSERT(isContextThread()); | 310 ASSERT(isContextThread()); |
| 309 InspectorInstrumentation::addMessageToConsole(this, consoleMessage.get()); | 311 m_messageStorage->reportMessage(consoleMessage); |
| 310 } | 312 } |
| 311 | 313 |
| 312 bool WorkerGlobalScope::isContextThread() const | 314 bool WorkerGlobalScope::isContextThread() const |
| 313 { | 315 { |
| 314 return thread()->isCurrentThread(); | 316 return thread()->isCurrentThread(); |
| 315 } | 317 } |
| 316 | 318 |
| 317 bool WorkerGlobalScope::isJSExecutionForbidden() const | 319 bool WorkerGlobalScope::isJSExecutionForbidden() const |
| 318 { | 320 { |
| 319 return m_script->isExecutionForbidden(); | 321 return m_script->isExecutionForbidden(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 332 void WorkerGlobalScope::countFeature(UseCounter::Feature) const | 334 void WorkerGlobalScope::countFeature(UseCounter::Feature) const |
| 333 { | 335 { |
| 334 // FIXME: How should we count features for shared/service workers? | 336 // FIXME: How should we count features for shared/service workers? |
| 335 } | 337 } |
| 336 | 338 |
| 337 void WorkerGlobalScope::countDeprecation(UseCounter::Feature) const | 339 void WorkerGlobalScope::countDeprecation(UseCounter::Feature) const |
| 338 { | 340 { |
| 339 // FIXME: How should we count features for shared/service workers? | 341 // FIXME: How should we count features for shared/service workers? |
| 340 } | 342 } |
| 341 | 343 |
| 344 ConsoleMessageStorage* WorkerGlobalScope::messageStorage() |
| 345 { |
| 346 return m_messageStorage.get(); |
| 347 } |
| 348 |
| 342 void WorkerGlobalScope::trace(Visitor* visitor) | 349 void WorkerGlobalScope::trace(Visitor* visitor) |
| 343 { | 350 { |
| 344 visitor->trace(m_console); | 351 visitor->trace(m_console); |
| 345 visitor->trace(m_location); | 352 visitor->trace(m_location); |
| 346 visitor->trace(m_navigator); | 353 visitor->trace(m_navigator); |
| 347 visitor->trace(m_workerInspectorController); | 354 visitor->trace(m_workerInspectorController); |
| 348 visitor->trace(m_eventQueue); | 355 visitor->trace(m_eventQueue); |
| 349 visitor->trace(m_workerClients); | 356 visitor->trace(m_workerClients); |
| 350 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); | 357 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); |
| 351 ExecutionContext::trace(visitor); | 358 ExecutionContext::trace(visitor); |
| 352 EventTargetWithInlineData::trace(visitor); | 359 EventTargetWithInlineData::trace(visitor); |
| 353 } | 360 } |
| 354 | 361 |
| 355 } // namespace blink | 362 } // namespace blink |
| OLD | NEW |