| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/renderer_host/compositor_impl_android.h" | 5 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 return false; | 247 return false; |
| 248 | 248 |
| 249 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( | 249 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( |
| 250 swap_buffers_completion_callback_.callback()); | 250 swap_buffers_completion_callback_.callback()); |
| 251 | 251 |
| 252 populate_gpu_capabilities_callback_.Run( | 252 populate_gpu_capabilities_callback_.Run( |
| 253 context_provider_->ContextCapabilities()); | 253 context_provider_->ContextCapabilities()); |
| 254 return true; | 254 return true; |
| 255 } | 255 } |
| 256 | 256 |
| 257 void EnsureBackbuffer() override {} |
| 258 |
| 259 void DiscardBackbuffer() override { |
| 260 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); |
| 261 } |
| 262 |
| 263 void BindFramebuffer() override { |
| 264 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); |
| 265 } |
| 266 |
| 257 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override { | 267 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override { |
| 258 return overlay_candidate_validator_.get(); | 268 return overlay_candidate_validator_.get(); |
| 259 } | 269 } |
| 260 | 270 |
| 271 bool IsDisplayedAsOverlayPlane() const override { return false; } |
| 272 unsigned GetOverlayTextureId() const override { return 0; } |
| 273 bool SurfaceIsSuspendForRecycle() const override { return false; } |
| 274 bool HasExternalStencilTest() const override { return false; } |
| 275 void ApplyExternalStencil() override {} |
| 276 |
| 261 uint32_t GetFramebufferCopyTextureFormat() override { | 277 uint32_t GetFramebufferCopyTextureFormat() override { |
| 262 auto* gl = static_cast<ContextProviderCommandBuffer*>(context_provider()); | 278 auto* gl = static_cast<ContextProviderCommandBuffer*>(context_provider()); |
| 263 return gl->GetCopyTextureInternalFormat(); | 279 return gl->GetCopyTextureInternalFormat(); |
| 264 } | 280 } |
| 265 | 281 |
| 266 private: | 282 private: |
| 267 gpu::CommandBufferProxyImpl* GetCommandBufferProxy() { | 283 gpu::CommandBufferProxyImpl* GetCommandBufferProxy() { |
| 268 ContextProviderCommandBuffer* provider_command_buffer = | 284 ContextProviderCommandBuffer* provider_command_buffer = |
| 269 static_cast<content::ContextProviderCommandBuffer*>( | 285 static_cast<content::ContextProviderCommandBuffer*>( |
| 270 context_provider_.get()); | 286 context_provider_.get()); |
| 271 gpu::CommandBufferProxyImpl* command_buffer_proxy = | 287 gpu::CommandBufferProxyImpl* command_buffer_proxy = |
| 272 provider_command_buffer->GetCommandBufferProxy(); | 288 provider_command_buffer->GetCommandBufferProxy(); |
| 273 DCHECK(command_buffer_proxy); | 289 DCHECK(command_buffer_proxy); |
| 274 return command_buffer_proxy; | 290 return command_buffer_proxy; |
| 275 } | 291 } |
| 276 | 292 |
| 277 void OnSwapBuffersCompleted( | 293 void OnSwapBuffersCompleted( |
| 278 const std::vector<ui::LatencyInfo>& latency_info, | 294 const std::vector<ui::LatencyInfo>& latency_info, |
| 279 gfx::SwapResult result, | 295 gfx::SwapResult result, |
| 280 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { | 296 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { |
| 281 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | 297 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); |
| 282 OutputSurface::OnSwapBuffersComplete(); | 298 client_->DidSwapBuffersComplete(); |
| 283 } | 299 } |
| 284 | 300 |
| 285 private: | 301 private: |
| 286 base::Callback<void(gpu::Capabilities)> populate_gpu_capabilities_callback_; | 302 base::Callback<void(gpu::Capabilities)> populate_gpu_capabilities_callback_; |
| 287 base::CancelableCallback<void( | 303 base::CancelableCallback<void( |
| 288 const std::vector<ui::LatencyInfo>&, | 304 const std::vector<ui::LatencyInfo>&, |
| 289 gfx::SwapResult, | 305 gfx::SwapResult, |
| 290 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)> | 306 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)> |
| 291 swap_buffers_completion_callback_; | 307 swap_buffers_completion_callback_; |
| 292 std::unique_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_; | 308 std::unique_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_; |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 828 |
| 813 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); | 829 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); |
| 814 host_->SetNeedsAnimate(); | 830 host_->SetNeedsAnimate(); |
| 815 } | 831 } |
| 816 | 832 |
| 817 bool CompositorImpl::HavePendingReadbacks() { | 833 bool CompositorImpl::HavePendingReadbacks() { |
| 818 return !readback_layer_tree_->children().empty(); | 834 return !readback_layer_tree_->children().empty(); |
| 819 } | 835 } |
| 820 | 836 |
| 821 } // namespace content | 837 } // namespace content |
| OLD | NEW |