| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 : cc::OutputSurface(context_provider), | 73 : cc::OutputSurface(context_provider), |
| 74 swap_buffers_completion_callback_( | 74 swap_buffers_completion_callback_( |
| 75 base::Bind(&OutputSurfaceWithoutParent::OnSwapBuffersCompleted, | 75 base::Bind(&OutputSurfaceWithoutParent::OnSwapBuffersCompleted, |
| 76 base::Unretained(this))) { | 76 base::Unretained(this))) { |
| 77 capabilities_.adjust_deadline_for_parent = false; | 77 capabilities_.adjust_deadline_for_parent = false; |
| 78 capabilities_.max_frames_pending = 2; | 78 capabilities_.max_frames_pending = 2; |
| 79 compositor_impl_ = compositor_impl; | 79 compositor_impl_ = compositor_impl; |
| 80 main_thread_ = base::MessageLoopProxy::current(); | 80 main_thread_ = base::MessageLoopProxy::current(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 virtual void SwapBuffers(cc::CompositorFrame* frame) override { | 83 void SwapBuffers(cc::CompositorFrame* frame) override { |
| 84 GetCommandBufferProxy()->SetLatencyInfo(frame->metadata.latency_info); | 84 GetCommandBufferProxy()->SetLatencyInfo(frame->metadata.latency_info); |
| 85 DCHECK(frame->gl_frame_data->sub_buffer_rect == | 85 DCHECK(frame->gl_frame_data->sub_buffer_rect == |
| 86 gfx::Rect(frame->gl_frame_data->size)); | 86 gfx::Rect(frame->gl_frame_data->size)); |
| 87 context_provider_->ContextSupport()->Swap(); | 87 context_provider_->ContextSupport()->Swap(); |
| 88 client_->DidSwapBuffers(); | 88 client_->DidSwapBuffers(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 virtual bool BindToClient(cc::OutputSurfaceClient* client) override { | 91 bool BindToClient(cc::OutputSurfaceClient* client) override { |
| 92 if (!OutputSurface::BindToClient(client)) | 92 if (!OutputSurface::BindToClient(client)) |
| 93 return false; | 93 return false; |
| 94 | 94 |
| 95 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( | 95 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( |
| 96 swap_buffers_completion_callback_.callback()); | 96 swap_buffers_completion_callback_.callback()); |
| 97 | 97 |
| 98 main_thread_->PostTask( | 98 main_thread_->PostTask( |
| 99 FROM_HERE, | 99 FROM_HERE, |
| 100 base::Bind(&CompositorImpl::PopulateGpuCapabilities, | 100 base::Bind(&CompositorImpl::PopulateGpuCapabilities, |
| 101 compositor_impl_, | 101 compositor_impl_, |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 | 699 |
| 700 void CompositorImpl::SetNeedsAnimate() { | 700 void CompositorImpl::SetNeedsAnimate() { |
| 701 needs_animate_ = true; | 701 needs_animate_ = true; |
| 702 if (!host_) | 702 if (!host_) |
| 703 return; | 703 return; |
| 704 | 704 |
| 705 host_->SetNeedsAnimate(); | 705 host_->SetNeedsAnimate(); |
| 706 } | 706 } |
| 707 | 707 |
| 708 } // namespace content | 708 } // namespace content |
| OLD | NEW |