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

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

Issue 2147873003: cc: Dedup IPCs to return resources to client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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
« no previous file with comments | « cc/surfaces/surface_display_output_surface.cc ('k') | cc/test/fake_output_surface_client.h » ('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 #include "cc/test/fake_output_surface.h" 5 #include "cc/test/fake_output_surface.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "cc/output/compositor_frame_ack.h"
10 #include "cc/output/output_surface_client.h" 9 #include "cc/output/output_surface_client.h"
11 #include "cc/resources/returned_resource.h" 10 #include "cc/resources/returned_resource.h"
12 #include "cc/test/begin_frame_args_test.h" 11 #include "cc/test/begin_frame_args_test.h"
13 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
14 13
15 namespace cc { 14 namespace cc {
16 15
17 FakeOutputSurface::FakeOutputSurface( 16 FakeOutputSurface::FakeOutputSurface(
18 scoped_refptr<ContextProvider> context_provider, 17 scoped_refptr<ContextProvider> context_provider,
19 scoped_refptr<ContextProvider> worker_context_provider, 18 scoped_refptr<ContextProvider> worker_context_provider,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( 123 void FakeOutputSurface::SetMemoryPolicyToSetAtBind(
125 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { 124 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) {
126 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); 125 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind);
127 } 126 }
128 127
129 void FakeOutputSurface::ReturnResourcesHeldByParent() { 128 void FakeOutputSurface::ReturnResourcesHeldByParent() {
130 // Check |delegated_frame_data| because we shouldn't reclaim resources 129 // Check |delegated_frame_data| because we shouldn't reclaim resources
131 // for the Display which does not swap delegated frames. 130 // for the Display which does not swap delegated frames.
132 if (last_sent_frame_ && last_sent_frame_->delegated_frame_data) { 131 if (last_sent_frame_ && last_sent_frame_->delegated_frame_data) {
133 // Return the last frame's resources immediately. 132 // Return the last frame's resources immediately.
134 CompositorFrameAck ack; 133 ReturnedResourceArray resources;
135 for (const auto& resource : resources_held_by_parent_) 134 for (const auto& resource : resources_held_by_parent_)
136 ack.resources.push_back(resource.ToReturnedResource()); 135 resources.push_back(resource.ToReturnedResource());
137 resources_held_by_parent_.clear(); 136 resources_held_by_parent_.clear();
138 client_->ReclaimResources(&ack); 137 client_->ReclaimResources(resources);
139 } 138 }
140 } 139 }
141 140
142 } // namespace cc 141 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_display_output_surface.cc ('k') | cc/test/fake_output_surface_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698