summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/Source/core/inspector/ThreadDebugger.h
blob: 19eec3e15e71dc593b87790b8f537b8005ecc0de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ThreadDebugger_h
#define ThreadDebugger_h

#include "core/CoreExport.h"
#include "platform/v8_inspector/public/V8Debugger.h"
#include "platform/v8_inspector/public/V8DebuggerClient.h"
#include "wtf/Forward.h"

#include <v8.h>

namespace blink {

class WorkerThread;

class CORE_EXPORT ThreadDebugger : public V8DebuggerClient {
    WTF_MAKE_NONCOPYABLE(ThreadDebugger);
public:
    explicit ThreadDebugger(v8::Isolate*);
    ~ThreadDebugger() override;

    // V8DebuggerClient implementation.
    void muteWarningsAndDeprecations() override { };
    void unmuteWarningsAndDeprecations() override { };
    void eventListeners(v8::Local<v8::Value>, V8EventListenerInfoList&) override;
    v8::MaybeLocal<v8::Object> instantiateObject(v8::Local<v8::Function>) override;
    v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Context>, v8::Local<v8::Script>) override;
    v8::MaybeLocal<v8::Value> compileAndRunInternalScript(v8::Local<v8::String>) override;
    v8::MaybeLocal<v8::Value> callFunction(v8::Local<v8::Function>, v8::Local<v8::Context>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) override;
    v8::MaybeLocal<v8::Value> callInternalFunction(v8::Local<v8::Function>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) override;
    String16 valueSubtype(v8::Local<v8::Value>) override;
    bool formatAccessorsAsProperties(v8::Local<v8::Value>) override;
    bool hasRecursionLevel() override;
    double currentTimeMS() override;

    V8Debugger* debugger() const { return m_debugger.get(); }
    virtual bool isWorker() { return true; }

protected:
    v8::Isolate* m_isolate;
    OwnPtr<V8Debugger> m_debugger;
};

} // namespace blink

#endif // ThreadDebugger_h