OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <iostream> | 5 #include <iostream> |
6 #include <signal.h> | 6 #include <signal.h> |
7 #include <X11/keysym.h> | 7 #include <X11/keysym.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "media/tools/player_x11/x11_video_renderer.h" | 30 #include "media/tools/player_x11/x11_video_renderer.h" |
31 | 31 |
32 static Display* g_display = NULL; | 32 static Display* g_display = NULL; |
33 static Window g_window = 0; | 33 static Window g_window = 0; |
34 static bool g_running = false; | 34 static bool g_running = false; |
35 | 35 |
36 class MessageLoopQuitter { | 36 class MessageLoopQuitter { |
37 public: | 37 public: |
38 explicit MessageLoopQuitter(MessageLoop* loop) : loop_(loop) {} | 38 explicit MessageLoopQuitter(MessageLoop* loop) : loop_(loop) {} |
39 void Quit(media::PipelineStatus status) { | 39 void Quit(media::PipelineStatus status) { |
40 loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 40 loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
41 delete this; | 41 delete this; |
42 } | 42 } |
43 private: | 43 private: |
44 MessageLoop* loop_; | 44 MessageLoop* loop_; |
45 DISALLOW_COPY_AND_ASSIGN(MessageLoopQuitter); | 45 DISALLOW_COPY_AND_ASSIGN(MessageLoopQuitter); |
46 }; | 46 }; |
47 | 47 |
48 // Initialize X11. Returns true if successful. This method creates the X11 | 48 // Initialize X11. Returns true if successful. This method creates the X11 |
49 // window. Further initialization is done in X11VideoRenderer. | 49 // window. Further initialization is done in X11VideoRenderer. |
50 bool InitX11() { | 50 bool InitX11() { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 257 } |
258 | 258 |
259 // Cleanup tasks. | 259 // Cleanup tasks. |
260 message_loop_factory.reset(); | 260 message_loop_factory.reset(); |
261 | 261 |
262 thread->Stop(); | 262 thread->Stop(); |
263 XDestroyWindow(g_display, g_window); | 263 XDestroyWindow(g_display, g_window); |
264 XCloseDisplay(g_display); | 264 XCloseDisplay(g_display); |
265 return 0; | 265 return 0; |
266 } | 266 } |
OLD | NEW |