Chromium Code Reviews| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 // and its fields will be traced when scanning the stack. | 100 // and its fields will be traced when scanning the stack. |
| 101 WorkerScriptController* m_controller; | 101 WorkerScriptController* m_controller; |
| 102 WorkerGlobalScopeExecutionState* m_outerState; | 102 WorkerGlobalScopeExecutionState* m_outerState; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 WorkerScriptController::WorkerScriptController(WorkerGlobalScope& workerGlobalSc ope) | 105 WorkerScriptController::WorkerScriptController(WorkerGlobalScope& workerGlobalSc ope) |
| 106 : m_isolate(0) | 106 : m_isolate(0) |
| 107 , m_workerGlobalScope(workerGlobalScope) | 107 , m_workerGlobalScope(workerGlobalScope) |
| 108 , m_executionForbidden(false) | 108 , m_executionForbidden(false) |
| 109 , m_executionScheduledToTerminate(false) | 109 , m_executionScheduledToTerminate(false) |
| 110 , m_rejectedPromises(RejectedPromises::create()) | |
| 110 , m_globalScopeExecutionState(0) | 111 , m_globalScopeExecutionState(0) |
| 111 { | 112 { |
| 112 m_isolate = V8PerIsolateData::initialize(); | 113 m_isolate = V8PerIsolateData::initialize(); |
| 113 V8Initializer::initializeWorker(m_isolate); | 114 V8Initializer::initializeWorker(m_isolate); |
| 114 m_world = DOMWrapperWorld::create(m_isolate, WorkerWorldId); | 115 m_world = DOMWrapperWorld::create(m_isolate, WorkerWorldId); |
| 115 m_interruptor = adoptPtr(new V8IsolateInterruptor(m_isolate)); | 116 m_interruptor = adoptPtr(new V8IsolateInterruptor(m_isolate)); |
| 116 ThreadState::current()->addInterruptor(m_interruptor.get()); | 117 ThreadState::current()->addInterruptor(m_interruptor.get()); |
| 117 ThreadState::current()->registerTraceDOMWrappers(m_isolate, V8GCController:: traceDOMWrappers); | 118 ThreadState::current()->registerTraceDOMWrappers(m_isolate, V8GCController:: traceDOMWrappers); |
| 118 } | 119 } |
| 119 | 120 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 133 } | 134 } |
| 134 | 135 |
| 135 private: | 136 private: |
| 136 explicit IsolateCleanupTask(v8::Isolate* isolate) : m_isolate(isolate) { } | 137 explicit IsolateCleanupTask(v8::Isolate* isolate) : m_isolate(isolate) { } |
| 137 | 138 |
| 138 v8::Isolate* m_isolate; | 139 v8::Isolate* m_isolate; |
| 139 }; | 140 }; |
| 140 | 141 |
| 141 WorkerScriptController::~WorkerScriptController() | 142 WorkerScriptController::~WorkerScriptController() |
| 142 { | 143 { |
| 144 m_rejectedPromises->dispose(); | |
|
haraken
2015/02/08 01:53:55
Won't ~WorkerScriptController() be called in some
sof
2015/02/08 06:57:39
It is called from there; the OwnPtr<WorkerScriptCo
| |
| 145 m_rejectedPromises.clear(); | |
| 146 | |
| 143 ThreadState::current()->removeInterruptor(m_interruptor.get()); | 147 ThreadState::current()->removeInterruptor(m_interruptor.get()); |
| 144 | 148 |
| 145 m_world->dispose(); | 149 m_world->dispose(); |
| 146 | 150 |
| 147 // The corresponding call to didStartRunLoop() is in WorkerThread::initializ e(). | 151 // The corresponding call to didStartRunLoop() is in WorkerThread::initializ e(). |
| 148 // See http://webkit.org/b/83104#c14 for why this is here. | 152 // See http://webkit.org/b/83104#c14 for why this is here. |
| 149 m_workerGlobalScope.thread()->didStopRunLoop(); | 153 m_workerGlobalScope.thread()->didStopRunLoop(); |
| 150 | 154 |
| 151 if (isContextInitialized()) | 155 if (isContextInitialized()) |
| 152 m_scriptState->disposePerContextData(); | 156 m_scriptState->disposePerContextData(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 | 311 |
| 308 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) | 312 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) |
| 309 { | 313 { |
| 310 const String& errorMessage = errorEvent->message(); | 314 const String& errorMessage = errorEvent->message(); |
| 311 if (m_globalScopeExecutionState) | 315 if (m_globalScopeExecutionState) |
| 312 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent ; | 316 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent ; |
| 313 exceptionState.rethrowV8Exception(V8ThrowException::createGeneralError(m_iso late, errorMessage)); | 317 exceptionState.rethrowV8Exception(V8ThrowException::createGeneralError(m_iso late, errorMessage)); |
| 314 } | 318 } |
| 315 | 319 |
| 316 } // namespace blink | 320 } // namespace blink |
| OLD | NEW |