| 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/output/delegating_renderer.h" | 5 #include "cc/output/delegating_renderer.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "cc/output/compositor_frame_ack.h" | |
| 14 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
| 15 #include "cc/quads/draw_quad.h" | 14 #include "cc/quads/draw_quad.h" |
| 16 #include "cc/quads/render_pass.h" | 15 #include "cc/quads/render_pass.h" |
| 17 #include "cc/resources/resource_provider.h" | 16 #include "cc/resources/resource_provider.h" |
| 18 #include "gpu/command_buffer/client/context_support.h" | 17 #include "gpu/command_buffer/client/context_support.h" |
| 19 #include "gpu/command_buffer/client/gles2_interface.h" | 18 #include "gpu/command_buffer/client/gles2_interface.h" |
| 20 | 19 |
| 21 | 20 |
| 22 namespace cc { | 21 namespace cc { |
| 23 | 22 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 98 } |
| 100 | 99 |
| 101 void DelegatingRenderer::SwapBuffers(CompositorFrameMetadata metadata) { | 100 void DelegatingRenderer::SwapBuffers(CompositorFrameMetadata metadata) { |
| 102 TRACE_EVENT0("cc,benchmark", "DelegatingRenderer::SwapBuffers"); | 101 TRACE_EVENT0("cc,benchmark", "DelegatingRenderer::SwapBuffers"); |
| 103 CompositorFrame compositor_frame; | 102 CompositorFrame compositor_frame; |
| 104 compositor_frame.metadata = std::move(metadata); | 103 compositor_frame.metadata = std::move(metadata); |
| 105 compositor_frame.delegated_frame_data = std::move(delegated_frame_data_); | 104 compositor_frame.delegated_frame_data = std::move(delegated_frame_data_); |
| 106 output_surface_->SwapBuffers(std::move(compositor_frame)); | 105 output_surface_->SwapBuffers(std::move(compositor_frame)); |
| 107 } | 106 } |
| 108 | 107 |
| 109 void DelegatingRenderer::ReceiveSwapBuffersAck( | 108 void DelegatingRenderer::ReclaimResources( |
| 110 const CompositorFrameAck& ack) { | 109 const ReturnedResourceArray& resources) { |
| 111 resource_provider_->ReceiveReturnsFromParent(ack.resources); | 110 resource_provider_->ReceiveReturnsFromParent(resources); |
| 112 } | 111 } |
| 113 | 112 |
| 114 void DelegatingRenderer::DidChangeVisibility() { | 113 void DelegatingRenderer::DidChangeVisibility() { |
| 115 ContextProvider* context_provider = output_surface_->context_provider(); | 114 ContextProvider* context_provider = output_surface_->context_provider(); |
| 116 if (!visible()) { | 115 if (!visible()) { |
| 117 TRACE_EVENT0("cc", "DelegatingRenderer::SetVisible dropping resources"); | 116 TRACE_EVENT0("cc", "DelegatingRenderer::SetVisible dropping resources"); |
| 118 if (context_provider) { | 117 if (context_provider) { |
| 119 context_provider->DeleteCachedResources(); | 118 context_provider->DeleteCachedResources(); |
| 120 context_provider->ContextGL()->Flush(); | 119 context_provider->ContextGL()->Flush(); |
| 121 } | 120 } |
| 122 } | 121 } |
| 123 if (context_provider) { | 122 if (context_provider) { |
| 124 // If we are not visible, we ask the context to aggressively free resources. | 123 // If we are not visible, we ask the context to aggressively free resources. |
| 125 context_provider->ContextSupport()->SetAggressivelyFreeResources( | 124 context_provider->ContextSupport()->SetAggressivelyFreeResources( |
| 126 !visible()); | 125 !visible()); |
| 127 } | 126 } |
| 128 } | 127 } |
| 129 | 128 |
| 130 } // namespace cc | 129 } // namespace cc |
| OLD | NEW |