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 25 matching lines...) Expand all Loading... |
36 #include <v8.h> | 36 #include <v8.h> |
37 | 37 |
38 namespace WTF { | 38 namespace WTF { |
39 class Mutex; | 39 class Mutex; |
40 } | 40 } |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 class Page; | 44 class Page; |
45 | 45 |
46 class CORE_EXPORT PageScriptDebugServer final : public PerIsolateDebuggerClient
{ | 46 class CORE_EXPORT PageScriptDebugServer final : public NoBaseWillBeGarbageCollec
tedFinalized<PageScriptDebugServer>, public PerIsolateDebuggerClient { |
47 WTF_MAKE_NONCOPYABLE(PageScriptDebugServer); | 47 WTF_MAKE_NONCOPYABLE(PageScriptDebugServer); |
| 48 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PageScriptDebugServer); |
48 public: | 49 public: |
49 class ClientMessageLoop { | 50 class ClientMessageLoop { |
50 public: | 51 public: |
51 virtual ~ClientMessageLoop() { } | 52 virtual ~ClientMessageLoop() { } |
52 virtual void run(LocalFrame*) = 0; | 53 virtual void run(LocalFrame*) = 0; |
53 virtual void quitNow() = 0; | 54 virtual void quitNow() = 0; |
54 }; | 55 }; |
55 | 56 |
56 PageScriptDebugServer(PassOwnPtr<ClientMessageLoop>, v8::Isolate*); | 57 static PassOwnPtrWillBeRawPtr<PageScriptDebugServer> create(PassOwnPtr<Clien
tMessageLoop> clientMessageLoop, v8::Isolate* isolate) |
| 58 { |
| 59 return adoptPtrWillBeNoop(new PageScriptDebugServer(clientMessageLoop, i
solate)); |
| 60 } |
| 61 |
57 ~PageScriptDebugServer() override; | 62 ~PageScriptDebugServer() override; |
58 | 63 |
59 static void setContextDebugData(v8::Local<v8::Context>, const String& type,
int contextDebugId); | 64 static void setContextDebugData(v8::Local<v8::Context>, const String& type,
int contextDebugId); |
60 void addListener(ScriptDebugListener*, LocalFrame*, int contextDebugId); | 65 void addListener(ScriptDebugListener*, LocalFrame*, int contextDebugId); |
61 void removeListener(ScriptDebugListener*, LocalFrame*); | 66 void removeListener(ScriptDebugListener*, LocalFrame*); |
62 | 67 |
63 static PageScriptDebugServer* instance(); | 68 static PageScriptDebugServer* instance(); |
64 static void interruptMainThreadAndRun(PassOwnPtr<ScriptDebugServer::Task>); | 69 static void interruptMainThreadAndRun(PassOwnPtr<ScriptDebugServer::Task>); |
65 | 70 |
| 71 DECLARE_VIRTUAL_TRACE(); |
| 72 |
66 private: | 73 private: |
| 74 PageScriptDebugServer(PassOwnPtr<ClientMessageLoop>, v8::Isolate*); |
| 75 |
67 ScriptDebugListener* getDebugListenerForContext(v8::Local<v8::Context>) over
ride; | 76 ScriptDebugListener* getDebugListenerForContext(v8::Local<v8::Context>) over
ride; |
68 void runMessageLoopOnPause(v8::Local<v8::Context>) override; | 77 void runMessageLoopOnPause(v8::Local<v8::Context>) override; |
69 void quitMessageLoopOnPause() override; | 78 void quitMessageLoopOnPause() override; |
70 | 79 |
71 static WTF::Mutex& creationMutex(); | 80 static WTF::Mutex& creationMutex(); |
72 | 81 |
73 using ListenersMap = WillBeHeapHashMap<RawPtrWillBeMember<LocalFrame>, Scrip
tDebugListener*>; | 82 using ListenersMap = WillBeHeapHashMap<RawPtrWillBeMember<LocalFrame>, Scrip
tDebugListener*>; |
74 ListenersMap m_listenersMap; | 83 ListenersMap m_listenersMap; |
75 OwnPtr<ClientMessageLoop> m_clientMessageLoop; | 84 OwnPtr<ClientMessageLoop> m_clientMessageLoop; |
76 RawPtrWillBeMember<LocalFrame> m_pausedFrame; | 85 RawPtrWillBeMember<LocalFrame> m_pausedFrame; |
77 | 86 |
78 static PageScriptDebugServer* s_instance; | 87 static PageScriptDebugServer* s_instance; |
79 }; | 88 }; |
80 | 89 |
81 } // namespace blink | 90 } // namespace blink |
82 | 91 |
83 | 92 |
84 #endif // PageScriptDebugServer_h | 93 #endif // PageScriptDebugServer_h |
OLD | NEW |