OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/media/capture/desktop_capture_device_aura.h" | 5 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 cursor_bitmap.unlockPixels(); | 89 cursor_bitmap.unlockPixels(); |
90 } | 90 } |
91 | 91 |
92 class DesktopVideoCaptureMachine | 92 class DesktopVideoCaptureMachine |
93 : public VideoCaptureMachine, | 93 : public VideoCaptureMachine, |
94 public aura::WindowObserver, | 94 public aura::WindowObserver, |
95 public ui::CompositorObserver, | 95 public ui::CompositorObserver, |
96 public base::SupportsWeakPtr<DesktopVideoCaptureMachine> { | 96 public base::SupportsWeakPtr<DesktopVideoCaptureMachine> { |
97 public: | 97 public: |
98 DesktopVideoCaptureMachine(const DesktopMediaID& source); | 98 DesktopVideoCaptureMachine(const DesktopMediaID& source); |
99 virtual ~DesktopVideoCaptureMachine(); | 99 ~DesktopVideoCaptureMachine() override; |
100 | 100 |
101 // VideoCaptureFrameSource overrides. | 101 // VideoCaptureFrameSource overrides. |
102 virtual bool Start(const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, | 102 bool Start(const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, |
103 const media::VideoCaptureParams& params) override; | 103 const media::VideoCaptureParams& params) override; |
104 virtual void Stop(const base::Closure& callback) override; | 104 void Stop(const base::Closure& callback) override; |
105 | 105 |
106 // Implements aura::WindowObserver. | 106 // Implements aura::WindowObserver. |
107 virtual void OnWindowBoundsChanged(aura::Window* window, | 107 void OnWindowBoundsChanged(aura::Window* window, |
108 const gfx::Rect& old_bounds, | 108 const gfx::Rect& old_bounds, |
109 const gfx::Rect& new_bounds) override; | 109 const gfx::Rect& new_bounds) override; |
110 virtual void OnWindowDestroyed(aura::Window* window) override; | 110 void OnWindowDestroyed(aura::Window* window) override; |
111 virtual void OnWindowAddedToRootWindow(aura::Window* window) override; | 111 void OnWindowAddedToRootWindow(aura::Window* window) override; |
112 virtual void OnWindowRemovingFromRootWindow(aura::Window* window, | 112 void OnWindowRemovingFromRootWindow(aura::Window* window, |
113 aura::Window* new_root) override; | 113 aura::Window* new_root) override; |
114 | 114 |
115 // Implements ui::CompositorObserver. | 115 // Implements ui::CompositorObserver. |
116 virtual void OnCompositingDidCommit(ui::Compositor* compositor) override {} | 116 void OnCompositingDidCommit(ui::Compositor* compositor) override {} |
117 virtual void OnCompositingStarted(ui::Compositor* compositor, | 117 void OnCompositingStarted(ui::Compositor* compositor, |
118 base::TimeTicks start_time) override {} | 118 base::TimeTicks start_time) override {} |
119 virtual void OnCompositingEnded(ui::Compositor* compositor) override; | 119 void OnCompositingEnded(ui::Compositor* compositor) override; |
120 virtual void OnCompositingAborted(ui::Compositor* compositor) override {} | 120 void OnCompositingAborted(ui::Compositor* compositor) override {} |
121 virtual void OnCompositingLockStateChanged( | 121 void OnCompositingLockStateChanged(ui::Compositor* compositor) override {} |
122 ui::Compositor* compositor) override {} | |
123 | 122 |
124 private: | 123 private: |
125 // Captures a frame. | 124 // Captures a frame. |
126 // |dirty| is false for timer polls and true for compositor updates. | 125 // |dirty| is false for timer polls and true for compositor updates. |
127 void Capture(bool dirty); | 126 void Capture(bool dirty); |
128 | 127 |
129 // Update capture size. Must be called on the UI thread. | 128 // Update capture size. Must be called on the UI thread. |
130 void UpdateCaptureSize(); | 129 void UpdateCaptureSize(); |
131 | 130 |
132 // Response callback for cc::Layer::RequestCopyOfOutput(). | 131 // Response callback for cc::Layer::RequestCopyOfOutput(). |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 scoped_ptr<Client> client) { | 532 scoped_ptr<Client> client) { |
534 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 533 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
535 core_->AllocateAndStart(params, client.Pass()); | 534 core_->AllocateAndStart(params, client.Pass()); |
536 } | 535 } |
537 | 536 |
538 void DesktopCaptureDeviceAura::StopAndDeAllocate() { | 537 void DesktopCaptureDeviceAura::StopAndDeAllocate() { |
539 core_->StopAndDeAllocate(); | 538 core_->StopAndDeAllocate(); |
540 } | 539 } |
541 | 540 |
542 } // namespace content | 541 } // namespace content |
OLD | NEW |