| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 void SwapBuffers(cc::CompositorFrame frame) override { | 177 void SwapBuffers(cc::CompositorFrame frame) override { |
| 178 GetCommandBufferProxy()->SetLatencyInfo(frame.metadata.latency_info); | 178 GetCommandBufferProxy()->SetLatencyInfo(frame.metadata.latency_info); |
| 179 if (frame.gl_frame_data->sub_buffer_rect.IsEmpty()) { | 179 if (frame.gl_frame_data->sub_buffer_rect.IsEmpty()) { |
| 180 context_provider_->ContextSupport()->CommitOverlayPlanes(); | 180 context_provider_->ContextSupport()->CommitOverlayPlanes(); |
| 181 } else { | 181 } else { |
| 182 DCHECK(frame.gl_frame_data->sub_buffer_rect == | 182 DCHECK(frame.gl_frame_data->sub_buffer_rect == |
| 183 gfx::Rect(frame.gl_frame_data->size)); | 183 gfx::Rect(frame.gl_frame_data->size)); |
| 184 context_provider_->ContextSupport()->Swap(); | 184 context_provider_->ContextSupport()->Swap(); |
| 185 } | 185 } |
| 186 client_->DidSwapBuffers(); | |
| 187 } | 186 } |
| 188 | 187 |
| 189 bool BindToClient(cc::OutputSurfaceClient* client) override { | 188 bool BindToClient(cc::OutputSurfaceClient* client) override { |
| 190 if (!OutputSurface::BindToClient(client)) | 189 if (!OutputSurface::BindToClient(client)) |
| 191 return false; | 190 return false; |
| 192 | 191 |
| 193 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( | 192 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( |
| 194 swap_buffers_completion_callback_.callback()); | 193 swap_buffers_completion_callback_.callback()); |
| 195 | 194 |
| 196 populate_gpu_capabilities_callback_.Run( | 195 populate_gpu_capabilities_callback_.Run( |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 259 |
| 261 bool BindToClient(cc::OutputSurfaceClient* client) override { | 260 bool BindToClient(cc::OutputSurfaceClient* client) override { |
| 262 if (!OutputSurface::BindToClient(client)) | 261 if (!OutputSurface::BindToClient(client)) |
| 263 return false; | 262 return false; |
| 264 return true; | 263 return true; |
| 265 } | 264 } |
| 266 | 265 |
| 267 void SwapBuffers(cc::CompositorFrame frame) override { | 266 void SwapBuffers(cc::CompositorFrame frame) override { |
| 268 surface_->SwapBuffers(); | 267 surface_->SwapBuffers(); |
| 269 PostSwapBuffersComplete(); | 268 PostSwapBuffersComplete(); |
| 270 client_->DidSwapBuffers(); | |
| 271 } | 269 } |
| 272 | 270 |
| 273 void Destroy() { | 271 void Destroy() { |
| 274 if (surface_) { | 272 if (surface_) { |
| 275 surface_->Destroy(); | 273 surface_->Destroy(); |
| 276 surface_.reset(); | 274 surface_.reset(); |
| 277 } | 275 } |
| 278 } | 276 } |
| 279 | 277 |
| 280 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, | 278 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 void CompositorImpl::SetNeedsAnimate() { | 801 void CompositorImpl::SetNeedsAnimate() { |
| 804 needs_animate_ = true; | 802 needs_animate_ = true; |
| 805 if (!host_->visible()) | 803 if (!host_->visible()) |
| 806 return; | 804 return; |
| 807 | 805 |
| 808 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); | 806 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); |
| 809 host_->SetNeedsAnimate(); | 807 host_->SetNeedsAnimate(); |
| 810 } | 808 } |
| 811 | 809 |
| 812 } // namespace content | 810 } // namespace content |
| OLD | NEW |