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

Side by Side Diff: remoting/test/test_video_renderer.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
« no previous file with comments | « remoting/test/test_chromoting_client_unittest.cc ('k') | remoting/test/test_video_renderer.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 REMOTING_TEST_TEST_VIDEO_RENDERER_H_ 5 #ifndef REMOTING_TEST_TEST_VIDEO_RENDERER_H_
6 #define REMOTING_TEST_TEST_VIDEO_RENDERER_H_ 6 #define REMOTING_TEST_TEST_VIDEO_RENDERER_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
12 #include "remoting/protocol/session_config.h" 13 #include "remoting/protocol/session_config.h"
13 #include "remoting/protocol/video_renderer.h" 14 #include "remoting/protocol/video_renderer.h"
14 #include "remoting/protocol/video_stub.h" 15 #include "remoting/protocol/video_stub.h"
15 16
16 namespace base { 17 namespace base {
17 class Thread; 18 class Thread;
18 class SingleThreadTaskRunner; 19 class SingleThreadTaskRunner;
19 } 20 }
(...skipping 17 matching lines...) Expand all
37 public: 38 public:
38 TestVideoRenderer(); 39 TestVideoRenderer();
39 ~TestVideoRenderer() override; 40 ~TestVideoRenderer() override;
40 41
41 // VideoRenderer interface. 42 // VideoRenderer interface.
42 void OnSessionConfig(const protocol::SessionConfig& config) override; 43 void OnSessionConfig(const protocol::SessionConfig& config) override;
43 protocol::VideoStub* GetVideoStub() override; 44 protocol::VideoStub* GetVideoStub() override;
44 protocol::FrameConsumer* GetFrameConsumer() override; 45 protocol::FrameConsumer* GetFrameConsumer() override;
45 46
46 // protocol::VideoStub interface. 47 // protocol::VideoStub interface.
47 void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, 48 void ProcessVideoPacket(std::unique_ptr<VideoPacket> video_packet,
48 const base::Closure& done) override; 49 const base::Closure& done) override;
49 50
50 // Initialize a decoder to decode video packets. 51 // Initialize a decoder to decode video packets.
51 void SetCodecForDecoding(const protocol::ChannelConfig::Codec codec); 52 void SetCodecForDecoding(const protocol::ChannelConfig::Codec codec);
52 53
53 // Returns a copy of the current frame. 54 // Returns a copy of the current frame.
54 scoped_ptr<webrtc::DesktopFrame> GetCurrentFrameForTest() const; 55 std::unique_ptr<webrtc::DesktopFrame> GetCurrentFrameForTest() const;
55 56
56 // Gets a weak pointer for this object. 57 // Gets a weak pointer for this object.
57 base::WeakPtr<TestVideoRenderer> GetWeakPtr() { 58 base::WeakPtr<TestVideoRenderer> GetWeakPtr() {
58 return weak_factory_.GetWeakPtr(); 59 return weak_factory_.GetWeakPtr();
59 } 60 }
60 61
61 // Set expected rect and average color for comparison and the callback will be 62 // Set expected rect and average color for comparison and the callback will be
62 // called when the pattern is matched. 63 // called when the pattern is matched.
63 void ExpectAverageColorInRect( 64 void ExpectAverageColorInRect(
64 const webrtc::DesktopRect& expected_rect, 65 const webrtc::DesktopRect& expected_rect,
65 const RGBValue& expected_average_color, 66 const RGBValue& expected_average_color,
66 const base::Closure& image_pattern_matched_callback); 67 const base::Closure& image_pattern_matched_callback);
67 68
68 // Turn on/off saving video frames to disk. 69 // Turn on/off saving video frames to disk.
69 void SaveFrameDataToDisk(bool save_frame_data_to_disk); 70 void SaveFrameDataToDisk(bool save_frame_data_to_disk);
70 71
71 private: 72 private:
72 // The actual implementation resides in Core class. 73 // The actual implementation resides in Core class.
73 class Core; 74 class Core;
74 scoped_ptr<Core> core_; 75 std::unique_ptr<Core> core_;
75 76
76 // Used to ensure TestVideoRenderer methods are called on the same thread. 77 // Used to ensure TestVideoRenderer methods are called on the same thread.
77 base::ThreadChecker thread_checker_; 78 base::ThreadChecker thread_checker_;
78 79
79 // Used to decode and process video packets. 80 // Used to decode and process video packets.
80 scoped_ptr<base::Thread> video_decode_thread_; 81 std::unique_ptr<base::Thread> video_decode_thread_;
81 82
82 // Used to post tasks to video decode thread. 83 // Used to post tasks to video decode thread.
83 scoped_refptr<base::SingleThreadTaskRunner> video_decode_task_runner_; 84 scoped_refptr<base::SingleThreadTaskRunner> video_decode_task_runner_;
84 85
85 // Used to weakly bind |this| to methods. 86 // Used to weakly bind |this| to methods.
86 // NOTE: Weak pointers must be invalidated before all other member variables. 87 // NOTE: Weak pointers must be invalidated before all other member variables.
87 base::WeakPtrFactory<TestVideoRenderer> weak_factory_; 88 base::WeakPtrFactory<TestVideoRenderer> weak_factory_;
88 89
89 DISALLOW_COPY_AND_ASSIGN(TestVideoRenderer); 90 DISALLOW_COPY_AND_ASSIGN(TestVideoRenderer);
90 }; 91 };
91 92
92 } // namespace test 93 } // namespace test
93 } // namespace remoting 94 } // namespace remoting
94 95
95 #endif // REMOTING_TEST_TEST_VIDEO_RENDERER_H_ 96 #endif // REMOTING_TEST_TEST_VIDEO_RENDERER_H_
OLDNEW
« no previous file with comments | « remoting/test/test_chromoting_client_unittest.cc ('k') | remoting/test/test_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698