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

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

Issue 376683004: Pass resourceless software mode in BeginFrameArgs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment, clang-format Created 6 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 | Annotate | Revision Log
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"
11 #include "cc/resources/returned_resource.h" 11 #include "cc/resources/returned_resource.h"
12 #include "cc/test/begin_frame_args_test.h" 12 #include "cc/test/begin_frame_args_test.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace cc { 15 namespace cc {
16 16
17 FakeOutputSurface::FakeOutputSurface( 17 FakeOutputSurface::FakeOutputSurface(
18 scoped_refptr<ContextProvider> context_provider, 18 scoped_refptr<ContextProvider> context_provider,
19 bool delegated_rendering) 19 bool delegated_rendering)
20 : OutputSurface(context_provider), 20 : OutputSurface(context_provider),
21 client_(NULL), 21 client_(NULL),
22 num_sent_frames_(0), 22 num_sent_frames_(0),
23 needs_begin_frame_(false), 23 needs_begin_frame_(false),
24 forced_draw_to_software_device_(false),
25 has_external_stencil_test_(false), 24 has_external_stencil_test_(false),
26 fake_weak_ptr_factory_(this) { 25 fake_weak_ptr_factory_(this) {
27 if (delegated_rendering) { 26 if (delegated_rendering) {
28 capabilities_.delegated_rendering = true; 27 capabilities_.delegated_rendering = true;
29 capabilities_.max_frames_pending = 1; 28 capabilities_.max_frames_pending = 1;
30 } 29 }
31 } 30 }
32 31
33 FakeOutputSurface::FakeOutputSurface( 32 FakeOutputSurface::FakeOutputSurface(
34 scoped_ptr<SoftwareOutputDevice> software_device, 33 scoped_ptr<SoftwareOutputDevice> software_device,
35 bool delegated_rendering) 34 bool delegated_rendering)
36 : OutputSurface(software_device.Pass()), 35 : OutputSurface(software_device.Pass()),
37 client_(NULL), 36 client_(NULL),
38 num_sent_frames_(0), 37 num_sent_frames_(0),
39 forced_draw_to_software_device_(false),
40 has_external_stencil_test_(false), 38 has_external_stencil_test_(false),
41 fake_weak_ptr_factory_(this) { 39 fake_weak_ptr_factory_(this) {
42 if (delegated_rendering) { 40 if (delegated_rendering) {
43 capabilities_.delegated_rendering = true; 41 capabilities_.delegated_rendering = true;
44 capabilities_.max_frames_pending = 1; 42 capabilities_.max_frames_pending = 1;
45 } 43 }
46 } 44 }
47 45
48 FakeOutputSurface::FakeOutputSurface( 46 FakeOutputSurface::FakeOutputSurface(
49 scoped_refptr<ContextProvider> context_provider, 47 scoped_refptr<ContextProvider> context_provider,
50 scoped_ptr<SoftwareOutputDevice> software_device, 48 scoped_ptr<SoftwareOutputDevice> software_device,
51 bool delegated_rendering) 49 bool delegated_rendering)
52 : OutputSurface(context_provider, software_device.Pass()), 50 : OutputSurface(context_provider, software_device.Pass()),
53 client_(NULL), 51 client_(NULL),
54 num_sent_frames_(0), 52 num_sent_frames_(0),
55 forced_draw_to_software_device_(false),
56 has_external_stencil_test_(false), 53 has_external_stencil_test_(false),
57 fake_weak_ptr_factory_(this) { 54 fake_weak_ptr_factory_(this) {
58 if (delegated_rendering) { 55 if (delegated_rendering) {
59 capabilities_.delegated_rendering = true; 56 capabilities_.delegated_rendering = true;
60 capabilities_.max_frames_pending = 1; 57 capabilities_.max_frames_pending = 1;
61 } 58 }
62 } 59 }
63 60
64 FakeOutputSurface::~FakeOutputSurface() {} 61 FakeOutputSurface::~FakeOutputSurface() {}
65 62
(...skipping 30 matching lines...) Expand all
96 fake_weak_ptr_factory_.GetWeakPtr()), 93 fake_weak_ptr_factory_.GetWeakPtr()),
97 base::TimeDelta::FromMilliseconds(16)); 94 base::TimeDelta::FromMilliseconds(16));
98 } 95 }
99 } 96 }
100 97
101 void FakeOutputSurface::OnBeginFrame() { 98 void FakeOutputSurface::OnBeginFrame() {
102 client_->BeginFrame(CreateBeginFrameArgsForTesting()); 99 client_->BeginFrame(CreateBeginFrameArgsForTesting());
103 } 100 }
104 101
105 102
106 bool FakeOutputSurface::ForcedDrawToSoftwareDevice() const {
107 return forced_draw_to_software_device_;
108 }
109
110 bool FakeOutputSurface::BindToClient(OutputSurfaceClient* client) { 103 bool FakeOutputSurface::BindToClient(OutputSurfaceClient* client) {
111 if (OutputSurface::BindToClient(client)) { 104 if (OutputSurface::BindToClient(client)) {
112 client_ = client; 105 client_ = client;
113 if (memory_policy_to_set_at_bind_) { 106 if (memory_policy_to_set_at_bind_) {
114 client_->SetMemoryPolicy(*memory_policy_to_set_at_bind_.get()); 107 client_->SetMemoryPolicy(*memory_policy_to_set_at_bind_.get());
115 memory_policy_to_set_at_bind_.reset(); 108 memory_policy_to_set_at_bind_.reset();
116 } 109 }
117 return true; 110 return true;
118 } else { 111 } else {
119 return false; 112 return false;
(...skipping 22 matching lines...) Expand all
142 bool FakeOutputSurface::HasExternalStencilTest() const { 135 bool FakeOutputSurface::HasExternalStencilTest() const {
143 return has_external_stencil_test_; 136 return has_external_stencil_test_;
144 } 137 }
145 138
146 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( 139 void FakeOutputSurface::SetMemoryPolicyToSetAtBind(
147 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { 140 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) {
148 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); 141 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind);
149 } 142 }
150 143
151 } // namespace cc 144 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698