Start a new debugger thread to listen for commands.
[platform/framework/web/crosswalk-tizen.git] / atom / browser / node_debugger.h
1 // Copyright (c) 2014 GitHub, Inc. All rights reserved.
2 // Use of this source code is governed by the MIT license that can be
3 // found in the LICENSE file.
4
5 #ifndef ATOM_BROWSER_NODE_DEBUGGER_H_
6 #define ATOM_BROWSER_NODE_DEBUGGER_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/thread.h"
11
12 namespace net {
13 class StreamSocket;
14 class TCPServerSocket;
15 }
16
17 namespace atom {
18
19 // Add support for node's "--debug" switch.
20 class NodeDebugger {
21  public:
22   NodeDebugger();
23   virtual ~NodeDebugger();
24
25  private:
26   void DoAcceptLoop();
27
28   base::Thread thread_;
29   scoped_ptr<net::TCPServerSocket> server_socket_;
30   scoped_ptr<net::StreamSocket> accepted_socket_;
31
32   base::WeakPtrFactory<NodeDebugger> weak_factory_;
33
34   DISALLOW_COPY_AND_ASSIGN(NodeDebugger);
35 };
36
37 }  // namespace atom
38
39 #endif  // ATOM_BROWSER_NODE_DEBUGGER_H_