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

Side by Side Diff: cc/surfaces/direct_compositor_frame_sink.cc

Issue 2633563003: Revert of Remove ForceReclaimResources (Closed)
Patch Set: Created 3 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/surfaces/direct_compositor_frame_sink.h" 5 #include "cc/surfaces/direct_compositor_frame_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_sink_client.h" 9 #include "cc/output/compositor_frame_sink_client.h"
10 #include "cc/surfaces/display.h" 10 #include "cc/surfaces/display.h"
(...skipping 14 matching lines...) Expand all
25 SharedBitmapManager* shared_bitmap_manager) 25 SharedBitmapManager* shared_bitmap_manager)
26 : CompositorFrameSink(std::move(context_provider), 26 : CompositorFrameSink(std::move(context_provider),
27 std::move(worker_context_provider), 27 std::move(worker_context_provider),
28 gpu_memory_buffer_manager, 28 gpu_memory_buffer_manager,
29 shared_bitmap_manager), 29 shared_bitmap_manager),
30 frame_sink_id_(frame_sink_id), 30 frame_sink_id_(frame_sink_id),
31 surface_manager_(surface_manager), 31 surface_manager_(surface_manager),
32 display_(display), 32 display_(display),
33 factory_(frame_sink_id, surface_manager, this) { 33 factory_(frame_sink_id, surface_manager, this) {
34 DCHECK(thread_checker_.CalledOnValidThread()); 34 DCHECK(thread_checker_.CalledOnValidThread());
35 capabilities_.must_always_swap = true; 35 capabilities_.can_force_reclaim_resources = true;
36 // Display and DirectCompositorFrameSink share a GL context, so sync 36 // Display and DirectCompositorFrameSink share a GL context, so sync
37 // points aren't needed when passing resources between them. 37 // points aren't needed when passing resources between them.
38 capabilities_.delegated_sync_points_required = false; 38 capabilities_.delegated_sync_points_required = false;
39 factory_.set_needs_sync_points(false); 39 factory_.set_needs_sync_points(false);
40 } 40 }
41 41
42 DirectCompositorFrameSink::DirectCompositorFrameSink( 42 DirectCompositorFrameSink::DirectCompositorFrameSink(
43 const FrameSinkId& frame_sink_id, 43 const FrameSinkId& frame_sink_id,
44 SurfaceManager* surface_manager, 44 SurfaceManager* surface_manager,
45 Display* display, 45 Display* display,
46 scoped_refptr<VulkanContextProvider> vulkan_context_provider) 46 scoped_refptr<VulkanContextProvider> vulkan_context_provider)
47 : CompositorFrameSink(std::move(vulkan_context_provider)), 47 : CompositorFrameSink(std::move(vulkan_context_provider)),
48 frame_sink_id_(frame_sink_id), 48 frame_sink_id_(frame_sink_id),
49 surface_manager_(surface_manager), 49 surface_manager_(surface_manager),
50 display_(display), 50 display_(display),
51 factory_(frame_sink_id_, surface_manager, this) { 51 factory_(frame_sink_id_, surface_manager, this) {
52 DCHECK(thread_checker_.CalledOnValidThread()); 52 DCHECK(thread_checker_.CalledOnValidThread());
53 capabilities_.must_always_swap = true; 53 capabilities_.can_force_reclaim_resources = true;
54 } 54 }
55 55
56 DirectCompositorFrameSink::~DirectCompositorFrameSink() { 56 DirectCompositorFrameSink::~DirectCompositorFrameSink() {
57 DCHECK(thread_checker_.CalledOnValidThread()); 57 DCHECK(thread_checker_.CalledOnValidThread());
58 } 58 }
59 59
60 bool DirectCompositorFrameSink::BindToClient( 60 bool DirectCompositorFrameSink::BindToClient(
61 CompositorFrameSinkClient* client) { 61 CompositorFrameSinkClient* client) {
62 DCHECK(thread_checker_.CalledOnValidThread()); 62 DCHECK(thread_checker_.CalledOnValidThread());
63 63
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 display_->SetLocalFrameId(delegated_local_frame_id_, 96 display_->SetLocalFrameId(delegated_local_frame_id_,
97 frame.metadata.device_scale_factor); 97 frame.metadata.device_scale_factor);
98 98
99 factory_.SubmitCompositorFrame( 99 factory_.SubmitCompositorFrame(
100 delegated_local_frame_id_, std::move(frame), 100 delegated_local_frame_id_, std::move(frame),
101 base::Bind(&DirectCompositorFrameSink::DidDrawCallback, 101 base::Bind(&DirectCompositorFrameSink::DidDrawCallback,
102 base::Unretained(this))); 102 base::Unretained(this)));
103 } 103 }
104 104
105 void DirectCompositorFrameSink::ForceReclaimResources() {
106 if (delegated_local_frame_id_.is_valid())
107 factory_.ClearSurface();
108 }
109
105 void DirectCompositorFrameSink::ReturnResources( 110 void DirectCompositorFrameSink::ReturnResources(
106 const ReturnedResourceArray& resources) { 111 const ReturnedResourceArray& resources) {
107 if (client_) 112 if (client_)
108 client_->ReclaimResources(resources); 113 client_->ReclaimResources(resources);
109 } 114 }
110 115
111 void DirectCompositorFrameSink::SetBeginFrameSource( 116 void DirectCompositorFrameSink::SetBeginFrameSource(
112 BeginFrameSource* begin_frame_source) { 117 BeginFrameSource* begin_frame_source) {
113 DCHECK(client_); 118 DCHECK(client_);
114 client_->SetBeginFrameSource(begin_frame_source); 119 client_->SetBeginFrameSource(begin_frame_source);
(...skipping 14 matching lines...) Expand all
129 // This notification is not relevant to our client outside of tests. We 134 // This notification is not relevant to our client outside of tests. We
130 // unblock the client from DidDrawCallback() when the surface is going to 135 // unblock the client from DidDrawCallback() when the surface is going to
131 // be drawn. 136 // be drawn.
132 } 137 }
133 138
134 void DirectCompositorFrameSink::DidDrawCallback() { 139 void DirectCompositorFrameSink::DidDrawCallback() {
135 client_->DidReceiveCompositorFrameAck(); 140 client_->DidReceiveCompositorFrameAck();
136 } 141 }
137 142
138 } // namespace cc 143 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/direct_compositor_frame_sink.h ('k') | cc/surfaces/direct_compositor_frame_sink_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698