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

Side by Side Diff: content/browser/media/capture/aura_window_capture_machine.h

Issue 1865283003: Revert of Tab/Desktop Capture: Use requests instead of timer-based refreshing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@video_refresh_from_sinks
Patch Set: Created 4 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
« no previous file with comments | « no previous file | content/browser/media/capture/aura_window_capture_machine.cc » ('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 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/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/timer/timer.h"
11 #include "content/browser/media/capture/cursor_renderer_aura.h" 12 #include "content/browser/media/capture/cursor_renderer_aura.h"
12 #include "media/capture/content/screen_capture_device_core.h" 13 #include "media/capture/content/screen_capture_device_core.h"
13 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
14 #include "ui/aura/window_observer.h" 15 #include "ui/aura/window_observer.h"
15 #include "ui/base/cursor/cursors_aura.h" 16 #include "ui/base/cursor/cursors_aura.h"
16 #include "ui/compositor/compositor.h" 17 #include "ui/compositor/compositor.h"
17 18
18 namespace cc { 19 namespace cc {
19 20
20 class CopyOutputResult; 21 class CopyOutputResult;
(...skipping 11 matching lines...) Expand all
32 public ui::CompositorObserver { 33 public ui::CompositorObserver {
33 public: 34 public:
34 AuraWindowCaptureMachine(); 35 AuraWindowCaptureMachine();
35 ~AuraWindowCaptureMachine() override; 36 ~AuraWindowCaptureMachine() override;
36 37
37 // VideoCaptureMachine overrides. 38 // VideoCaptureMachine overrides.
38 void Start(const scoped_refptr<media::ThreadSafeCaptureOracle>& oracle_proxy, 39 void Start(const scoped_refptr<media::ThreadSafeCaptureOracle>& oracle_proxy,
39 const media::VideoCaptureParams& params, 40 const media::VideoCaptureParams& params,
40 const base::Callback<void(bool)> callback) override; 41 const base::Callback<void(bool)> callback) override;
41 void Stop(const base::Closure& callback) override; 42 void Stop(const base::Closure& callback) override;
42 void MaybeCaptureForRefresh() override;
43 43
44 // Implements aura::WindowObserver. 44 // Implements aura::WindowObserver.
45 void OnWindowBoundsChanged(aura::Window* window, 45 void OnWindowBoundsChanged(aura::Window* window,
46 const gfx::Rect& old_bounds, 46 const gfx::Rect& old_bounds,
47 const gfx::Rect& new_bounds) override; 47 const gfx::Rect& new_bounds) override;
48 void OnWindowDestroying(aura::Window* window) override; 48 void OnWindowDestroying(aura::Window* window) override;
49 void OnWindowAddedToRootWindow(aura::Window* window) override; 49 void OnWindowAddedToRootWindow(aura::Window* window) override;
50 void OnWindowRemovingFromRootWindow(aura::Window* window, 50 void OnWindowRemovingFromRootWindow(aura::Window* window,
51 aura::Window* new_root) override; 51 aura::Window* new_root) override;
52 52
53 // Implements ui::CompositorObserver. 53 // Implements ui::CompositorObserver.
54 void OnCompositingDidCommit(ui::Compositor* compositor) override {} 54 void OnCompositingDidCommit(ui::Compositor* compositor) override {}
55 void OnCompositingStarted(ui::Compositor* compositor, 55 void OnCompositingStarted(ui::Compositor* compositor,
56 base::TimeTicks start_time) override {} 56 base::TimeTicks start_time) override {}
57 void OnCompositingEnded(ui::Compositor* compositor) override; 57 void OnCompositingEnded(ui::Compositor* compositor) override;
58 void OnCompositingAborted(ui::Compositor* compositor) override {} 58 void OnCompositingAborted(ui::Compositor* compositor) override {}
59 void OnCompositingLockStateChanged(ui::Compositor* compositor) override {} 59 void OnCompositingLockStateChanged(ui::Compositor* compositor) override {}
60 void OnCompositingShuttingDown(ui::Compositor* compositor) override {} 60 void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
61 61
62 // Sets the window to use for capture. 62 // Sets the window to use for capture.
63 void SetWindow(aura::Window* window); 63 void SetWindow(aura::Window* window);
64 64
65 private: 65 private:
66 bool InternalStart( 66 bool InternalStart(
67 const scoped_refptr<media::ThreadSafeCaptureOracle>& oracle_proxy, 67 const scoped_refptr<media::ThreadSafeCaptureOracle>& oracle_proxy,
68 const media::VideoCaptureParams& params); 68 const media::VideoCaptureParams& params);
69 void InternalStop(const base::Closure& callback); 69 void InternalStop(const base::Closure& callback);
70 70
71 // Captures a frame. 71 // Captures a frame.
72 // |dirty| is false for refresh requests and true for compositor updates. 72 // |dirty| is false for timer polls and true for compositor updates.
73 void Capture(bool dirty); 73 void Capture(bool dirty);
74 74
75 // Update capture size. Must be called on the UI thread. 75 // Update capture size. Must be called on the UI thread.
76 void UpdateCaptureSize(); 76 void UpdateCaptureSize();
77 77
78 using CaptureFrameCallback = 78 using CaptureFrameCallback =
79 media::ThreadSafeCaptureOracle::CaptureFrameCallback; 79 media::ThreadSafeCaptureOracle::CaptureFrameCallback;
80 80
81 // Response callback for cc::Layer::RequestCopyOfOutput(). 81 // Response callback for cc::Layer::RequestCopyOfOutput().
82 void DidCopyOutput( 82 void DidCopyOutput(
(...skipping 15 matching lines...) Expand all
98 base::WeakPtr<AuraWindowCaptureMachine> machine, 98 base::WeakPtr<AuraWindowCaptureMachine> machine,
99 base::TimeTicks start_time, 99 base::TimeTicks start_time,
100 const CaptureFrameCallback& capture_frame_cb, 100 const CaptureFrameCallback& capture_frame_cb,
101 const scoped_refptr<media::VideoFrame>& target, 101 const scoped_refptr<media::VideoFrame>& target,
102 scoped_ptr<cc::SingleReleaseCallback> release_callback, 102 scoped_ptr<cc::SingleReleaseCallback> release_callback,
103 bool result); 103 bool result);
104 104
105 // The window associated with the desktop. 105 // The window associated with the desktop.
106 aura::Window* desktop_window_; 106 aura::Window* desktop_window_;
107 107
108 // The timer that kicks off period captures.
109 base::Timer timer_;
110
108 // Whether screen capturing or window capture. 111 // Whether screen capturing or window capture.
109 bool screen_capture_; 112 bool screen_capture_;
110 113
111 // Makes all the decisions about which frames to copy, and how. 114 // Makes all the decisions about which frames to copy, and how.
112 scoped_refptr<media::ThreadSafeCaptureOracle> oracle_proxy_; 115 scoped_refptr<media::ThreadSafeCaptureOracle> oracle_proxy_;
113 116
114 // The capture parameters for this capture. 117 // The capture parameters for this capture.
115 media::VideoCaptureParams capture_params_; 118 media::VideoCaptureParams capture_params_;
116 119
117 // YUV readback pipeline. 120 // YUV readback pipeline.
(...skipping 11 matching lines...) Expand all
129 // immediately when InternalStop() is called to ensure that no more captured 132 // immediately when InternalStop() is called to ensure that no more captured
130 // frames will be delivered to the client. 133 // frames will be delivered to the client.
131 base::WeakPtrFactory<AuraWindowCaptureMachine> weak_factory_; 134 base::WeakPtrFactory<AuraWindowCaptureMachine> weak_factory_;
132 135
133 DISALLOW_COPY_AND_ASSIGN(AuraWindowCaptureMachine); 136 DISALLOW_COPY_AND_ASSIGN(AuraWindowCaptureMachine);
134 }; 137 };
135 138
136 } // namespace content 139 } // namespace content
137 140
138 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_AURA_WINDOW_CAPTURE_MACHINE_H_ 141 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_AURA_WINDOW_CAPTURE_MACHINE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/capture/aura_window_capture_machine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698