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" |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/cancelable_callback.h" | 13 #include "base/cancelable_callback.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
20 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
21 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
22 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
23 #include "cc/base/switches.h" | 23 #include "cc/base/switches.h" |
24 #include "cc/input/input_handler.h" | 24 #include "cc/input/input_handler.h" |
25 #include "cc/layers/layer.h" | 25 #include "cc/layers/layer.h" |
26 #include "cc/output/compositor_frame.h" | 26 #include "cc/output/compositor_frame.h" |
27 #include "cc/output/context_provider.h" | 27 #include "cc/output/context_provider.h" |
28 #include "cc/output/output_surface.h" | 28 #include "cc/output/output_surface.h" |
29 #include "cc/output/output_surface_client.h" | 29 #include "cc/output/output_surface_client.h" |
| 30 #include "cc/scheduler/begin_frame_source.h" |
30 #include "cc/trees/layer_tree_host.h" | 31 #include "cc/trees/layer_tree_host.h" |
31 #include "content/browser/android/child_process_launcher_android.h" | 32 #include "content/browser/android/child_process_launcher_android.h" |
32 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 33 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
33 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 34 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
34 #include "content/browser/gpu/gpu_surface_tracker.h" | 35 #include "content/browser/gpu/gpu_surface_tracker.h" |
35 #include "content/browser/renderer_host/render_widget_host_impl.h" | 36 #include "content/browser/renderer_host/render_widget_host_impl.h" |
36 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 37 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
37 #include "content/common/gpu/client/context_provider_command_buffer.h" | 38 #include "content/common/gpu/client/context_provider_command_buffer.h" |
38 #include "content/common/gpu/client/gl_helper.h" | 39 #include "content/common/gpu/client/gl_helper.h" |
39 #include "content/common/gpu/client/gpu_channel_host.h" | 40 #include "content/common/gpu/client/gpu_channel_host.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); | 399 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); |
399 // TODO(enne): Update this this compositor to use the scheduler. | 400 // TODO(enne): Update this this compositor to use the scheduler. |
400 settings.single_thread_proxy_scheduler = false; | 401 settings.single_thread_proxy_scheduler = false; |
401 | 402 |
402 host_ = cc::LayerTreeHost::CreateSingleThreaded( | 403 host_ = cc::LayerTreeHost::CreateSingleThreaded( |
403 this, | 404 this, |
404 this, | 405 this, |
405 HostSharedBitmapManager::current(), | 406 HostSharedBitmapManager::current(), |
406 BrowserGpuMemoryBufferManager::current(), | 407 BrowserGpuMemoryBufferManager::current(), |
407 settings, | 408 settings, |
408 base::MessageLoopProxy::current()); | 409 base::MessageLoopProxy::current(), |
| 410 nullptr); |
409 host_->SetRootLayer(root_layer_); | 411 host_->SetRootLayer(root_layer_); |
410 | 412 |
411 host_->SetVisible(true); | 413 host_->SetVisible(true); |
412 host_->SetLayerTreeHostClientReady(); | 414 host_->SetLayerTreeHostClientReady(); |
413 host_->SetViewportSize(size_); | 415 host_->SetViewportSize(size_); |
414 host_->set_has_transparent_background(has_transparent_background_); | 416 host_->set_has_transparent_background(has_transparent_background_); |
415 host_->SetDeviceScaleFactor(device_scale_factor_); | 417 host_->SetDeviceScaleFactor(device_scale_factor_); |
416 ui_resource_provider_.SetLayerTreeHost(host_.get()); | 418 ui_resource_provider_.SetLayerTreeHost(host_.get()); |
417 } | 419 } |
418 } | 420 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 } | 627 } |
626 | 628 |
627 void CompositorImpl::SetNeedsAnimate() { | 629 void CompositorImpl::SetNeedsAnimate() { |
628 if (!host_) | 630 if (!host_) |
629 return; | 631 return; |
630 | 632 |
631 host_->SetNeedsAnimate(); | 633 host_->SetNeedsAnimate(); |
632 } | 634 } |
633 | 635 |
634 } // namespace content | 636 } // namespace content |
OLD | NEW |