| 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 24 matching lines...) Expand all Loading... |
| 35 #include "bindings/core/v8/ScriptController.h" | 35 #include "bindings/core/v8/ScriptController.h" |
| 36 #include "bindings/core/v8/ScriptSourceCode.h" | 36 #include "bindings/core/v8/ScriptSourceCode.h" |
| 37 #include "bindings/core/v8/V8Binding.h" | 37 #include "bindings/core/v8/V8Binding.h" |
| 38 #include "bindings/core/v8/V8ScriptRunner.h" | 38 #include "bindings/core/v8/V8ScriptRunner.h" |
| 39 #include "bindings/core/v8/WindowProxy.h" | 39 #include "bindings/core/v8/WindowProxy.h" |
| 40 #include "core/frame/FrameConsole.h" | 40 #include "core/frame/FrameConsole.h" |
| 41 #include "core/frame/FrameHost.h" | 41 #include "core/frame/FrameHost.h" |
| 42 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
| 43 #include "core/frame/UseCounter.h" | 43 #include "core/frame/UseCounter.h" |
| 44 #include "core/inspector/InspectorInstrumentation.h" | 44 #include "core/inspector/InspectorInstrumentation.h" |
| 45 #include "core/inspector/InspectorTaskRunner.h" |
| 45 #include "core/inspector/InspectorTraceEvents.h" | 46 #include "core/inspector/InspectorTraceEvents.h" |
| 46 #include "core/inspector/ScriptDebugListener.h" | 47 #include "core/inspector/ScriptDebugListener.h" |
| 47 #include "core/page/Page.h" | 48 #include "core/page/Page.h" |
| 48 #include "wtf/OwnPtr.h" | 49 #include "wtf/OwnPtr.h" |
| 49 #include "wtf/PassOwnPtr.h" | 50 #include "wtf/PassOwnPtr.h" |
| 50 #include "wtf/StdLibExtras.h" | 51 #include "wtf/StdLibExtras.h" |
| 51 #include "wtf/TemporaryChange.h" | 52 #include "wtf/TemporaryChange.h" |
| 52 #include "wtf/ThreadingPrimitives.h" | 53 #include "wtf/ThreadingPrimitives.h" |
| 53 #include "wtf/text/StringBuilder.h" | 54 #include "wtf/text/StringBuilder.h" |
| 54 | 55 |
| 55 namespace blink { | 56 namespace blink { |
| 56 | 57 |
| 57 static LocalFrame* retrieveFrameWithGlobalObjectCheck(v8::Local<v8::Context> con
text) | 58 static LocalFrame* retrieveFrameWithGlobalObjectCheck(v8::Local<v8::Context> con
text) |
| 58 { | 59 { |
| 59 return toLocalFrame(toFrameIfNotDetached(context)); | 60 return toLocalFrame(toFrameIfNotDetached(context)); |
| 60 } | 61 } |
| 61 | 62 |
| 62 // TODO(Oilpan): avoid keeping a raw reference separate from the | 63 // TODO(Oilpan): avoid keeping a raw reference separate from the |
| 63 // owner one; does not enable heap-movable objects. | 64 // owner one; does not enable heap-movable objects. |
| 64 MainThreadDebugger* MainThreadDebugger::s_instance = nullptr; | 65 MainThreadDebugger* MainThreadDebugger::s_instance = nullptr; |
| 65 | 66 |
| 66 MainThreadDebugger::MainThreadDebugger(PassOwnPtr<ClientMessageLoop> clientMessa
geLoop, v8::Isolate* isolate) | 67 MainThreadDebugger::MainThreadDebugger(PassOwnPtr<ClientMessageLoop> clientMessa
geLoop, v8::Isolate* isolate) |
| 67 : ScriptDebuggerBase(isolate, V8Debugger::create(isolate, this)) | 68 : ScriptDebuggerBase(isolate, V8Debugger::create(isolate, this)) |
| 68 , m_clientMessageLoop(clientMessageLoop) | 69 , m_clientMessageLoop(clientMessageLoop) |
| 69 , m_pausedFrame(nullptr) | 70 , m_pausedFrame(nullptr) |
| 71 , m_taskRunner(adoptPtr(new InspectorTaskRunner(isolate))) |
| 70 { | 72 { |
| 71 MutexLocker locker(creationMutex()); | 73 MutexLocker locker(creationMutex()); |
| 72 ASSERT(!s_instance); | 74 ASSERT(!s_instance); |
| 73 s_instance = this; | 75 s_instance = this; |
| 74 } | 76 } |
| 75 | 77 |
| 76 MainThreadDebugger::~MainThreadDebugger() | 78 MainThreadDebugger::~MainThreadDebugger() |
| 77 { | 79 { |
| 78 MutexLocker locker(creationMutex()); | 80 MutexLocker locker(creationMutex()); |
| 79 ASSERT(s_instance == this); | 81 ASSERT(s_instance == this); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 if (m_listenersMap.isEmpty()) | 131 if (m_listenersMap.isEmpty()) |
| 130 debugger()->disable(); | 132 debugger()->disable(); |
| 131 } | 133 } |
| 132 | 134 |
| 133 MainThreadDebugger* MainThreadDebugger::instance() | 135 MainThreadDebugger* MainThreadDebugger::instance() |
| 134 { | 136 { |
| 135 ASSERT(isMainThread()); | 137 ASSERT(isMainThread()); |
| 136 return s_instance; | 138 return s_instance; |
| 137 } | 139 } |
| 138 | 140 |
| 139 void MainThreadDebugger::interruptMainThreadAndRun(PassOwnPtr<V8Debugger::Task>
task) | 141 void MainThreadDebugger::interruptMainThreadAndRun(PassOwnPtr<InspectorTaskRunne
r::Task> task) |
| 140 { | 142 { |
| 141 MutexLocker locker(creationMutex()); | 143 MutexLocker locker(creationMutex()); |
| 142 if (s_instance) | 144 if (s_instance) |
| 143 s_instance->debugger()->interruptAndRun(task); | 145 s_instance->m_taskRunner->interruptAndRun(task); |
| 144 } | 146 } |
| 145 | 147 |
| 146 ScriptDebugListener* MainThreadDebugger::getDebugListenerForContext(v8::Local<v8
::Context> context) | 148 ScriptDebugListener* MainThreadDebugger::getDebugListenerForContext(v8::Local<v8
::Context> context) |
| 147 { | 149 { |
| 148 v8::HandleScope scope(context->GetIsolate()); | 150 v8::HandleScope scope(context->GetIsolate()); |
| 149 LocalFrame* frame = retrieveFrameWithGlobalObjectCheck(context); | 151 LocalFrame* frame = retrieveFrameWithGlobalObjectCheck(context); |
| 150 if (!frame) | 152 if (!frame) |
| 151 return 0; | 153 return 0; |
| 152 return m_listenersMap.get(frame->localFrameRoot()); | 154 return m_listenersMap.get(frame->localFrameRoot()); |
| 153 } | 155 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 167 | 169 |
| 168 m_pausedFrame = 0; | 170 m_pausedFrame = 0; |
| 169 } | 171 } |
| 170 | 172 |
| 171 void MainThreadDebugger::quitMessageLoopOnPause() | 173 void MainThreadDebugger::quitMessageLoopOnPause() |
| 172 { | 174 { |
| 173 m_clientMessageLoop->quitNow(); | 175 m_clientMessageLoop->quitNow(); |
| 174 } | 176 } |
| 175 | 177 |
| 176 } // namespace blink | 178 } // namespace blink |
| OLD | NEW |