Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 #include "third_party/khronos/GLES2/gl2ext.h" | 60 #include "third_party/khronos/GLES2/gl2ext.h" |
| 61 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 61 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
| 62 #include "ui/android/window_android.h" | 62 #include "ui/android/window_android.h" |
| 63 #include "ui/gfx/android/device_display_info.h" | 63 #include "ui/gfx/android/device_display_info.h" |
| 64 #include "ui/gfx/swap_result.h" | 64 #include "ui/gfx/swap_result.h" |
| 65 | 65 |
| 66 namespace content { | 66 namespace content { |
| 67 | 67 |
| 68 namespace { | 68 namespace { |
| 69 | 69 |
| 70 const unsigned int kMaxSwapBuffers = 2U; | 70 const unsigned int kMaxSwapBuffers = 1U; |
| 71 | 71 |
| 72 // Used to override capabilities_.adjust_deadline_for_parent to false | 72 // Used to override capabilities_.adjust_deadline_for_parent to false |
| 73 class OutputSurfaceWithoutParent : public cc::OutputSurface, | 73 class OutputSurfaceWithoutParent : public cc::OutputSurface, |
| 74 public CompositorImpl::VSyncObserver { | 74 public CompositorImpl::VSyncObserver { |
| 75 public: | 75 public: |
| 76 OutputSurfaceWithoutParent( | 76 OutputSurfaceWithoutParent( |
| 77 CompositorImpl* compositor, | 77 CompositorImpl* compositor, |
| 78 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 78 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
| 79 const base::Callback<void(gpu::Capabilities)>& | 79 const base::Callback<void(gpu::Capabilities)>& |
| 80 populate_gpu_capabilities_callback) | 80 populate_gpu_capabilities_callback) |
| 81 : cc::OutputSurface(context_provider), | 81 : cc::OutputSurface(context_provider), |
| 82 compositor_(compositor), | 82 compositor_(compositor), |
| 83 populate_gpu_capabilities_callback_(populate_gpu_capabilities_callback), | 83 populate_gpu_capabilities_callback_(populate_gpu_capabilities_callback), |
| 84 swap_buffers_completion_callback_( | 84 swap_buffers_completion_callback_( |
| 85 base::Bind(&OutputSurfaceWithoutParent::OnSwapBuffersCompleted, | 85 base::Bind(&OutputSurfaceWithoutParent::OnSwapBuffersCompleted, |
| 86 base::Unretained(this))) { | 86 base::Unretained(this))) { |
| 87 capabilities_.adjust_deadline_for_parent = false; | 87 capabilities_.adjust_deadline_for_parent = false; |
| 88 capabilities_.max_frames_pending = 2; | 88 capabilities_.max_frames_pending = 1; |
|
no sievers
2015/09/30 22:20:25
nit: kMaxSwapBuffers?
brianderson
2015/10/01 00:20:12
This refers to a different setting that will be us
| |
| 89 } | 89 } |
| 90 | 90 |
| 91 ~OutputSurfaceWithoutParent() override { compositor_->RemoveObserver(this); } | 91 ~OutputSurfaceWithoutParent() override { compositor_->RemoveObserver(this); } |
| 92 | 92 |
| 93 void SwapBuffers(cc::CompositorFrame* frame) override { | 93 void SwapBuffers(cc::CompositorFrame* frame) override { |
| 94 GetCommandBufferProxy()->SetLatencyInfo(frame->metadata.latency_info); | 94 GetCommandBufferProxy()->SetLatencyInfo(frame->metadata.latency_info); |
| 95 DCHECK(frame->gl_frame_data->sub_buffer_rect == | 95 DCHECK(frame->gl_frame_data->sub_buffer_rect == |
| 96 gfx::Rect(frame->gl_frame_data->size)); | 96 gfx::Rect(frame->gl_frame_data->size)); |
| 97 context_provider_->ContextSupport()->Swap(); | 97 context_provider_->ContextSupport()->Swap(); |
| 98 client_->DidSwapBuffers(); | 98 client_->DidSwapBuffers(); |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 | 785 |
| 786 void CompositorImpl::SetNeedsAnimate() { | 786 void CompositorImpl::SetNeedsAnimate() { |
| 787 needs_animate_ = true; | 787 needs_animate_ = true; |
| 788 if (!host_) | 788 if (!host_) |
| 789 return; | 789 return; |
| 790 | 790 |
| 791 host_->SetNeedsAnimate(); | 791 host_->SetNeedsAnimate(); |
| 792 } | 792 } |
| 793 | 793 |
| 794 } // namespace content | 794 } // namespace content |
| OLD | NEW |