| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "content/public/browser/android/compositor_client.h" | 51 #include "content/public/browser/android/compositor_client.h" |
| 52 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 52 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
| 53 #include "gpu/command_buffer/client/context_support.h" | 53 #include "gpu/command_buffer/client/context_support.h" |
| 54 #include "gpu/command_buffer/client/gles2_interface.h" | 54 #include "gpu/command_buffer/client/gles2_interface.h" |
| 55 #include "third_party/khronos/GLES2/gl2.h" | 55 #include "third_party/khronos/GLES2/gl2.h" |
| 56 #include "third_party/khronos/GLES2/gl2ext.h" | 56 #include "third_party/khronos/GLES2/gl2ext.h" |
| 57 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 57 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
| 58 #include "ui/android/window_android.h" | 58 #include "ui/android/window_android.h" |
| 59 #include "ui/gfx/android/device_display_info.h" | 59 #include "ui/gfx/android/device_display_info.h" |
| 60 #include "ui/gfx/frame_time.h" | 60 #include "ui/gfx/frame_time.h" |
| 61 #include "ui/gfx/swap_result.h" |
| 61 #include "webkit/common/gpu/context_provider_in_process.h" | 62 #include "webkit/common/gpu/context_provider_in_process.h" |
| 62 | 63 |
| 63 namespace content { | 64 namespace content { |
| 64 | 65 |
| 65 namespace { | 66 namespace { |
| 66 | 67 |
| 67 const unsigned int kMaxSwapBuffers = 2U; | 68 const unsigned int kMaxSwapBuffers = 2U; |
| 68 | 69 |
| 69 // Used to override capabilities_.adjust_deadline_for_parent to false | 70 // Used to override capabilities_.adjust_deadline_for_parent to false |
| 70 class OutputSurfaceWithoutParent : public cc::OutputSurface { | 71 class OutputSurfaceWithoutParent : public cc::OutputSurface { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 CommandBufferProxyImpl* GetCommandBufferProxy() { | 111 CommandBufferProxyImpl* GetCommandBufferProxy() { |
| 111 ContextProviderCommandBuffer* provider_command_buffer = | 112 ContextProviderCommandBuffer* provider_command_buffer = |
| 112 static_cast<content::ContextProviderCommandBuffer*>( | 113 static_cast<content::ContextProviderCommandBuffer*>( |
| 113 context_provider_.get()); | 114 context_provider_.get()); |
| 114 CommandBufferProxyImpl* command_buffer_proxy = | 115 CommandBufferProxyImpl* command_buffer_proxy = |
| 115 provider_command_buffer->GetCommandBufferProxy(); | 116 provider_command_buffer->GetCommandBufferProxy(); |
| 116 DCHECK(command_buffer_proxy); | 117 DCHECK(command_buffer_proxy); |
| 117 return command_buffer_proxy; | 118 return command_buffer_proxy; |
| 118 } | 119 } |
| 119 | 120 |
| 120 void OnSwapBuffersCompleted( | 121 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, |
| 121 const std::vector<ui::LatencyInfo>& latency_info) { | 122 gfx::SwapResult result) { |
| 122 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | 123 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); |
| 123 OutputSurface::OnSwapBuffersComplete(); | 124 OutputSurface::OnSwapBuffersComplete(); |
| 124 } | 125 } |
| 125 | 126 |
| 126 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&)> | 127 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&, |
| 128 gfx::SwapResult)> |
| 127 swap_buffers_completion_callback_; | 129 swap_buffers_completion_callback_; |
| 128 | 130 |
| 129 scoped_refptr<base::MessageLoopProxy> main_thread_; | 131 scoped_refptr<base::MessageLoopProxy> main_thread_; |
| 130 base::WeakPtr<CompositorImpl> compositor_impl_; | 132 base::WeakPtr<CompositorImpl> compositor_impl_; |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 static bool g_initialized = false; | 135 static bool g_initialized = false; |
| 134 | 136 |
| 135 bool g_use_surface_manager = false; | 137 bool g_use_surface_manager = false; |
| 136 base::LazyInstance<cc::SurfaceManager> g_surface_manager = | 138 base::LazyInstance<cc::SurfaceManager> g_surface_manager = |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 | 725 |
| 724 void CompositorImpl::SetNeedsAnimate() { | 726 void CompositorImpl::SetNeedsAnimate() { |
| 725 needs_animate_ = true; | 727 needs_animate_ = true; |
| 726 if (!host_) | 728 if (!host_) |
| 727 return; | 729 return; |
| 728 | 730 |
| 729 host_->SetNeedsAnimate(); | 731 host_->SetNeedsAnimate(); |
| 730 } | 732 } |
| 731 | 733 |
| 732 } // namespace content | 734 } // namespace content |
| OLD | NEW |