| 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" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 frame->AssignTo(&last_sent_frame_); | 66 frame->AssignTo(&last_sent_frame_); |
| 67 | 67 |
| 68 if (last_sent_frame_.delegated_frame_data) { | 68 if (last_sent_frame_.delegated_frame_data) { |
| 69 resources_held_by_parent_.insert( | 69 resources_held_by_parent_.insert( |
| 70 resources_held_by_parent_.end(), | 70 resources_held_by_parent_.end(), |
| 71 last_sent_frame_.delegated_frame_data->resource_list.begin(), | 71 last_sent_frame_.delegated_frame_data->resource_list.begin(), |
| 72 last_sent_frame_.delegated_frame_data->resource_list.end()); | 72 last_sent_frame_.delegated_frame_data->resource_list.end()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 ++num_sent_frames_; | 75 ++num_sent_frames_; |
| 76 PostSwapBuffersComplete(); | |
| 77 client_->DidSwapBuffers(); | |
| 78 } else { | 76 } else { |
| 79 OutputSurface::SwapBuffers(frame); | 77 last_swap_rect_ = frame->gl_frame_data->sub_buffer_rect; |
| 80 frame->AssignTo(&last_sent_frame_); | 78 frame->AssignTo(&last_sent_frame_); |
| 81 ++num_sent_frames_; | 79 ++num_sent_frames_; |
| 82 } | 80 } |
| 81 PostSwapBuffersComplete(); |
| 82 client_->DidSwapBuffers(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void FakeOutputSurface::SetNeedsBeginFrame(bool enable) { | 85 void FakeOutputSurface::SetNeedsBeginFrame(bool enable) { |
| 86 needs_begin_frame_ = enable; | 86 needs_begin_frame_ = enable; |
| 87 OutputSurface::SetNeedsBeginFrame(enable); | 87 OutputSurface::SetNeedsBeginFrame(enable); |
| 88 | 88 |
| 89 if (enable) { | 89 if (enable) { |
| 90 base::MessageLoop::current()->PostDelayedTask( | 90 base::MessageLoop::current()->PostDelayedTask( |
| 91 FROM_HERE, | 91 FROM_HERE, |
| 92 base::Bind(&FakeOutputSurface::OnBeginFrame, | 92 base::Bind(&FakeOutputSurface::OnBeginFrame, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 bool FakeOutputSurface::HasExternalStencilTest() const { | 135 bool FakeOutputSurface::HasExternalStencilTest() const { |
| 136 return has_external_stencil_test_; | 136 return has_external_stencil_test_; |
| 137 } | 137 } |
| 138 | 138 |
| 139 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( | 139 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( |
| 140 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { | 140 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { |
| 141 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); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace cc | 144 } // namespace cc |
| OLD | NEW |