OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_VIEWER_VIEWER_PROCESS_H_ | |
6 #define UI_VIEWER_VIEWER_PROCESS_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/message_loop_proxy.h" | |
11 #include "base/synchronization/waitable_event.h" | |
12 #include "base/threading/thread.h" | |
13 #include "ui/viewer/viewer_host_win.h" | |
tfarina
2012/08/28 01:19:45
can you forward declare this instead?
| |
14 | |
15 class ViewerIPCServer; | |
16 class CommandLine; | |
17 | |
18 // The ViewerProcess does not inherit from ChildProcess because this | |
19 // process can live independently of the browser process. | |
20 class ViewerProcess { | |
21 public: | |
22 ViewerProcess(); | |
23 virtual ~ViewerProcess(); | |
24 | |
25 // Initialize the ViewerProcess with the message loop that it should run on. | |
26 // ViewerProcess takes ownership of |state|. | |
27 bool Initialize(MessageLoop* message_loop, const CommandLine& command_line); | |
28 | |
29 bool Teardown(); | |
30 // Returns the message loop that we perform I/O coordination on (network | |
tfarina
2012/08/28 01:19:45
please, add blank line above.
| |
31 // requests, communication with renderers, etc.). | |
32 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy() { | |
33 return io_thread_->message_loop_proxy(); | |
34 } | |
35 | |
36 // A global event object that is signalled when the main thread's message | |
37 // loop exits. This gives background threads a way to observe the main | |
38 // thread shutting down. | |
39 base::WaitableEvent* shutdown_event() { | |
40 return &shutdown_event_; | |
41 } | |
42 | |
43 // Called by the IPC server when a client disconnects. A return value of | |
44 // true indicates that the IPC server should continue listening for new | |
45 // connections. | |
46 bool HandleClientDisconnect(); | |
47 | |
48 void Terminate(); | |
49 | |
50 private: | |
51 scoped_ptr<base::Thread> io_thread_; | |
52 scoped_ptr<ViewerIPCServer> ipc_server_; | |
53 | |
54 // An event that will be signalled when we shutdown. | |
55 base::WaitableEvent shutdown_event_; | |
56 | |
57 // Window that we draw into. | |
58 scoped_ptr<ViewerHostWin> viewer_host_win_; | |
59 | |
60 // Pointer to the main message loop that host this object. | |
61 MessageLoop* main_message_loop_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(ViewerProcess); | |
64 }; | |
65 | |
66 extern ViewerProcess* g_viewer_process; | |
67 | |
68 #endif // UI_VIEWER_VIEWER_PROCESS_H_ | |
OLD | NEW |