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

Side by Side Diff: media/video/capture/screen/screen_capturer_x11.cc

Issue 14305004: Simplify ScreenCapturer interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « media/video/capture/screen/screen_capturer_win.cc ('k') | remoting/host/chromoting_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "media/video/capture/screen/screen_capturer.h" 5 #include "media/video/capture/screen/screen_capturer.h"
6 6
7 #include <X11/extensions/Xdamage.h> 7 #include <X11/extensions/Xdamage.h>
8 #include <X11/extensions/Xfixes.h> 8 #include <X11/extensions/Xfixes.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 #include <X11/Xutil.h> 10 #include <X11/Xutil.h>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 class ScreenCapturerLinux : public ScreenCapturer { 45 class ScreenCapturerLinux : public ScreenCapturer {
46 public: 46 public:
47 ScreenCapturerLinux(); 47 ScreenCapturerLinux();
48 virtual ~ScreenCapturerLinux(); 48 virtual ~ScreenCapturerLinux();
49 49
50 // TODO(ajwong): Do we really want this to be synchronous? 50 // TODO(ajwong): Do we really want this to be synchronous?
51 bool Init(bool use_x_damage); 51 bool Init(bool use_x_damage);
52 52
53 // Capturer interface. 53 // Capturer interface.
54 virtual void Start(Delegate* delegate) OVERRIDE; 54 virtual void Start(Delegate* delegate) OVERRIDE;
55 virtual void Stop() OVERRIDE;
56 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE;
57 virtual void CaptureFrame() OVERRIDE; 55 virtual void CaptureFrame() OVERRIDE;
58 56
59 private: 57 private:
60 void InitXDamage(); 58 void InitXDamage();
61 59
62 // Read and handle all currently-pending XEvents. 60 // Read and handle all currently-pending XEvents.
63 // In the DAMAGE case, process the XDamage events and store the resulting 61 // In the DAMAGE case, process the XDamage events and store the resulting
64 // damage rectangles in the ScreenCapturerHelper. 62 // damage rectangles in the ScreenCapturerHelper.
65 // In all cases, call ScreenConfigurationChanged() in response to any 63 // In all cases, call ScreenConfigurationChanged() in response to any
66 // ConfigNotify events. 64 // ConfigNotify events.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 use_damage_ = true; 269 use_damage_ = true;
272 LOG(INFO) << "Using XDamage extension."; 270 LOG(INFO) << "Using XDamage extension.";
273 } 271 }
274 272
275 void ScreenCapturerLinux::Start(Delegate* delegate) { 273 void ScreenCapturerLinux::Start(Delegate* delegate) {
276 DCHECK(delegate_ == NULL); 274 DCHECK(delegate_ == NULL);
277 275
278 delegate_ = delegate; 276 delegate_ = delegate;
279 } 277 }
280 278
281 void ScreenCapturerLinux::Stop() {
282 }
283
284 void ScreenCapturerLinux::InvalidateRegion(const SkRegion& invalid_region) {
285 helper_.InvalidateRegion(invalid_region);
286 }
287
288 void ScreenCapturerLinux::CaptureFrame() { 279 void ScreenCapturerLinux::CaptureFrame() {
289 base::Time capture_start_time = base::Time::Now(); 280 base::Time capture_start_time = base::Time::Now();
290 281
291 // Process XEvents for XDamage and cursor shape tracking. 282 // Process XEvents for XDamage and cursor shape tracking.
292 ProcessPendingXEvents(); 283 ProcessPendingXEvents();
293 284
294 // If the current buffer is from an older generation then allocate a new one. 285 // If the current buffer is from an older generation then allocate a new one.
295 // Note that we can't reallocate other buffers at this point, since the caller 286 // Note that we can't reallocate other buffers at this point, since the caller
296 // may still be reading from them. 287 // may still be reading from them.
297 if (queue_.current_frame_needs_update()) { 288 if (queue_.current_frame_needs_update()) {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 // static 629 // static
639 scoped_ptr<ScreenCapturer> ScreenCapturer::CreateWithXDamage( 630 scoped_ptr<ScreenCapturer> ScreenCapturer::CreateWithXDamage(
640 bool use_x_damage) { 631 bool use_x_damage) {
641 scoped_ptr<ScreenCapturerLinux> capturer(new ScreenCapturerLinux()); 632 scoped_ptr<ScreenCapturerLinux> capturer(new ScreenCapturerLinux());
642 if (!capturer->Init(use_x_damage)) 633 if (!capturer->Init(use_x_damage))
643 capturer.reset(); 634 capturer.reset();
644 return capturer.PassAs<ScreenCapturer>(); 635 return capturer.PassAs<ScreenCapturer>();
645 } 636 }
646 637
647 } // namespace media 638 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/screen/screen_capturer_win.cc ('k') | remoting/host/chromoting_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698