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

Side by Side Diff: cc/test/test_delegating_output_surface.cc

Issue 2162083005: Use surface copy requests for layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove DCHECK left over from debugging Created 4 years, 5 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 #include "cc/test/test_delegating_output_surface.h" 5 #include "cc/test/test_delegating_output_surface.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "cc/output/begin_frame_args.h" 10 #include "cc/output/begin_frame_args.h"
11 #include "cc/output/copy_output_request.h"
11 #include "cc/output/texture_mailbox_deleter.h" 12 #include "cc/output/texture_mailbox_deleter.h"
12 #include "cc/test/begin_frame_args_test.h" 13 #include "cc/test/begin_frame_args_test.h"
13 14
14 static constexpr uint32_t kCompositorClientId = 1; 15 static constexpr uint32_t kCompositorClientId = 1;
15 16
16 namespace cc { 17 namespace cc {
17 18
18 TestDelegatingOutputSurface::TestDelegatingOutputSurface( 19 TestDelegatingOutputSurface::TestDelegatingOutputSurface(
19 scoped_refptr<ContextProvider> compositor_context_provider, 20 scoped_refptr<ContextProvider> compositor_context_provider,
20 scoped_refptr<ContextProvider> worker_context_provider, 21 scoped_refptr<ContextProvider> worker_context_provider,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // Since this OutputSurface and the Display are tightly coupled and in the 53 // Since this OutputSurface and the Display are tightly coupled and in the
53 // same process/thread, the LayerTreeHostImpl can reclaim resources from 54 // same process/thread, the LayerTreeHostImpl can reclaim resources from
54 // the Display. 55 // the Display.
55 capabilities_.can_force_reclaim_resources = true; 56 capabilities_.can_force_reclaim_resources = true;
56 capabilities_.delegated_sync_points_required = 57 capabilities_.delegated_sync_points_required =
57 !context_shared_with_compositor; 58 !context_shared_with_compositor;
58 59
59 surface_id_allocator_->RegisterSurfaceClientId(surface_manager_.get()); 60 surface_id_allocator_->RegisterSurfaceClientId(surface_manager_.get());
60 } 61 }
61 62
62 TestDelegatingOutputSurface::~TestDelegatingOutputSurface() {} 63 TestDelegatingOutputSurface::~TestDelegatingOutputSurface() {
64 DCHECK(copy_requests_.empty());
65 }
66
67 void TestDelegatingOutputSurface::RequestCopyOfOutput(
68 std::unique_ptr<CopyOutputRequest> request) {
69 copy_requests_.push_back(std::move(request));
70 }
63 71
64 bool TestDelegatingOutputSurface::BindToClient(OutputSurfaceClient* client) { 72 bool TestDelegatingOutputSurface::BindToClient(OutputSurfaceClient* client) {
65 if (!OutputSurface::BindToClient(client)) 73 if (!OutputSurface::BindToClient(client))
66 return false; 74 return false;
67 75
68 // We want the Display's output surface to hear about lost context, and since 76 // We want the Display's output surface to hear about lost context, and since
69 // this shares a context with it (when delegated_sync_points_required is 77 // this shares a context with it (when delegated_sync_points_required is
70 // false), we should not be listening for lost context callbacks on the 78 // false), we should not be listening for lost context callbacks on the
71 // context here. 79 // context here.
72 if (!capabilities_.delegated_sync_points_required && context_provider()) 80 if (!capabilities_.delegated_sync_points_required && context_provider())
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 115
108 gfx::Size frame_size = 116 gfx::Size frame_size =
109 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); 117 frame.delegated_frame_data->render_pass_list.back()->output_rect.size();
110 display_->Resize(frame_size); 118 display_->Resize(frame_size);
111 119
112 surface_factory_->SubmitCompositorFrame( 120 surface_factory_->SubmitCompositorFrame(
113 delegated_surface_id_, std::move(frame), 121 delegated_surface_id_, std::move(frame),
114 base::Bind(&TestDelegatingOutputSurface::DrawCallback, 122 base::Bind(&TestDelegatingOutputSurface::DrawCallback,
115 weak_ptrs_.GetWeakPtr())); 123 weak_ptrs_.GetWeakPtr()));
116 124
125 for (std::unique_ptr<CopyOutputRequest>& copy_request : copy_requests_)
126 surface_factory_->RequestCopyOfSurface(delegated_surface_id_,
127 std::move(copy_request));
128 copy_requests_.clear();
129
117 if (!display_->has_scheduler()) 130 if (!display_->has_scheduler())
118 display_->DrawAndSwap(); 131 display_->DrawAndSwap();
119 } 132 }
120 133
121 void TestDelegatingOutputSurface::DrawCallback() { 134 void TestDelegatingOutputSurface::DrawCallback() {
122 client_->DidSwapBuffersComplete(); 135 client_->DidSwapBuffersComplete();
123 } 136 }
124 137
125 void TestDelegatingOutputSurface::ForceReclaimResources() { 138 void TestDelegatingOutputSurface::ForceReclaimResources() {
126 if (capabilities_.can_force_reclaim_resources && 139 if (capabilities_.can_force_reclaim_resources &&
(...skipping 28 matching lines...) Expand all
155 void TestDelegatingOutputSurface::DisplayOutputSurfaceLost() { 168 void TestDelegatingOutputSurface::DisplayOutputSurfaceLost() {
156 DidLoseOutputSurface(); 169 DidLoseOutputSurface();
157 } 170 }
158 171
159 void TestDelegatingOutputSurface::DisplaySetMemoryPolicy( 172 void TestDelegatingOutputSurface::DisplaySetMemoryPolicy(
160 const ManagedMemoryPolicy& policy) { 173 const ManagedMemoryPolicy& policy) {
161 SetMemoryPolicy(policy); 174 SetMemoryPolicy(policy);
162 } 175 }
163 176
164 } // namespace cc 177 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698