| 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 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "content/public/browser/android/compositor.h" | 53 #include "content/public/browser/android/compositor.h" |
| 54 #include "content/public/browser/android/compositor_client.h" | 54 #include "content/public/browser/android/compositor_client.h" |
| 55 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 55 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
| 56 #include "gpu/command_buffer/client/context_support.h" | 56 #include "gpu/command_buffer/client/context_support.h" |
| 57 #include "gpu/command_buffer/client/gles2_interface.h" | 57 #include "gpu/command_buffer/client/gles2_interface.h" |
| 58 #include "third_party/khronos/GLES2/gl2.h" | 58 #include "third_party/khronos/GLES2/gl2.h" |
| 59 #include "third_party/khronos/GLES2/gl2ext.h" | 59 #include "third_party/khronos/GLES2/gl2ext.h" |
| 60 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 60 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
| 61 #include "ui/android/window_android.h" | 61 #include "ui/android/window_android.h" |
| 62 #include "ui/gfx/android/device_display_info.h" | 62 #include "ui/gfx/android/device_display_info.h" |
| 63 #include "ui/gfx/swap_result.h" | |
| 64 | 63 |
| 65 namespace content { | 64 namespace content { |
| 66 | 65 |
| 67 namespace { | 66 namespace { |
| 68 | 67 |
| 69 const unsigned int kMaxSwapBuffers = 2U; | 68 const unsigned int kMaxSwapBuffers = 2U; |
| 70 | 69 |
| 71 // Used to override capabilities_.adjust_deadline_for_parent to false | 70 // Used to override capabilities_.adjust_deadline_for_parent to false |
| 72 class OutputSurfaceWithoutParent : public cc::OutputSurface { | 71 class OutputSurfaceWithoutParent : public cc::OutputSurface { |
| 73 public: | 72 public: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 CommandBufferProxyImpl* GetCommandBufferProxy() { | 111 CommandBufferProxyImpl* GetCommandBufferProxy() { |
| 113 ContextProviderCommandBuffer* provider_command_buffer = | 112 ContextProviderCommandBuffer* provider_command_buffer = |
| 114 static_cast<content::ContextProviderCommandBuffer*>( | 113 static_cast<content::ContextProviderCommandBuffer*>( |
| 115 context_provider_.get()); | 114 context_provider_.get()); |
| 116 CommandBufferProxyImpl* command_buffer_proxy = | 115 CommandBufferProxyImpl* command_buffer_proxy = |
| 117 provider_command_buffer->GetCommandBufferProxy(); | 116 provider_command_buffer->GetCommandBufferProxy(); |
| 118 DCHECK(command_buffer_proxy); | 117 DCHECK(command_buffer_proxy); |
| 119 return command_buffer_proxy; | 118 return command_buffer_proxy; |
| 120 } | 119 } |
| 121 | 120 |
| 122 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, | 121 void OnSwapBuffersCompleted( |
| 123 gfx::SwapResult result) { | 122 const std::vector<ui::LatencyInfo>& latency_info) { |
| 124 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | 123 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); |
| 125 OutputSurface::OnSwapBuffersComplete(); | 124 OutputSurface::OnSwapBuffersComplete(); |
| 126 } | 125 } |
| 127 | 126 |
| 128 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&, | 127 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&)> |
| 129 gfx::SwapResult)> | |
| 130 swap_buffers_completion_callback_; | 128 swap_buffers_completion_callback_; |
| 131 | 129 |
| 132 scoped_refptr<base::MessageLoopProxy> main_thread_; | 130 scoped_refptr<base::MessageLoopProxy> main_thread_; |
| 133 base::WeakPtr<CompositorImpl> compositor_impl_; | 131 base::WeakPtr<CompositorImpl> compositor_impl_; |
| 134 }; | 132 }; |
| 135 | 133 |
| 136 static bool g_initialized = false; | 134 static bool g_initialized = false; |
| 137 | 135 |
| 138 bool g_use_surface_manager = false; | 136 bool g_use_surface_manager = false; |
| 139 base::LazyInstance<cc::SurfaceManager> g_surface_manager = | 137 base::LazyInstance<cc::SurfaceManager> g_surface_manager = |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 | 748 |
| 751 void CompositorImpl::SetNeedsAnimate() { | 749 void CompositorImpl::SetNeedsAnimate() { |
| 752 needs_animate_ = true; | 750 needs_animate_ = true; |
| 753 if (!host_) | 751 if (!host_) |
| 754 return; | 752 return; |
| 755 | 753 |
| 756 host_->SetNeedsAnimate(); | 754 host_->SetNeedsAnimate(); |
| 757 } | 755 } |
| 758 | 756 |
| 759 } // namespace content | 757 } // namespace content |
| OLD | NEW |