Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp

Issue 2687943004: Abstract out ThreadDebugger from V8PerIsolateData (Closed)
Patch Set: Initialize HiddenValue and PrivateProperty in V8Initializer Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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 "core/inspector/MainThreadDebugger.h" 31 #include "core/inspector/MainThreadDebugger.h"
32 32
33 #include <memory>
33 #include "bindings/core/v8/BindingSecurity.h" 34 #include "bindings/core/v8/BindingSecurity.h"
34 #include "bindings/core/v8/DOMWrapperWorld.h" 35 #include "bindings/core/v8/DOMWrapperWorld.h"
35 #include "bindings/core/v8/ScriptController.h" 36 #include "bindings/core/v8/ScriptController.h"
36 #include "bindings/core/v8/SourceLocation.h" 37 #include "bindings/core/v8/SourceLocation.h"
37 #include "bindings/core/v8/V8ErrorHandler.h" 38 #include "bindings/core/v8/V8ErrorHandler.h"
38 #include "bindings/core/v8/V8Node.h" 39 #include "bindings/core/v8/V8Node.h"
39 #include "bindings/core/v8/V8Window.h" 40 #include "bindings/core/v8/V8Window.h"
40 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" 41 #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
41 #include "core/dom/ContainerNode.h" 42 #include "core/dom/ContainerNode.h"
42 #include "core/dom/Document.h" 43 #include "core/dom/Document.h"
(...skipping 15 matching lines...) Expand all
58 #include "core/inspector/InspectorTaskRunner.h" 59 #include "core/inspector/InspectorTaskRunner.h"
59 #include "core/inspector/V8InspectorString.h" 60 #include "core/inspector/V8InspectorString.h"
60 #include "core/inspector/protocol/Protocol.h" 61 #include "core/inspector/protocol/Protocol.h"
61 #include "core/timing/MemoryInfo.h" 62 #include "core/timing/MemoryInfo.h"
62 #include "core/workers/MainThreadWorkletGlobalScope.h" 63 #include "core/workers/MainThreadWorkletGlobalScope.h"
63 #include "core/xml/XPathEvaluator.h" 64 #include "core/xml/XPathEvaluator.h"
64 #include "core/xml/XPathResult.h" 65 #include "core/xml/XPathResult.h"
65 #include "platform/UserGestureIndicator.h" 66 #include "platform/UserGestureIndicator.h"
66 #include "wtf/PtrUtil.h" 67 #include "wtf/PtrUtil.h"
67 #include "wtf/ThreadingPrimitives.h" 68 #include "wtf/ThreadingPrimitives.h"
68 #include <memory>
69 69
70 namespace blink { 70 namespace blink {
71 71
72 namespace { 72 namespace {
73 73
74 int frameId(LocalFrame* frame) { 74 int frameId(LocalFrame* frame) {
75 ASSERT(frame); 75 ASSERT(frame);
76 return WeakIdentifierMap<LocalFrame>::identifier(frame); 76 return WeakIdentifierMap<LocalFrame>::identifier(frame);
77 } 77 }
78 78
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 location->scriptId()); 209 location->scriptId());
210 } 210 }
211 } 211 }
212 212
213 int MainThreadDebugger::contextGroupId(LocalFrame* frame) { 213 int MainThreadDebugger::contextGroupId(LocalFrame* frame) {
214 LocalFrame* localFrameRoot = frame->localFrameRoot(); 214 LocalFrame* localFrameRoot = frame->localFrameRoot();
215 return frameId(localFrameRoot); 215 return frameId(localFrameRoot);
216 } 216 }
217 217
218 MainThreadDebugger* MainThreadDebugger::instance() { 218 MainThreadDebugger* MainThreadDebugger::instance() {
219 ASSERT(isMainThread()); 219 CHECK(isMainThread());
Yuki 2017/02/15 10:00:40 ASSERT corresponds to DCHECK. Is this change inten
adithyas 2017/02/15 18:12:12 Ah, my bad. Thanks!
220 V8PerIsolateData* data = 220 ThreadDebugger* debugger =
221 V8PerIsolateData::from(V8PerIsolateData::mainThreadIsolate()); 221 ThreadDebugger::getThreadDebugger(V8PerIsolateData::mainThreadIsolate());
222 ASSERT(data->threadDebugger() && !data->threadDebugger()->isWorker()); 222 CHECK(debugger && !debugger->isWorker());
Yuki 2017/02/15 10:00:40 Ditto.
223 return static_cast<MainThreadDebugger*>(data->threadDebugger()); 223 return static_cast<MainThreadDebugger*>(debugger);
224 } 224 }
225 225
226 void MainThreadDebugger::interruptMainThreadAndRun( 226 void MainThreadDebugger::interruptMainThreadAndRun(
227 std::unique_ptr<InspectorTaskRunner::Task> task) { 227 std::unique_ptr<InspectorTaskRunner::Task> task) {
228 MutexLocker locker(creationMutex()); 228 MutexLocker locker(creationMutex());
229 if (s_instance) { 229 if (s_instance) {
230 s_instance->m_taskRunner->appendTask(std::move(task)); 230 s_instance->m_taskRunner->appendTask(std::move(task));
231 s_instance->m_taskRunner->interruptAndRunAllTasksDontWait( 231 s_instance->m_taskRunner->interruptAndRunAllTasksDontWait(
232 s_instance->m_isolate); 232 s_instance->m_isolate);
233 } 233 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 context, nodes, index++, 460 context, nodes, index++,
461 ToV8(node, info.Holder(), info.GetIsolate())) 461 ToV8(node, info.Holder(), info.GetIsolate()))
462 .FromMaybe(false)) 462 .FromMaybe(false))
463 return; 463 return;
464 } 464 }
465 info.GetReturnValue().Set(nodes); 465 info.GetReturnValue().Set(nodes);
466 } 466 }
467 } 467 }
468 468
469 } // namespace blink 469 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698