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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // (or 0, if outermost.) Upon return from evaluate(), the | 96 // (or 0, if outermost.) Upon return from evaluate(), the |
97 // WorkerScriptController's WorkerGlobalScopeExecutionState is popped | 97 // WorkerScriptController's WorkerGlobalScopeExecutionState is popped |
98 // and the previous one restored (see above dtor.) | 98 // and the previous one restored (see above dtor.) |
99 // | 99 // |
100 // With Oilpan, |m_outerState| isn't traced. It'll be "up the stack" | 100 // With Oilpan, |m_outerState| isn't traced. It'll be "up the stack" |
101 // and its fields will be traced when scanning the stack. | 101 // and its fields will be traced when scanning the stack. |
102 WorkerScriptController* m_controller; | 102 WorkerScriptController* m_controller; |
103 WorkerGlobalScopeExecutionState* m_outerState; | 103 WorkerGlobalScopeExecutionState* m_outerState; |
104 }; | 104 }; |
105 | 105 |
106 WorkerScriptController::WorkerScriptController(WorkerGlobalScope& workerGlobalSc
ope) | 106 WorkerScriptController::WorkerScriptController(WorkerGlobalScope& workerGlobalSc
ope, v8::Isolate* isolate) |
107 : m_isolate(0) | 107 : m_isolate(isolate) |
108 , m_workerGlobalScope(workerGlobalScope) | 108 , m_workerGlobalScope(workerGlobalScope) |
109 , m_executionForbidden(false) | 109 , m_executionForbidden(false) |
110 , m_executionScheduledToTerminate(false) | 110 , m_executionScheduledToTerminate(false) |
111 , m_globalScopeExecutionState(0) | 111 , m_globalScopeExecutionState(0) |
112 { | 112 { |
113 m_isolate = V8PerIsolateData::initialize(); | |
114 V8Initializer::initializeWorker(m_isolate); | |
115 m_world = DOMWrapperWorld::create(m_isolate, WorkerWorldId); | 113 m_world = DOMWrapperWorld::create(m_isolate, WorkerWorldId); |
116 m_interruptor = adoptPtr(new V8IsolateInterruptor(m_isolate)); | 114 m_interruptor = adoptPtr(new V8IsolateInterruptor(m_isolate)); |
117 ThreadState::current()->addInterruptor(m_interruptor.get()); | 115 ThreadState::current()->addInterruptor(m_interruptor.get()); |
118 ThreadState::current()->registerTraceDOMWrappers(m_isolate, V8GCController::
traceDOMWrappers); | 116 ThreadState::current()->registerTraceDOMWrappers(m_isolate, V8GCController::
traceDOMWrappers); |
119 } | 117 } |
120 | 118 |
121 // We need to postpone V8 Isolate destruction until the very end of | 119 // We need to postpone V8 Isolate destruction until the very end of |
122 // worker thread finalization when all objects on the worker heap | 120 // worker thread finalization when all objects on the worker heap |
123 // are destroyed. | 121 // are destroyed. |
124 class IsolateCleanupTask : public ThreadState::CleanupTask { | 122 class IsolateCleanupTask : public ThreadState::CleanupTask { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 307 |
310 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe
RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) | 308 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe
RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) |
311 { | 309 { |
312 const String& errorMessage = errorEvent->message(); | 310 const String& errorMessage = errorEvent->message(); |
313 if (m_globalScopeExecutionState) | 311 if (m_globalScopeExecutionState) |
314 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent
; | 312 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent
; |
315 exceptionState.rethrowV8Exception(V8ThrowException::createGeneralError(m_iso
late, errorMessage)); | 313 exceptionState.rethrowV8Exception(V8ThrowException::createGeneralError(m_iso
late, errorMessage)); |
316 } | 314 } |
317 | 315 |
318 } // namespace blink | 316 } // namespace blink |
OLD | NEW |