OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" | 46 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" |
47 #include "core/events/ErrorEvent.h" | 47 #include "core/events/ErrorEvent.h" |
48 #include "core/frame/DOMTimer.h" | 48 #include "core/frame/DOMTimer.h" |
49 #include "core/inspector/ScriptCallStack.h" | 49 #include "core/inspector/ScriptCallStack.h" |
50 #include "core/workers/SharedWorkerGlobalScope.h" | 50 #include "core/workers/SharedWorkerGlobalScope.h" |
51 #include "core/workers/WorkerGlobalScope.h" | 51 #include "core/workers/WorkerGlobalScope.h" |
52 #include "core/workers/WorkerObjectProxy.h" | 52 #include "core/workers/WorkerObjectProxy.h" |
53 #include "core/workers/WorkerThread.h" | 53 #include "core/workers/WorkerThread.h" |
54 #include "platform/heap/ThreadState.h" | 54 #include "platform/heap/ThreadState.h" |
55 #include "public/platform/Platform.h" | 55 #include "public/platform/Platform.h" |
56 #include "public/platform/WebWorkerRunLoop.h" | |
57 #include <v8.h> | 56 #include <v8.h> |
58 | 57 |
59 namespace blink { | 58 namespace blink { |
60 | 59 |
61 class WorkerScriptController::WorkerGlobalScopeExecutionState FINAL { | 60 class WorkerScriptController::WorkerGlobalScopeExecutionState FINAL { |
62 STACK_ALLOCATED(); | 61 STACK_ALLOCATED(); |
63 public: | 62 public: |
64 explicit WorkerGlobalScopeExecutionState(WorkerScriptController* controller) | 63 explicit WorkerGlobalScopeExecutionState(WorkerScriptController* controller) |
65 : hadException(false) | 64 : hadException(false) |
66 , lineNumber(0) | 65 , lineNumber(0) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 141 |
143 v8::Isolate* m_isolate; | 142 v8::Isolate* m_isolate; |
144 }; | 143 }; |
145 | 144 |
146 WorkerScriptController::~WorkerScriptController() | 145 WorkerScriptController::~WorkerScriptController() |
147 { | 146 { |
148 ThreadState::current()->removeInterruptor(m_interruptor.get()); | 147 ThreadState::current()->removeInterruptor(m_interruptor.get()); |
149 | 148 |
150 m_world->dispose(); | 149 m_world->dispose(); |
151 | 150 |
152 // The corresponding call to didStartWorkerRunLoop is in | 151 // The corresponding call to didStartWorkerThread is in |
153 // WorkerThread::workerThread(). | 152 // WorkerThread::initialize(). |
154 // See http://webkit.org/b/83104#c14 for why this is here. | 153 // See http://webkit.org/b/83104#c14 for why this is here. |
155 blink::Platform::current()->didStopWorkerRunLoop(blink::WebWorkerRunLoop(&m_
workerGlobalScope.thread()->runLoop())); | 154 blink::Platform::current()->didStopWorkerThread(m_workerGlobalScope.thread()
->webThread()); |
156 | 155 |
157 if (isContextInitialized()) | 156 if (isContextInitialized()) |
158 m_scriptState->disposePerContextData(); | 157 m_scriptState->disposePerContextData(); |
159 | 158 |
160 ThreadState::current()->addCleanupTask(IsolateCleanupTask::create(m_isolate)
); | 159 ThreadState::current()->addCleanupTask(IsolateCleanupTask::create(m_isolate)
); |
161 } | 160 } |
162 | 161 |
163 bool WorkerScriptController::initializeContextIfNeeded() | 162 bool WorkerScriptController::initializeContextIfNeeded() |
164 { | 163 { |
165 v8::HandleScope handleScope(m_isolate); | 164 v8::HandleScope handleScope(m_isolate); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 312 |
314 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe
RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) | 313 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe
RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) |
315 { | 314 { |
316 const String& errorMessage = errorEvent->message(); | 315 const String& errorMessage = errorEvent->message(); |
317 if (m_globalScopeExecutionState) | 316 if (m_globalScopeExecutionState) |
318 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent
; | 317 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent
; |
319 exceptionState.rethrowV8Exception(V8ThrowException::createError(v8GeneralErr
or, errorMessage, m_isolate)); | 318 exceptionState.rethrowV8Exception(V8ThrowException::createError(v8GeneralErr
or, errorMessage, m_isolate)); |
320 } | 319 } |
321 | 320 |
322 } // namespace blink | 321 } // namespace blink |
OLD | NEW |