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

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

Issue 199523002: cc: Throttle swaps in Scheduler instead of OutputSurface (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: dana's comments Created 6 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
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" 9 #include "cc/output/compositor_frame_ack.h"
10 #include "cc/output/output_surface_client.h" 10 #include "cc/output/output_surface_client.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 fake_weak_ptr_factory_(this) { 56 fake_weak_ptr_factory_(this) {
57 if (delegated_rendering) { 57 if (delegated_rendering) {
58 capabilities_.delegated_rendering = true; 58 capabilities_.delegated_rendering = true;
59 capabilities_.max_frames_pending = 1; 59 capabilities_.max_frames_pending = 1;
60 } 60 }
61 } 61 }
62 62
63 FakeOutputSurface::~FakeOutputSurface() {} 63 FakeOutputSurface::~FakeOutputSurface() {}
64 64
65 void FakeOutputSurface::SwapBuffers(CompositorFrame* frame) { 65 void FakeOutputSurface::SwapBuffers(CompositorFrame* frame) {
66 // In unit tests we sometimes lose the context synchronously during a draw,
67 // so we abort the swap here if that's the case. Real implementations of
68 // OutputSurface should DCHECK that is_lost_ is false.
69 if (is_lost_)
brianderson 2014/04/12 00:09:58 I decided to DCHECK for all other OutputSurface im
danakj 2014/04/14 18:14:51 Hm, there's no point in a unit test that can't hap
brianderson 2014/04/16 22:41:53 I'm going to remove the is_lost_ checks.
70 return;
71
66 if (frame->software_frame_data || frame->delegated_frame_data || 72 if (frame->software_frame_data || frame->delegated_frame_data ||
67 !context_provider()) { 73 !context_provider()) {
68 frame->AssignTo(&last_sent_frame_); 74 frame->AssignTo(&last_sent_frame_);
69 75
70 if (last_sent_frame_.delegated_frame_data) { 76 if (last_sent_frame_.delegated_frame_data) {
71 resources_held_by_parent_.insert( 77 resources_held_by_parent_.insert(
72 resources_held_by_parent_.end(), 78 resources_held_by_parent_.end(),
73 last_sent_frame_.delegated_frame_data->resource_list.begin(), 79 last_sent_frame_.delegated_frame_data->resource_list.begin(),
74 last_sent_frame_.delegated_frame_data->resource_list.end()); 80 last_sent_frame_.delegated_frame_data->resource_list.end());
75 } 81 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 bool FakeOutputSurface::HasExternalStencilTest() const { 149 bool FakeOutputSurface::HasExternalStencilTest() const {
144 return has_external_stencil_test_; 150 return has_external_stencil_test_;
145 } 151 }
146 152
147 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( 153 void FakeOutputSurface::SetMemoryPolicyToSetAtBind(
148 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { 154 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) {
149 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); 155 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind);
150 } 156 }
151 157
152 } // namespace cc 158 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698