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

Side by Side Diff: cc/test/fake_compositor_frame_sink.h

Issue 2752303002: views/mus: Install a mus-friend ContextFactory for tests. (Closed)
Patch Set: . Created 3 years, 9 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 | « ash/mus/non_client_frame_controller_unittest.cc ('k') | cc/test/fake_compositor_frame_sink.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ 5 #ifndef CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_
6 #define CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ 6 #define CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "cc/output/begin_frame_args.h" 15 #include "cc/output/begin_frame_args.h"
16 #include "cc/output/compositor_frame.h" 16 #include "cc/output/compositor_frame.h"
17 #include "cc/output/compositor_frame_sink.h" 17 #include "cc/output/compositor_frame_sink.h"
18 #include "cc/output/software_output_device.h" 18 #include "cc/output/software_output_device.h"
19 #include "cc/test/test_context_provider.h" 19 #include "cc/test/test_context_provider.h"
20 #include "cc/test/test_gles2_interface.h" 20 #include "cc/test/test_gles2_interface.h"
21 #include "cc/test/test_gpu_memory_buffer_manager.h" 21 #include "cc/test/test_gpu_memory_buffer_manager.h"
22 #include "cc/test/test_shared_bitmap_manager.h" 22 #include "cc/test/test_shared_bitmap_manager.h"
23 #include "cc/test/test_web_graphics_context_3d.h" 23 #include "cc/test/test_web_graphics_context_3d.h"
24 24
25 namespace cc { 25 namespace cc {
26 26
27 class BeginFrameSource;
28
27 class FakeCompositorFrameSink : public CompositorFrameSink { 29 class FakeCompositorFrameSink : public CompositorFrameSink {
28 public: 30 public:
29 ~FakeCompositorFrameSink() override; 31 ~FakeCompositorFrameSink() override;
30 32
31 static std::unique_ptr<FakeCompositorFrameSink> Create3d() { 33 static std::unique_ptr<FakeCompositorFrameSink> Create3d() {
32 return base::WrapUnique(new FakeCompositorFrameSink( 34 return base::WrapUnique(new FakeCompositorFrameSink(
33 TestContextProvider::Create(), TestContextProvider::CreateWorker())); 35 TestContextProvider::Create(), TestContextProvider::CreateWorker()));
34 } 36 }
35 37
36 static std::unique_ptr<FakeCompositorFrameSink> Create3d( 38 static std::unique_ptr<FakeCompositorFrameSink> Create3d(
(...skipping 17 matching lines...) Expand all
54 return base::WrapUnique(new FakeCompositorFrameSink( 56 return base::WrapUnique(new FakeCompositorFrameSink(
55 std::move(context_provider), TestContextProvider::CreateWorker())); 57 std::move(context_provider), TestContextProvider::CreateWorker()));
56 } 58 }
57 59
58 static std::unique_ptr<FakeCompositorFrameSink> CreateSoftware() { 60 static std::unique_ptr<FakeCompositorFrameSink> CreateSoftware() {
59 return base::WrapUnique(new FakeCompositorFrameSink(nullptr, nullptr)); 61 return base::WrapUnique(new FakeCompositorFrameSink(nullptr, nullptr));
60 } 62 }
61 63
62 // CompositorFrameSink implementation. 64 // CompositorFrameSink implementation.
63 void SubmitCompositorFrame(CompositorFrame frame) override; 65 void SubmitCompositorFrame(CompositorFrame frame) override;
66 bool BindToClient(CompositorFrameSinkClient* client) override;
64 void DetachFromClient() override; 67 void DetachFromClient() override;
65 68
66 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); } 69 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); }
67 size_t num_sent_frames() { return num_sent_frames_; } 70 size_t num_sent_frames() { return num_sent_frames_; }
68 71
69 CompositorFrameSinkClient* client() { return client_; } 72 CompositorFrameSinkClient* client() { return client_; }
70 73
71 const TransferableResourceArray& resources_held_by_parent() { 74 const TransferableResourceArray& resources_held_by_parent() {
72 return resources_held_by_parent_; 75 return resources_held_by_parent_;
73 } 76 }
(...skipping 15 matching lines...) Expand all
89 92
90 std::unique_ptr<CompositorFrame> last_sent_frame_; 93 std::unique_ptr<CompositorFrame> last_sent_frame_;
91 size_t num_sent_frames_ = 0; 94 size_t num_sent_frames_ = 0;
92 TransferableResourceArray resources_held_by_parent_; 95 TransferableResourceArray resources_held_by_parent_;
93 bool last_swap_rect_valid_ = false; 96 bool last_swap_rect_valid_ = false;
94 gfx::Rect last_swap_rect_; 97 gfx::Rect last_swap_rect_;
95 98
96 private: 99 private:
97 void DidReceiveCompositorFrameAck(); 100 void DidReceiveCompositorFrameAck();
98 101
102 std::unique_ptr<BeginFrameSource> begin_frame_source_;
99 base::WeakPtrFactory<FakeCompositorFrameSink> weak_ptr_factory_; 103 base::WeakPtrFactory<FakeCompositorFrameSink> weak_ptr_factory_;
100 }; 104 };
101 105
102 } // namespace cc 106 } // namespace cc
103 107
104 #endif // CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ 108 #endif // CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_
OLDNEW
« no previous file with comments | « ash/mus/non_client_frame_controller_unittest.cc ('k') | cc/test/fake_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698