| OLD | NEW |
| 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 "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 FakeOutputSurface::FakeOutputSurface( | 16 FakeOutputSurface::FakeOutputSurface( |
| 17 scoped_refptr<ContextProvider> context_provider, | 17 scoped_refptr<ContextProvider> context_provider, |
| 18 bool delegated_rendering) | 18 bool delegated_rendering) |
| 19 : OutputSurface(context_provider), | 19 : OutputSurface(context_provider, |
| 20 OutputSurface::kDefaultMaxTransferBufferUsageBytes), |
| 20 client_(NULL), | 21 client_(NULL), |
| 21 num_sent_frames_(0), | 22 num_sent_frames_(0), |
| 22 needs_begin_frame_(false), | 23 needs_begin_frame_(false), |
| 23 forced_draw_to_software_device_(false), | 24 forced_draw_to_software_device_(false), |
| 24 fake_weak_ptr_factory_(this) { | 25 fake_weak_ptr_factory_(this) { |
| 25 if (delegated_rendering) { | 26 if (delegated_rendering) { |
| 26 capabilities_.delegated_rendering = true; | 27 capabilities_.delegated_rendering = true; |
| 27 capabilities_.max_frames_pending = 1; | 28 capabilities_.max_frames_pending = 1; |
| 28 } | 29 } |
| 29 } | 30 } |
| 30 | 31 |
| 31 FakeOutputSurface::FakeOutputSurface( | 32 FakeOutputSurface::FakeOutputSurface( |
| 32 scoped_ptr<SoftwareOutputDevice> software_device, bool delegated_rendering) | 33 scoped_ptr<SoftwareOutputDevice> software_device, bool delegated_rendering) |
| 33 : OutputSurface(software_device.Pass()), | 34 : OutputSurface(software_device.Pass(), |
| 35 OutputSurface::kDefaultMaxTransferBufferUsageBytes), |
| 34 client_(NULL), | 36 client_(NULL), |
| 35 num_sent_frames_(0), | 37 num_sent_frames_(0), |
| 36 forced_draw_to_software_device_(false), | 38 forced_draw_to_software_device_(false), |
| 37 fake_weak_ptr_factory_(this) { | 39 fake_weak_ptr_factory_(this) { |
| 38 if (delegated_rendering) { | 40 if (delegated_rendering) { |
| 39 capabilities_.delegated_rendering = true; | 41 capabilities_.delegated_rendering = true; |
| 40 capabilities_.max_frames_pending = 1; | 42 capabilities_.max_frames_pending = 1; |
| 41 } | 43 } |
| 42 } | 44 } |
| 43 | 45 |
| 44 FakeOutputSurface::FakeOutputSurface( | 46 FakeOutputSurface::FakeOutputSurface( |
| 45 scoped_refptr<ContextProvider> context_provider, | 47 scoped_refptr<ContextProvider> context_provider, |
| 46 scoped_ptr<SoftwareOutputDevice> software_device, | 48 scoped_ptr<SoftwareOutputDevice> software_device, |
| 47 bool delegated_rendering) | 49 bool delegated_rendering) |
| 48 : OutputSurface(context_provider, software_device.Pass()), | 50 : OutputSurface(context_provider, |
| 51 software_device.Pass(), |
| 52 OutputSurface::kDefaultMaxTransferBufferUsageBytes), |
| 49 client_(NULL), | 53 client_(NULL), |
| 50 num_sent_frames_(0), | 54 num_sent_frames_(0), |
| 51 forced_draw_to_software_device_(false), | 55 forced_draw_to_software_device_(false), |
| 52 fake_weak_ptr_factory_(this) { | 56 fake_weak_ptr_factory_(this) { |
| 53 if (delegated_rendering) { | 57 if (delegated_rendering) { |
| 54 capabilities_.delegated_rendering = true; | 58 capabilities_.delegated_rendering = true; |
| 55 capabilities_.max_frames_pending = 1; | 59 capabilities_.max_frames_pending = 1; |
| 56 } | 60 } |
| 57 } | 61 } |
| 58 | 62 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 ++it) { | 129 ++it) { |
| 126 if (it->id == id) | 130 if (it->id == id) |
| 127 break; | 131 break; |
| 128 } | 132 } |
| 129 DCHECK(it != resources_held_by_parent_.end()); | 133 DCHECK(it != resources_held_by_parent_.end()); |
| 130 ack->resources.push_back(it->ToReturnedResource()); | 134 ack->resources.push_back(it->ToReturnedResource()); |
| 131 resources_held_by_parent_.erase(it); | 135 resources_held_by_parent_.erase(it); |
| 132 } | 136 } |
| 133 | 137 |
| 134 } // namespace cc | 138 } // namespace cc |
| OLD | NEW |