| 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 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include "gpu/command_buffer/client/gles2_interface.h" | 61 #include "gpu/command_buffer/client/gles2_interface.h" |
| 62 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 62 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 63 #include "gpu/ipc/client/gpu_channel_host.h" | 63 #include "gpu/ipc/client/gpu_channel_host.h" |
| 64 #include "third_party/khronos/GLES2/gl2.h" | 64 #include "third_party/khronos/GLES2/gl2.h" |
| 65 #include "third_party/khronos/GLES2/gl2ext.h" | 65 #include "third_party/khronos/GLES2/gl2ext.h" |
| 66 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 66 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
| 67 #include "ui/android/window_android.h" | 67 #include "ui/android/window_android.h" |
| 68 #include "ui/gfx/android/device_display_info.h" | 68 #include "ui/gfx/android/device_display_info.h" |
| 69 #include "ui/gfx/swap_result.h" | 69 #include "ui/gfx/swap_result.h" |
| 70 | 70 |
| 71 namespace gpu { |
| 72 struct GpuProcessHostedCALayerTreeParamsMac; |
| 73 } |
| 74 |
| 71 namespace content { | 75 namespace content { |
| 72 | 76 |
| 73 namespace { | 77 namespace { |
| 74 | 78 |
| 75 const unsigned int kMaxDisplaySwapBuffers = 1U; | 79 const unsigned int kMaxDisplaySwapBuffers = 1U; |
| 76 | 80 |
| 77 class ExternalBeginFrameSource : public cc::BeginFrameSourceBase, | 81 class ExternalBeginFrameSource : public cc::BeginFrameSourceBase, |
| 78 public CompositorImpl::VSyncObserver { | 82 public CompositorImpl::VSyncObserver { |
| 79 public: | 83 public: |
| 80 ExternalBeginFrameSource(CompositorImpl* compositor) | 84 ExternalBeginFrameSource(CompositorImpl* compositor) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 gpu::CommandBufferProxyImpl* GetCommandBufferProxy() { | 198 gpu::CommandBufferProxyImpl* GetCommandBufferProxy() { |
| 195 ContextProviderCommandBuffer* provider_command_buffer = | 199 ContextProviderCommandBuffer* provider_command_buffer = |
| 196 static_cast<content::ContextProviderCommandBuffer*>( | 200 static_cast<content::ContextProviderCommandBuffer*>( |
| 197 context_provider_.get()); | 201 context_provider_.get()); |
| 198 gpu::CommandBufferProxyImpl* command_buffer_proxy = | 202 gpu::CommandBufferProxyImpl* command_buffer_proxy = |
| 199 provider_command_buffer->GetCommandBufferProxy(); | 203 provider_command_buffer->GetCommandBufferProxy(); |
| 200 DCHECK(command_buffer_proxy); | 204 DCHECK(command_buffer_proxy); |
| 201 return command_buffer_proxy; | 205 return command_buffer_proxy; |
| 202 } | 206 } |
| 203 | 207 |
| 204 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, | 208 void OnSwapBuffersCompleted( |
| 205 gfx::SwapResult result) { | 209 const std::vector<ui::LatencyInfo>& latency_info, |
| 210 gfx::SwapResult result, |
| 211 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { |
| 206 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | 212 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); |
| 207 OutputSurface::OnSwapBuffersComplete(); | 213 OutputSurface::OnSwapBuffersComplete(); |
| 208 } | 214 } |
| 209 | 215 |
| 210 void OnVSync(base::TimeTicks timebase, base::TimeDelta interval) override { | 216 void OnVSync(base::TimeTicks timebase, base::TimeDelta interval) override { |
| 211 client_->CommitVSyncParameters(timebase, interval); | 217 client_->CommitVSyncParameters(timebase, interval); |
| 212 } | 218 } |
| 213 | 219 |
| 214 private: | 220 private: |
| 215 CompositorImpl* compositor_; | 221 CompositorImpl* compositor_; |
| 216 base::Callback<void(gpu::Capabilities)> populate_gpu_capabilities_callback_; | 222 base::Callback<void(gpu::Capabilities)> populate_gpu_capabilities_callback_; |
| 217 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&, | 223 base::CancelableCallback<void( |
| 218 gfx::SwapResult)> | 224 const std::vector<ui::LatencyInfo>&, |
| 219 swap_buffers_completion_callback_; | 225 gfx::SwapResult, |
| 226 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)> |
| 227 swap_buffers_completion_callback_; |
| 220 std::unique_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_; | 228 std::unique_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_; |
| 221 std::unique_ptr<ExternalBeginFrameSource> begin_frame_source_; | 229 std::unique_ptr<ExternalBeginFrameSource> begin_frame_source_; |
| 222 }; | 230 }; |
| 223 | 231 |
| 224 static bool g_initialized = false; | 232 static bool g_initialized = false; |
| 225 | 233 |
| 226 base::LazyInstance<cc::SurfaceManager> g_surface_manager = | 234 base::LazyInstance<cc::SurfaceManager> g_surface_manager = |
| 227 LAZY_INSTANCE_INITIALIZER; | 235 LAZY_INSTANCE_INITIALIZER; |
| 228 | 236 |
| 229 int g_surface_id_namespace = 0; | 237 int g_surface_id_namespace = 0; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 void CompositorImpl::SetNeedsAnimate() { | 688 void CompositorImpl::SetNeedsAnimate() { |
| 681 needs_animate_ = true; | 689 needs_animate_ = true; |
| 682 if (!host_->visible()) | 690 if (!host_->visible()) |
| 683 return; | 691 return; |
| 684 | 692 |
| 685 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); | 693 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); |
| 686 host_->SetNeedsAnimate(); | 694 host_->SetNeedsAnimate(); |
| 687 } | 695 } |
| 688 | 696 |
| 689 } // namespace content | 697 } // namespace content |
| OLD | NEW |