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

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

Issue 1838523004: Initialize debugger together with isolate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed unnecessary assert hitting in unit tests Created 4 years, 8 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 20 matching lines...) Expand all
31 #ifndef MainThreadDebugger_h 31 #ifndef MainThreadDebugger_h
32 #define MainThreadDebugger_h 32 #define MainThreadDebugger_h
33 33
34 #include "bindings/core/v8/ScriptState.h" 34 #include "bindings/core/v8/ScriptState.h"
35 #include "core/CoreExport.h" 35 #include "core/CoreExport.h"
36 #include "core/inspector/InspectorTaskRunner.h" 36 #include "core/inspector/InspectorTaskRunner.h"
37 #include "core/inspector/ThreadDebugger.h" 37 #include "core/inspector/ThreadDebugger.h"
38 #include "platform/heap/Handle.h" 38 #include "platform/heap/Handle.h"
39 #include <v8.h> 39 #include <v8.h>
40 40
41 namespace WTF {
42 class Mutex;
43 }
44
45 namespace blink { 41 namespace blink {
46 42
47 class LocalFrame; 43 class LocalFrame;
48 class V8Debugger; 44 class V8Debugger;
49 class SecurityOrigin; 45 class SecurityOrigin;
50 46
51 class CORE_EXPORT MainThreadDebugger final : public ThreadDebugger { 47 class CORE_EXPORT MainThreadDebugger final : public ThreadDebugger {
52 WTF_MAKE_NONCOPYABLE(MainThreadDebugger); 48 WTF_MAKE_NONCOPYABLE(MainThreadDebugger);
53 public: 49 public:
54 class ClientMessageLoop { 50 class ClientMessageLoop {
55 USING_FAST_MALLOC(ClientMessageLoop); 51 USING_FAST_MALLOC(ClientMessageLoop);
56 public: 52 public:
57 virtual ~ClientMessageLoop() { } 53 virtual ~ClientMessageLoop() { }
58 virtual void run(LocalFrame*) = 0; 54 virtual void run(LocalFrame*) = 0;
59 virtual void quitNow() = 0; 55 virtual void quitNow() = 0;
60 }; 56 };
61 57
62 static PassOwnPtr<MainThreadDebugger> create(PassOwnPtr<ClientMessageLoop> c lientMessageLoop, v8::Isolate* isolate) 58 explicit MainThreadDebugger(v8::Isolate*);
63 {
64 return adoptPtr(new MainThreadDebugger(std::move(clientMessageLoop), iso late));
65 }
66
67 ~MainThreadDebugger() override; 59 ~MainThreadDebugger() override;
68 60
69 static void contextCreated(ScriptState*, LocalFrame*, SecurityOrigin*);
70 static void contextWillBeDestroyed(ScriptState*);
71 static int contextGroupId(LocalFrame*);
72
73 static MainThreadDebugger* instance(); 61 static MainThreadDebugger* instance();
74 static void interruptMainThreadAndRun(PassOwnPtr<InspectorTaskRunner::Task>) ; 62 static void interruptMainThreadAndRun(PassOwnPtr<InspectorTaskRunner::Task>) ;
63
75 InspectorTaskRunner* taskRunner() const { return m_taskRunner.get(); } 64 InspectorTaskRunner* taskRunner() const { return m_taskRunner.get(); }
76
77 bool isWorker() override { return false; } 65 bool isWorker() override { return false; }
66 void setClientMessageLoop(PassOwnPtr<ClientMessageLoop>);
67 int contextGroupId(LocalFrame*);
68 void contextCreated(ScriptState*, LocalFrame*, SecurityOrigin*);
69 void contextWillBeDestroyed(ScriptState*);
78 70
79 private: 71 private:
80 MainThreadDebugger(PassOwnPtr<ClientMessageLoop>, v8::Isolate*);
81
82 // V8DebuggerClient implementation. 72 // V8DebuggerClient implementation.
83 void runMessageLoopOnPause(int contextGroupId) override; 73 void runMessageLoopOnPause(int contextGroupId) override;
84 void quitMessageLoopOnPause() override; 74 void quitMessageLoopOnPause() override;
85 void muteWarningsAndDeprecations() override; 75 void muteWarningsAndDeprecations() override;
86 void unmuteWarningsAndDeprecations() override; 76 void unmuteWarningsAndDeprecations() override;
87 bool callingContextCanAccessContext(v8::Local<v8::Context> calling, v8::Loca l<v8::Context> target) override; 77 bool callingContextCanAccessContext(v8::Local<v8::Context> calling, v8::Loca l<v8::Context> target) override;
88 void contextsToReport(int contextGroupId, V8ContextInfoVector&) override; 78 void contextsToReport(int contextGroupId, V8ContextInfoVector&) override;
89 79
90 static WTF::Mutex& creationMutex();
91
92 OwnPtr<ClientMessageLoop> m_clientMessageLoop; 80 OwnPtr<ClientMessageLoop> m_clientMessageLoop;
93 OwnPtr<InspectorTaskRunner> m_taskRunner; 81 OwnPtr<InspectorTaskRunner> m_taskRunner;
94 82
95 static MainThreadDebugger* s_instance; 83 static MainThreadDebugger* s_instance;
96 }; 84 };
97 85
98 } // namespace blink 86 } // namespace blink
99 87
100 88
101 #endif // MainThreadDebugger_h 89 #endif // MainThreadDebugger_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698