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" |
63 | 64 |
64 namespace content { | 65 namespace content { |
65 | 66 |
66 namespace { | 67 namespace { |
67 | 68 |
68 const unsigned int kMaxSwapBuffers = 2U; | 69 const unsigned int kMaxSwapBuffers = 2U; |
69 | 70 |
70 // Used to override capabilities_.adjust_deadline_for_parent to false | 71 // Used to override capabilities_.adjust_deadline_for_parent to false |
71 class OutputSurfaceWithoutParent : public cc::OutputSurface { | 72 class OutputSurfaceWithoutParent : public cc::OutputSurface { |
72 public: | 73 public: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 CommandBufferProxyImpl* GetCommandBufferProxy() { | 112 CommandBufferProxyImpl* GetCommandBufferProxy() { |
112 ContextProviderCommandBuffer* provider_command_buffer = | 113 ContextProviderCommandBuffer* provider_command_buffer = |
113 static_cast<content::ContextProviderCommandBuffer*>( | 114 static_cast<content::ContextProviderCommandBuffer*>( |
114 context_provider_.get()); | 115 context_provider_.get()); |
115 CommandBufferProxyImpl* command_buffer_proxy = | 116 CommandBufferProxyImpl* command_buffer_proxy = |
116 provider_command_buffer->GetCommandBufferProxy(); | 117 provider_command_buffer->GetCommandBufferProxy(); |
117 DCHECK(command_buffer_proxy); | 118 DCHECK(command_buffer_proxy); |
118 return command_buffer_proxy; | 119 return command_buffer_proxy; |
119 } | 120 } |
120 | 121 |
121 void OnSwapBuffersCompleted( | 122 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, |
122 const std::vector<ui::LatencyInfo>& latency_info) { | 123 gfx::SwapResult result) { |
123 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | 124 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); |
124 OutputSurface::OnSwapBuffersComplete(); | 125 OutputSurface::OnSwapBuffersComplete(); |
125 } | 126 } |
126 | 127 |
127 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&)> | 128 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&, |
| 129 gfx::SwapResult)> |
128 swap_buffers_completion_callback_; | 130 swap_buffers_completion_callback_; |
129 | 131 |
130 scoped_refptr<base::MessageLoopProxy> main_thread_; | 132 scoped_refptr<base::MessageLoopProxy> main_thread_; |
131 base::WeakPtr<CompositorImpl> compositor_impl_; | 133 base::WeakPtr<CompositorImpl> compositor_impl_; |
132 }; | 134 }; |
133 | 135 |
134 static bool g_initialized = false; | 136 static bool g_initialized = false; |
135 | 137 |
136 bool g_use_surface_manager = false; | 138 bool g_use_surface_manager = false; |
137 base::LazyInstance<cc::SurfaceManager> g_surface_manager = | 139 base::LazyInstance<cc::SurfaceManager> g_surface_manager = |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 | 750 |
749 void CompositorImpl::SetNeedsAnimate() { | 751 void CompositorImpl::SetNeedsAnimate() { |
750 needs_animate_ = true; | 752 needs_animate_ = true; |
751 if (!host_) | 753 if (!host_) |
752 return; | 754 return; |
753 | 755 |
754 host_->SetNeedsAnimate(); | 756 host_->SetNeedsAnimate(); |
755 } | 757 } |
756 | 758 |
757 } // namespace content | 759 } // namespace content |
OLD | NEW |