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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 | 95 |
| 96 v8::Isolate* m_isolate; | 96 v8::Isolate* m_isolate; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 WorkerScriptController::~WorkerScriptController() | 99 WorkerScriptController::~WorkerScriptController() |
| 100 { | 100 { |
| 101 ThreadState::current()->removeInterruptor(m_interruptor.get()); | 101 ThreadState::current()->removeInterruptor(m_interruptor.get()); |
| 102 | 102 |
| 103 m_world->dispose(); | 103 m_world->dispose(); |
| 104 | 104 |
| 105 // The corresponding call to didStartWorkerRunLoop is in | 105 // We need to collect all dead DOM objects before calling didStopWorkerRunLo op(), |
| 106 // WorkerThread::workerThread(). | 106 // because destructors of some DOM objects touch Chromium-side objects |
| 107 // See http://webkit.org/b/83104#c14 for why this is here. | 107 // which are destroyed in didStopWorkerRunLoop(). For example, ~IDBRequest() touches |
| 108 // IndexedDBDispatcher which is destroyed in didStopWorkerRunLoop(). | |
| 109 // | |
| 110 // Things should happen in the following order: | |
| 111 // (1) Heap::collectAllGarbage() | |
| 112 // (2) didStopWorkerRunLoop() | |
| 113 // (3) ThreadState::detach() | |
|
zerny-chromium
2014/03/31 06:33:10
This also does a full GC. Do we need this both bef
Mads Ager (chromium)
2014/03/31 08:56:53
So, we definitely need the detach call and we have
| |
| 114 // (4) Isolate destruction | |
| 115 // See http://webkit.org/b/83104#c14 for more details. | |
| 116 Heap::collectAllGarbage(ThreadState::NoHeapPointersOnStack); | |
| 117 | |
| 118 // The corresponding call to didStartWorkerRunLoop is in WorkerThread::worke rThread(). | |
| 108 blink::Platform::current()->didStopWorkerRunLoop(blink::WebWorkerRunLoop(&m_ workerGlobalScope.thread()->runLoop())); | 119 blink::Platform::current()->didStopWorkerRunLoop(blink::WebWorkerRunLoop(&m_ workerGlobalScope.thread()->runLoop())); |
| 109 | 120 |
| 110 disposeContext(); | 121 disposeContext(); |
| 111 | 122 |
| 112 ThreadState::current()->addCleanupTask(IsolateCleanupTask::create(m_isolate) ); | 123 ThreadState::current()->addCleanupTask(IsolateCleanupTask::create(m_isolate) ); |
| 113 } | 124 } |
| 114 | 125 |
| 115 void WorkerScriptController::disposeContext() | 126 void WorkerScriptController::disposeContext() |
| 116 { | 127 { |
| 117 m_perContextData.clear(); | 128 m_perContextData.clear(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 m_disableEvalPending = errorMessage; | 268 m_disableEvalPending = errorMessage; |
| 258 } | 269 } |
| 259 | 270 |
| 260 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtr<Error Event> errorEvent) | 271 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtr<Error Event> errorEvent) |
| 261 { | 272 { |
| 262 m_errorEventFromImportedScript = errorEvent; | 273 m_errorEventFromImportedScript = errorEvent; |
| 263 throwError(V8ThrowException::createError(v8GeneralError, m_errorEventFromImp ortedScript->message(), m_isolate), m_isolate); | 274 throwError(V8ThrowException::createError(v8GeneralError, m_errorEventFromImp ortedScript->message(), m_isolate), m_isolate); |
| 264 } | 275 } |
| 265 | 276 |
| 266 } // namespace WebCore | 277 } // namespace WebCore |
| OLD | NEW |