| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "content/common/host_shared_bitmap_manager.h" | 51 #include "content/common/host_shared_bitmap_manager.h" |
| 52 #include "content/public/browser/android/compositor_client.h" | 52 #include "content/public/browser/android/compositor_client.h" |
| 53 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 53 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
| 54 #include "gpu/command_buffer/client/context_support.h" | 54 #include "gpu/command_buffer/client/context_support.h" |
| 55 #include "gpu/command_buffer/client/gles2_interface.h" | 55 #include "gpu/command_buffer/client/gles2_interface.h" |
| 56 #include "third_party/khronos/GLES2/gl2.h" | 56 #include "third_party/khronos/GLES2/gl2.h" |
| 57 #include "third_party/khronos/GLES2/gl2ext.h" | 57 #include "third_party/khronos/GLES2/gl2ext.h" |
| 58 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 58 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
| 59 #include "ui/android/window_android.h" | 59 #include "ui/android/window_android.h" |
| 60 #include "ui/gfx/android/device_display_info.h" | 60 #include "ui/gfx/android/device_display_info.h" |
| 61 #include "ui/gfx/frame_time.h" | |
| 62 | 61 |
| 63 namespace content { | 62 namespace content { |
| 64 | 63 |
| 65 namespace { | 64 namespace { |
| 66 | 65 |
| 67 const unsigned int kMaxSwapBuffers = 2U; | 66 const unsigned int kMaxSwapBuffers = 2U; |
| 68 | 67 |
| 69 // Used to override capabilities_.adjust_deadline_for_parent to false | 68 // Used to override capabilities_.adjust_deadline_for_parent to false |
| 70 class OutputSurfaceWithoutParent : public cc::OutputSurface { | 69 class OutputSurfaceWithoutParent : public cc::OutputSurface { |
| 71 public: | 70 public: |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 312 |
| 314 // Only allow compositing once per vsync. | 313 // Only allow compositing once per vsync. |
| 315 current_composite_task_->Cancel(); | 314 current_composite_task_->Cancel(); |
| 316 DCHECK(DidCompositeThisFrame() && !WillComposite()); | 315 DCHECK(DidCompositeThisFrame() && !WillComposite()); |
| 317 | 316 |
| 318 // Ignore ScheduleComposite() from layer tree changes during layout and | 317 // Ignore ScheduleComposite() from layer tree changes during layout and |
| 319 // animation updates that will already be reflected in the current frame | 318 // animation updates that will already be reflected in the current frame |
| 320 // we are about to draw. | 319 // we are about to draw. |
| 321 ignore_schedule_composite_ = true; | 320 ignore_schedule_composite_ = true; |
| 322 | 321 |
| 323 const base::TimeTicks frame_time = gfx::FrameTime::Now(); | 322 const base::TimeTicks frame_time = base::TimeTicks::Now(); |
| 324 if (needs_animate_) { | 323 if (needs_animate_) { |
| 325 needs_animate_ = false; | 324 needs_animate_ = false; |
| 326 root_window_->Animate(frame_time); | 325 root_window_->Animate(frame_time); |
| 327 } | 326 } |
| 328 ignore_schedule_composite_ = false; | 327 ignore_schedule_composite_ = false; |
| 329 | 328 |
| 330 did_post_swapbuffers_ = false; | 329 did_post_swapbuffers_ = false; |
| 331 host_->Composite(frame_time); | 330 host_->Composite(frame_time); |
| 332 if (did_post_swapbuffers_) | 331 if (did_post_swapbuffers_) |
| 333 pending_swapbuffers_++; | 332 pending_swapbuffers_++; |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 | 732 |
| 734 void CompositorImpl::SetNeedsAnimate() { | 733 void CompositorImpl::SetNeedsAnimate() { |
| 735 needs_animate_ = true; | 734 needs_animate_ = true; |
| 736 if (!host_) | 735 if (!host_) |
| 737 return; | 736 return; |
| 738 | 737 |
| 739 host_->SetNeedsAnimate(); | 738 host_->SetNeedsAnimate(); |
| 740 } | 739 } |
| 741 | 740 |
| 742 } // namespace content | 741 } // namespace content |
| OLD | NEW |