| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2011 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "bindings/core/v8/WorkerScriptDebugServer.h" | 32 #include "bindings/core/v8/WorkerScriptDebugServer.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/V8ScriptRunner.h" | 34 #include "bindings/core/v8/V8ScriptRunner.h" |
| 35 #include "core/inspector/ScriptDebugListener.h" | 35 #include "core/inspector/ScriptDebugListener.h" |
| 36 #include "core/inspector/WorkerDebuggerAgent.h" | 36 #include "core/inspector/WorkerDebuggerAgent.h" |
| 37 #include "core/workers/WorkerGlobalScope.h" | 37 #include "core/workers/WorkerGlobalScope.h" |
| 38 #include "core/workers/WorkerThread.h" | 38 #include "core/workers/WorkerScript.h" |
| 39 #include "wtf/MessageQueue.h" | 39 #include "wtf/MessageQueue.h" |
| 40 #include <v8.h> | 40 #include <v8.h> |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 static const char* workerContextDebugId = "[worker]"; | 44 static const char* workerContextDebugId = "[worker]"; |
| 45 | 45 |
| 46 WorkerScriptDebugServer::WorkerScriptDebugServer(WorkerGlobalScope* workerGlobal
Scope) | 46 WorkerScriptDebugServer::WorkerScriptDebugServer(WorkerGlobalScope* workerGlobal
Scope) |
| 47 : ScriptDebugServer(v8::Isolate::GetCurrent()) | 47 : ScriptDebugServer(v8::Isolate::GetCurrent()) |
| 48 , m_listener(0) | 48 , m_listener(0) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 79 | 79 |
| 80 ScriptDebugListener* WorkerScriptDebugServer::getDebugListenerForContext(v8::Loc
al<v8::Context>) | 80 ScriptDebugListener* WorkerScriptDebugServer::getDebugListenerForContext(v8::Loc
al<v8::Context>) |
| 81 { | 81 { |
| 82 // There is only one worker context in isolate. | 82 // There is only one worker context in isolate. |
| 83 return m_listener; | 83 return m_listener; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void WorkerScriptDebugServer::runMessageLoopOnPause(v8::Local<v8::Context>) | 86 void WorkerScriptDebugServer::runMessageLoopOnPause(v8::Local<v8::Context>) |
| 87 { | 87 { |
| 88 MessageQueueWaitResult result; | 88 MessageQueueWaitResult result; |
| 89 m_workerGlobalScope->thread()->willEnterNestedLoop(); | 89 m_workerGlobalScope->script()->willEnterNestedLoop(); |
| 90 do { | 90 do { |
| 91 result = m_workerGlobalScope->thread()->runDebuggerTask(); | 91 result = m_workerGlobalScope->script()->runDebuggerTask(); |
| 92 // Keep waiting until execution is resumed. | 92 // Keep waiting until execution is resumed. |
| 93 } while (result == MessageQueueMessageReceived && isPaused()); | 93 } while (result == MessageQueueMessageReceived && isPaused()); |
| 94 m_workerGlobalScope->thread()->didLeaveNestedLoop(); | 94 m_workerGlobalScope->script()->didLeaveNestedLoop(); |
| 95 | 95 |
| 96 // The listener may have been removed in the nested loop. | 96 // The listener may have been removed in the nested loop. |
| 97 if (m_listener) | 97 if (m_listener) |
| 98 m_listener->didContinue(); | 98 m_listener->didContinue(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void WorkerScriptDebugServer::quitMessageLoopOnPause() | 101 void WorkerScriptDebugServer::quitMessageLoopOnPause() |
| 102 { | 102 { |
| 103 // Nothing to do here in case of workers since runMessageLoopOnPause will ch
eck for paused state after each debugger command. | 103 // Nothing to do here in case of workers since runMessageLoopOnPause will ch
eck for paused state after each debugger command. |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |