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/thread_task_runner_handle.h" |
21 #include "base/threading/simple_thread.h" | 22 #include "base/threading/simple_thread.h" |
22 #include "base/threading/thread.h" | 23 #include "base/threading/thread.h" |
23 #include "base/threading/thread_checker.h" | 24 #include "base/threading/thread_checker.h" |
24 #include "cc/base/switches.h" | 25 #include "cc/base/switches.h" |
25 #include "cc/input/input_handler.h" | 26 #include "cc/input/input_handler.h" |
26 #include "cc/layers/layer.h" | 27 #include "cc/layers/layer.h" |
27 #include "cc/output/compositor_frame.h" | 28 #include "cc/output/compositor_frame.h" |
28 #include "cc/output/context_provider.h" | 29 #include "cc/output/context_provider.h" |
29 #include "cc/output/output_surface.h" | 30 #include "cc/output/output_surface.h" |
30 #include "cc/output/output_surface_client.h" | 31 #include "cc/output/output_surface_client.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 settings.impl_side_painting = true; | 414 settings.impl_side_painting = true; |
414 | 415 |
415 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 416 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
416 settings.initial_debug_state.SetRecordRenderingStats( | 417 settings.initial_debug_state.SetRecordRenderingStats( |
417 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); | 418 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); |
418 settings.initial_debug_state.show_fps_counter = | 419 settings.initial_debug_state.show_fps_counter = |
419 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); | 420 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); |
420 // TODO(enne): Update this this compositor to use the scheduler. | 421 // TODO(enne): Update this this compositor to use the scheduler. |
421 settings.single_thread_proxy_scheduler = false; | 422 settings.single_thread_proxy_scheduler = false; |
422 | 423 |
423 host_ = cc::LayerTreeHost::CreateSingleThreaded( | 424 cc::LayerTreeHost::InitParams params; |
424 this, this, HostSharedBitmapManager::current(), | 425 params.client = this; |
425 BrowserGpuMemoryBufferManager::current(), g_task_graph_runner.Pointer(), | 426 params.shared_bitmap_manager = HostSharedBitmapManager::current(); |
426 settings, base::MessageLoopProxy::current(), nullptr); | 427 params.gpu_memory_buffer_manager = BrowserGpuMemoryBufferManager::current(); |
| 428 params.task_graph_runner = g_task_graph_runner.Pointer(); |
| 429 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 430 params.settings = &settings; |
| 431 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); |
427 host_->SetRootLayer(root_layer_); | 432 host_->SetRootLayer(root_layer_); |
428 | 433 |
429 host_->SetVisible(true); | 434 host_->SetVisible(true); |
430 host_->SetLayerTreeHostClientReady(); | 435 host_->SetLayerTreeHostClientReady(); |
431 host_->SetViewportSize(size_); | 436 host_->SetViewportSize(size_); |
432 host_->set_has_transparent_background(has_transparent_background_); | 437 host_->set_has_transparent_background(has_transparent_background_); |
433 host_->SetDeviceScaleFactor(device_scale_factor_); | 438 host_->SetDeviceScaleFactor(device_scale_factor_); |
434 | 439 |
435 if (needs_animate_) | 440 if (needs_animate_) |
436 host_->SetNeedsAnimate(); | 441 host_->SetNeedsAnimate(); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 | 732 |
728 void CompositorImpl::SetNeedsAnimate() { | 733 void CompositorImpl::SetNeedsAnimate() { |
729 needs_animate_ = true; | 734 needs_animate_ = true; |
730 if (!host_) | 735 if (!host_) |
731 return; | 736 return; |
732 | 737 |
733 host_->SetNeedsAnimate(); | 738 host_->SetNeedsAnimate(); |
734 } | 739 } |
735 | 740 |
736 } // namespace content | 741 } // namespace content |
OLD | NEW |