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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "core/frame/UseCounter.h" | 46 #include "core/frame/UseCounter.h" |
47 #include "core/inspector/IdentifiersFactory.h" | 47 #include "core/inspector/IdentifiersFactory.h" |
48 #include "core/inspector/InspectedFrames.h" | 48 #include "core/inspector/InspectedFrames.h" |
49 #include "core/inspector/InspectorTaskRunner.h" | 49 #include "core/inspector/InspectorTaskRunner.h" |
50 #include "core/timing/MemoryInfo.h" | 50 #include "core/timing/MemoryInfo.h" |
51 #include "core/workers/MainThreadWorkletGlobalScope.h" | 51 #include "core/workers/MainThreadWorkletGlobalScope.h" |
52 #include "core/xml/XPathEvaluator.h" | 52 #include "core/xml/XPathEvaluator.h" |
53 #include "core/xml/XPathResult.h" | 53 #include "core/xml/XPathResult.h" |
54 #include "platform/UserGestureIndicator.h" | 54 #include "platform/UserGestureIndicator.h" |
55 #include "platform/v8_inspector/public/V8Debugger.h" | 55 #include "platform/v8_inspector/public/V8Debugger.h" |
56 #include "wtf/OwnPtr.h" | 56 #include "wtf/PtrUtil.h" |
57 #include "wtf/PassOwnPtr.h" | |
58 #include "wtf/ThreadingPrimitives.h" | 57 #include "wtf/ThreadingPrimitives.h" |
| 58 #include <memory> |
59 | 59 |
60 namespace blink { | 60 namespace blink { |
61 | 61 |
62 namespace { | 62 namespace { |
63 | 63 |
64 int frameId(LocalFrame* frame) | 64 int frameId(LocalFrame* frame) |
65 { | 65 { |
66 ASSERT(frame); | 66 ASSERT(frame); |
67 return WeakIdentifierMap<LocalFrame>::identifier(frame); | 67 return WeakIdentifierMap<LocalFrame>::identifier(frame); |
68 } | 68 } |
69 | 69 |
70 Mutex& creationMutex() | 70 Mutex& creationMutex() |
71 { | 71 { |
72 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, (new Mutex)); | 72 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, (new Mutex)); |
73 return mutex; | 73 return mutex; |
74 } | 74 } |
75 | 75 |
76 } | 76 } |
77 | 77 |
78 MainThreadDebugger* MainThreadDebugger::s_instance = nullptr; | 78 MainThreadDebugger* MainThreadDebugger::s_instance = nullptr; |
79 | 79 |
80 MainThreadDebugger::MainThreadDebugger(v8::Isolate* isolate) | 80 MainThreadDebugger::MainThreadDebugger(v8::Isolate* isolate) |
81 : ThreadDebugger(isolate) | 81 : ThreadDebugger(isolate) |
82 , m_taskRunner(adoptPtr(new InspectorTaskRunner())) | 82 , m_taskRunner(wrapUnique(new InspectorTaskRunner())) |
83 { | 83 { |
84 MutexLocker locker(creationMutex()); | 84 MutexLocker locker(creationMutex()); |
85 ASSERT(!s_instance); | 85 ASSERT(!s_instance); |
86 s_instance = this; | 86 s_instance = this; |
87 } | 87 } |
88 | 88 |
89 MainThreadDebugger::~MainThreadDebugger() | 89 MainThreadDebugger::~MainThreadDebugger() |
90 { | 90 { |
91 MutexLocker locker(creationMutex()); | 91 MutexLocker locker(creationMutex()); |
92 ASSERT(s_instance == this); | 92 ASSERT(s_instance == this); |
93 s_instance = nullptr; | 93 s_instance = nullptr; |
94 } | 94 } |
95 | 95 |
96 void MainThreadDebugger::setClientMessageLoop(PassOwnPtr<ClientMessageLoop> clie
ntMessageLoop) | 96 void MainThreadDebugger::setClientMessageLoop(std::unique_ptr<ClientMessageLoop>
clientMessageLoop) |
97 { | 97 { |
98 ASSERT(!m_clientMessageLoop); | 98 ASSERT(!m_clientMessageLoop); |
99 ASSERT(clientMessageLoop); | 99 ASSERT(clientMessageLoop); |
100 m_clientMessageLoop = std::move(clientMessageLoop); | 100 m_clientMessageLoop = std::move(clientMessageLoop); |
101 } | 101 } |
102 | 102 |
103 void MainThreadDebugger::contextCreated(ScriptState* scriptState, LocalFrame* fr
ame, SecurityOrigin* origin) | 103 void MainThreadDebugger::contextCreated(ScriptState* scriptState, LocalFrame* fr
ame, SecurityOrigin* origin) |
104 { | 104 { |
105 ASSERT(isMainThread()); | 105 ASSERT(isMainThread()); |
106 v8::HandleScope handles(scriptState->isolate()); | 106 v8::HandleScope handles(scriptState->isolate()); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 return; | 334 return; |
335 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get
Isolate())).FromMaybe(false)) | 335 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get
Isolate())).FromMaybe(false)) |
336 return; | 336 return; |
337 } | 337 } |
338 info.GetReturnValue().Set(nodes); | 338 info.GetReturnValue().Set(nodes); |
339 } | 339 } |
340 exceptionState.throwIfNeeded(); | 340 exceptionState.throwIfNeeded(); |
341 } | 341 } |
342 | 342 |
343 } // namespace blink | 343 } // namespace blink |
OLD | NEW |