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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 base::Unretained(this))), | 167 base::Unretained(this))), |
168 overlay_candidate_validator_( | 168 overlay_candidate_validator_( |
169 new display_compositor:: | 169 new display_compositor:: |
170 CompositorOverlayCandidateValidatorAndroid()) { | 170 CompositorOverlayCandidateValidatorAndroid()) { |
171 capabilities_.adjust_deadline_for_parent = false; | 171 capabilities_.adjust_deadline_for_parent = false; |
172 capabilities_.max_frames_pending = kMaxDisplaySwapBuffers; | 172 capabilities_.max_frames_pending = kMaxDisplaySwapBuffers; |
173 } | 173 } |
174 | 174 |
175 ~OutputSurfaceWithoutParent() override = default; | 175 ~OutputSurfaceWithoutParent() override = default; |
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(); | 186 client_->DidSwapBuffers(); |
187 } | 187 } |
188 | 188 |
189 bool BindToClient(cc::OutputSurfaceClient* client) override { | 189 bool BindToClient(cc::OutputSurfaceClient* client) override { |
190 if (!OutputSurface::BindToClient(client)) | 190 if (!OutputSurface::BindToClient(client)) |
191 return false; | 191 return false; |
192 | 192 |
193 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( | 193 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 return true; | 258 return true; |
259 } | 259 } |
260 | 260 |
261 bool BindToClient(cc::OutputSurfaceClient* client) override { | 261 bool BindToClient(cc::OutputSurfaceClient* client) override { |
262 if (!OutputSurface::BindToClient(client)) | 262 if (!OutputSurface::BindToClient(client)) |
263 return false; | 263 return false; |
264 return true; | 264 return true; |
265 } | 265 } |
266 | 266 |
267 void SwapBuffers(cc::CompositorFrame* frame) override { | 267 void SwapBuffers(cc::CompositorFrame frame) override { |
268 surface_->SwapBuffers(); | 268 surface_->SwapBuffers(); |
269 PostSwapBuffersComplete(); | 269 PostSwapBuffersComplete(); |
270 client_->DidSwapBuffers(); | 270 client_->DidSwapBuffers(); |
271 } | 271 } |
272 | 272 |
273 void Destroy() { | 273 void Destroy() { |
274 if (surface_) { | 274 if (surface_) { |
275 surface_->Destroy(); | 275 surface_->Destroy(); |
276 surface_.reset(); | 276 surface_.reset(); |
277 } | 277 } |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 void CompositorImpl::SetNeedsAnimate() { | 804 void CompositorImpl::SetNeedsAnimate() { |
805 needs_animate_ = true; | 805 needs_animate_ = true; |
806 if (!host_->visible()) | 806 if (!host_->visible()) |
807 return; | 807 return; |
808 | 808 |
809 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); | 809 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); |
810 host_->SetNeedsAnimate(); | 810 host_->SetNeedsAnimate(); |
811 } | 811 } |
812 | 812 |
813 } // namespace content | 813 } // namespace content |
OLD | NEW |