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" |
56 #include <v8.h> | 57 #include <v8.h> |
57 | 58 |
58 namespace blink { | 59 namespace blink { |
59 | 60 |
60 class WorkerScriptController::WorkerGlobalScopeExecutionState FINAL { | 61 class WorkerScriptController::WorkerGlobalScopeExecutionState FINAL { |
61 STACK_ALLOCATED(); | 62 STACK_ALLOCATED(); |
62 public: | 63 public: |
63 explicit WorkerGlobalScopeExecutionState(WorkerScriptController* controller) | 64 explicit WorkerGlobalScopeExecutionState(WorkerScriptController* controller) |
64 : hadException(false) | 65 : hadException(false) |
65 , lineNumber(0) | 66 , lineNumber(0) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 142 |
142 v8::Isolate* m_isolate; | 143 v8::Isolate* m_isolate; |
143 }; | 144 }; |
144 | 145 |
145 WorkerScriptController::~WorkerScriptController() | 146 WorkerScriptController::~WorkerScriptController() |
146 { | 147 { |
147 ThreadState::current()->removeInterruptor(m_interruptor.get()); | 148 ThreadState::current()->removeInterruptor(m_interruptor.get()); |
148 | 149 |
149 m_world->dispose(); | 150 m_world->dispose(); |
150 | 151 |
151 // The corresponding call to didStartWorkerThread is in | 152 // The corresponding call to didStartWorkerRunLoop is in |
152 // WorkerThread::initialize(). | 153 // WorkerThread::workerThread(). |
153 // See http://webkit.org/b/83104#c14 for why this is here. | 154 // See http://webkit.org/b/83104#c14 for why this is here. |
154 blink::Platform::current()->didStopWorkerThread(m_workerGlobalScope.thread()
->webThread()); | 155 blink::Platform::current()->didStopWorkerRunLoop(blink::WebWorkerRunLoop(&m_
workerGlobalScope.thread()->runLoop())); |
155 | 156 |
156 if (isContextInitialized()) | 157 if (isContextInitialized()) |
157 m_scriptState->disposePerContextData(); | 158 m_scriptState->disposePerContextData(); |
158 | 159 |
159 ThreadState::current()->addCleanupTask(IsolateCleanupTask::create(m_isolate)
); | 160 ThreadState::current()->addCleanupTask(IsolateCleanupTask::create(m_isolate)
); |
160 } | 161 } |
161 | 162 |
162 bool WorkerScriptController::initializeContextIfNeeded() | 163 bool WorkerScriptController::initializeContextIfNeeded() |
163 { | 164 { |
164 v8::HandleScope handleScope(m_isolate); | 165 v8::HandleScope handleScope(m_isolate); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 313 |
313 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe
RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) | 314 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe
RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) |
314 { | 315 { |
315 const String& errorMessage = errorEvent->message(); | 316 const String& errorMessage = errorEvent->message(); |
316 if (m_globalScopeExecutionState) | 317 if (m_globalScopeExecutionState) |
317 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent
; | 318 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent
; |
318 exceptionState.rethrowV8Exception(V8ThrowException::createError(v8GeneralErr
or, errorMessage, m_isolate)); | 319 exceptionState.rethrowV8Exception(V8ThrowException::createError(v8GeneralErr
or, errorMessage, m_isolate)); |
319 } | 320 } |
320 | 321 |
321 } // namespace blink | 322 } // namespace blink |
OLD | NEW |