| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_AURA_WINDOW_CAPTURE_MACHINE_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_AURA_WINDOW_CAPTURE_MACHINE_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_AURA_WINDOW_CAPTURE_MACHINE_H_ | 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_AURA_WINDOW_CAPTURE_MACHINE_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| 11 #include "content/browser/media/capture/cursor_renderer_aura.h" |
| 11 #include "media/capture/content/screen_capture_device_core.h" | 12 #include "media/capture/content/screen_capture_device_core.h" |
| 12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 13 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
| 14 #include "ui/base/cursor/cursors_aura.h" | 15 #include "ui/base/cursor/cursors_aura.h" |
| 15 #include "ui/compositor/compositor.h" | 16 #include "ui/compositor/compositor.h" |
| 16 | 17 |
| 17 namespace cc { | 18 namespace cc { |
| 18 | 19 |
| 19 class CopyOutputResult; | 20 class CopyOutputResult; |
| 20 | 21 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 scoped_ptr<cc::CopyOutputResult> result); | 85 scoped_ptr<cc::CopyOutputResult> result); |
| 85 | 86 |
| 86 // A helper which does the real work for DidCopyOutput. Returns true if | 87 // A helper which does the real work for DidCopyOutput. Returns true if |
| 87 // succeeded. | 88 // succeeded. |
| 88 bool ProcessCopyOutputResponse( | 89 bool ProcessCopyOutputResponse( |
| 89 scoped_refptr<media::VideoFrame> video_frame, | 90 scoped_refptr<media::VideoFrame> video_frame, |
| 90 base::TimeTicks start_time, | 91 base::TimeTicks start_time, |
| 91 const CaptureFrameCallback& capture_frame_cb, | 92 const CaptureFrameCallback& capture_frame_cb, |
| 92 scoped_ptr<cc::CopyOutputResult> result); | 93 scoped_ptr<cc::CopyOutputResult> result); |
| 93 | 94 |
| 94 // Helper function to update cursor state. | 95 // Renders the cursor if needed and then delivers the captured frame. |
| 95 // |region_in_frame| defines where the desktop is rendered in the captured | 96 static void CopyOutputFinishedForVideo( |
| 96 // frame. | 97 base::WeakPtr<AuraWindowCaptureMachine> machine, |
| 97 // Returns the current cursor position in captured frame. | 98 base::TimeTicks start_time, |
| 98 gfx::Point UpdateCursorState(const gfx::Rect& region_in_frame); | 99 const CaptureFrameCallback& capture_frame_cb, |
| 99 | 100 const scoped_refptr<media::VideoFrame>& target, |
| 100 // Clears cursor state. | 101 scoped_ptr<cc::SingleReleaseCallback> release_callback, |
| 101 void ClearCursorState(); | 102 bool result); |
| 102 | 103 |
| 103 // The window associated with the desktop. | 104 // The window associated with the desktop. |
| 104 aura::Window* desktop_window_; | 105 aura::Window* desktop_window_; |
| 105 | 106 |
| 106 // The timer that kicks off period captures. | 107 // The timer that kicks off period captures. |
| 107 base::Timer timer_; | 108 base::Timer timer_; |
| 108 | 109 |
| 109 // Whether screen capturing or window capture. | 110 // Whether screen capturing or window capture. |
| 110 bool screen_capture_; | 111 bool screen_capture_; |
| 111 | 112 |
| 112 // Makes all the decisions about which frames to copy, and how. | 113 // Makes all the decisions about which frames to copy, and how. |
| 113 scoped_refptr<media::ThreadSafeCaptureOracle> oracle_proxy_; | 114 scoped_refptr<media::ThreadSafeCaptureOracle> oracle_proxy_; |
| 114 | 115 |
| 115 // The capture parameters for this capture. | 116 // The capture parameters for this capture. |
| 116 media::VideoCaptureParams capture_params_; | 117 media::VideoCaptureParams capture_params_; |
| 117 | 118 |
| 118 // YUV readback pipeline. | 119 // YUV readback pipeline. |
| 119 scoped_ptr<content::ReadbackYUVInterface> yuv_readback_pipeline_; | 120 scoped_ptr<content::ReadbackYUVInterface> yuv_readback_pipeline_; |
| 120 | 121 |
| 121 // Cursor state. | 122 // Renders mouse cursor on frame. |
| 122 ui::Cursor last_cursor_; | 123 scoped_ptr<content::CursorRendererAura> cursor_renderer_; |
| 123 gfx::Size window_size_when_cursor_last_updated_; | |
| 124 SkBitmap scaled_cursor_bitmap_; | |
| 125 | 124 |
| 126 // TODO(jiayl): Remove power_save_blocker_ when there is an API to keep the | 125 // TODO(jiayl): Remove power_save_blocker_ when there is an API to keep the |
| 127 // screen from sleeping for the drive-by web. | 126 // screen from sleeping for the drive-by web. |
| 128 scoped_ptr<PowerSaveBlocker> power_save_blocker_; | 127 scoped_ptr<PowerSaveBlocker> power_save_blocker_; |
| 129 | 128 |
| 130 // WeakPtrs are used for the asynchronous capture callbacks passed to external | 129 // WeakPtrs are used for the asynchronous capture callbacks passed to external |
| 131 // modules. They are only valid on the UI thread and become invalidated | 130 // modules. They are only valid on the UI thread and become invalidated |
| 132 // immediately when InternalStop() is called to ensure that no more captured | 131 // immediately when InternalStop() is called to ensure that no more captured |
| 133 // frames will be delivered to the client. | 132 // frames will be delivered to the client. |
| 134 base::WeakPtrFactory<AuraWindowCaptureMachine> weak_factory_; | 133 base::WeakPtrFactory<AuraWindowCaptureMachine> weak_factory_; |
| 135 | 134 |
| 136 DISALLOW_COPY_AND_ASSIGN(AuraWindowCaptureMachine); | 135 DISALLOW_COPY_AND_ASSIGN(AuraWindowCaptureMachine); |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 } // namespace content | 138 } // namespace content |
| 140 | 139 |
| 141 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_AURA_WINDOW_CAPTURE_MACHINE_H_ | 140 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_AURA_WINDOW_CAPTURE_MACHINE_H_ |
| OLD | NEW |