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

Side by Side Diff: remoting/test/cyclic_frame_generator.h

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 REMOTING_TEST_CYCLIC_FRAME_GENERATOR_H_ 5 #ifndef REMOTING_TEST_CYCLIC_FRAME_GENERATOR_H_
6 #define REMOTING_TEST_CYCLIC_FRAME_GENERATOR_H_ 6 #define REMOTING_TEST_CYCLIC_FRAME_GENERATOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/time/default_tick_clock.h" 13 #include "base/time/default_tick_clock.h"
14 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" 14 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
15 15
16 namespace remoting { 16 namespace remoting {
17 namespace test { 17 namespace test {
18 18
19 // CyclicFrameGenerator generates a sequence of frames that approximates 19 // CyclicFrameGenerator generates a sequence of frames that approximates
20 // properties of a real video stream when using a desktop applications. It 20 // properties of a real video stream when using a desktop applications. It
21 // loads a sequence of reference frames and switches between them with the 21 // loads a sequence of reference frames and switches between them with the
22 // specified frequency (every 2 seconds by default). Between reference frames it 22 // specified frequency (every 2 seconds by default). Between reference frames it
(...skipping 17 matching lines...) Expand all
40 FrameInfo(int frame_id, FrameType type, base::TimeTicks timestamp); 40 FrameInfo(int frame_id, FrameType type, base::TimeTicks timestamp);
41 41
42 int frame_id = 0; 42 int frame_id = 0;
43 FrameType type = FrameType::EMPTY; 43 FrameType type = FrameType::EMPTY;
44 base::TimeTicks timestamp; 44 base::TimeTicks timestamp;
45 }; 45 };
46 46
47 static scoped_refptr<CyclicFrameGenerator> Create(); 47 static scoped_refptr<CyclicFrameGenerator> Create();
48 48
49 CyclicFrameGenerator( 49 CyclicFrameGenerator(
50 std::vector<scoped_ptr<webrtc::DesktopFrame>> reference_frames); 50 std::vector<std::unique_ptr<webrtc::DesktopFrame>> reference_frames);
51 51
52 void set_frame_cycle_period(base::TimeDelta frame_cycle_period) { 52 void set_frame_cycle_period(base::TimeDelta frame_cycle_period) {
53 frame_cycle_period_ = frame_cycle_period; 53 frame_cycle_period_ = frame_cycle_period;
54 } 54 }
55 55
56 void set_cursor_blink_period(base::TimeDelta cursor_blink_period) { 56 void set_cursor_blink_period(base::TimeDelta cursor_blink_period) {
57 cursor_blink_period_ = cursor_blink_period; 57 cursor_blink_period_ = cursor_blink_period;
58 } 58 }
59 59
60 void SetTickClock(base::TickClock* tick_clock); 60 void SetTickClock(base::TickClock* tick_clock);
61 61
62 // When |draw_barcode| is set to true a barcode is drawn on each generated 62 // When |draw_barcode| is set to true a barcode is drawn on each generated
63 // frame. This make it possible to call IdentifyFrame() to identify the frame 63 // frame. This make it possible to call IdentifyFrame() to identify the frame
64 // by its content. 64 // by its content.
65 void set_draw_barcode(bool draw_barcode) { draw_barcode_ = draw_barcode; } 65 void set_draw_barcode(bool draw_barcode) { draw_barcode_ = draw_barcode; }
66 66
67 scoped_ptr<webrtc::DesktopFrame> GenerateFrame( 67 std::unique_ptr<webrtc::DesktopFrame> GenerateFrame(
68 webrtc::SharedMemoryFactory* shared_memory_factory); 68 webrtc::SharedMemoryFactory* shared_memory_factory);
69 69
70 FrameType last_frame_type() { return last_frame_type_; } 70 FrameType last_frame_type() { return last_frame_type_; }
71 71
72 // Identifies |frame| by its content and returns FrameInfo corresponding to 72 // Identifies |frame| by its content and returns FrameInfo corresponding to
73 // the frame. 73 // the frame.
74 FrameInfo IdentifyFrame(webrtc::DesktopFrame* frame); 74 FrameInfo IdentifyFrame(webrtc::DesktopFrame* frame);
75 75
76 private: 76 private:
77 ~CyclicFrameGenerator(); 77 ~CyclicFrameGenerator();
78 friend class base::RefCountedThreadSafe<CyclicFrameGenerator>; 78 friend class base::RefCountedThreadSafe<CyclicFrameGenerator>;
79 79
80 std::vector<scoped_ptr<webrtc::DesktopFrame>> reference_frames_; 80 std::vector<std::unique_ptr<webrtc::DesktopFrame>> reference_frames_;
81 base::DefaultTickClock default_tick_clock_; 81 base::DefaultTickClock default_tick_clock_;
82 base::TickClock* clock_; 82 base::TickClock* clock_;
83 webrtc::DesktopSize screen_size_; 83 webrtc::DesktopSize screen_size_;
84 84
85 // By default switch between reference frames every 2 seconds. 85 // By default switch between reference frames every 2 seconds.
86 base::TimeDelta frame_cycle_period_ = base::TimeDelta::FromSeconds(2); 86 base::TimeDelta frame_cycle_period_ = base::TimeDelta::FromSeconds(2);
87 87
88 // By default blink the cursor 4 times per seconds. 88 // By default blink the cursor 4 times per seconds.
89 base::TimeDelta cursor_blink_period_ = base::TimeDelta::FromMilliseconds(250); 89 base::TimeDelta cursor_blink_period_ = base::TimeDelta::FromMilliseconds(250);
90 90
(...skipping 14 matching lines...) Expand all
105 105
106 std::map<int, FrameInfo> generated_frames_info_; 106 std::map<int, FrameInfo> generated_frames_info_;
107 107
108 DISALLOW_COPY_AND_ASSIGN(CyclicFrameGenerator); 108 DISALLOW_COPY_AND_ASSIGN(CyclicFrameGenerator);
109 }; 109 };
110 110
111 } // namespace test 111 } // namespace test
112 } // namespace remoting 112 } // namespace remoting
113 113
114 #endif // REMOTING_TEST_CYCLIC_FRAME_GENERATOR_H_ 114 #endif // REMOTING_TEST_CYCLIC_FRAME_GENERATOR_H_
OLDNEW
« no previous file with comments | « remoting/test/connection_time_observer_unittest.cc ('k') | remoting/test/cyclic_frame_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698