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 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <unordered_set> | 10 #include <unordered_set> |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 501 |
502 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 502 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
503 settings.initial_debug_state.SetRecordRenderingStats( | 503 settings.initial_debug_state.SetRecordRenderingStats( |
504 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); | 504 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); |
505 settings.initial_debug_state.show_fps_counter = | 505 settings.initial_debug_state.show_fps_counter = |
506 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); | 506 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); |
507 settings.single_thread_proxy_scheduler = true; | 507 settings.single_thread_proxy_scheduler = true; |
508 | 508 |
509 cc::LayerTreeHostInProcess::InitParams params; | 509 cc::LayerTreeHostInProcess::InitParams params; |
510 params.client = this; | 510 params.client = this; |
511 params.shared_bitmap_manager = HostSharedBitmapManager::current(); | |
512 params.gpu_memory_buffer_manager = BrowserGpuMemoryBufferManager::current(); | |
513 params.task_graph_runner = g_task_graph_runner.Pointer(); | 511 params.task_graph_runner = g_task_graph_runner.Pointer(); |
514 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 512 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
515 params.settings = &settings; | 513 params.settings = &settings; |
516 params.animation_host = cc::AnimationHost::CreateMainInstance(); | 514 params.animation_host = cc::AnimationHost::CreateMainInstance(); |
517 host_ = cc::LayerTreeHostInProcess::CreateSingleThreaded(this, ¶ms); | 515 host_ = cc::LayerTreeHostInProcess::CreateSingleThreaded(this, ¶ms); |
518 DCHECK(!host_->IsVisible()); | 516 DCHECK(!host_->IsVisible()); |
519 host_->GetLayerTree()->SetRootLayer(root_window_->GetLayer()); | 517 host_->GetLayerTree()->SetRootLayer(root_window_->GetLayer()); |
520 host_->SetFrameSinkId(frame_sink_id_); | 518 host_->SetFrameSinkId(frame_sink_id_); |
521 host_->GetLayerTree()->SetViewportSize(size_); | 519 host_->GetLayerTree()->SetViewportSize(size_); |
522 host_->GetLayerTree()->set_has_transparent_background( | 520 host_->GetLayerTree()->set_has_transparent_background( |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 display_output_surface->capabilities().max_frames_pending)); | 714 display_output_surface->capabilities().max_frames_pending)); |
717 | 715 |
718 display_.reset(new cc::Display( | 716 display_.reset(new cc::Display( |
719 HostSharedBitmapManager::current(), | 717 HostSharedBitmapManager::current(), |
720 BrowserGpuMemoryBufferManager::current(), | 718 BrowserGpuMemoryBufferManager::current(), |
721 host_->GetSettings().renderer_settings, std::move(begin_frame_source), | 719 host_->GetSettings().renderer_settings, std::move(begin_frame_source), |
722 std::move(display_output_surface), std::move(scheduler), | 720 std::move(display_output_surface), std::move(scheduler), |
723 base::MakeUnique<cc::TextureMailboxDeleter>(task_runner))); | 721 base::MakeUnique<cc::TextureMailboxDeleter>(task_runner))); |
724 | 722 |
725 auto compositor_frame_sink = | 723 auto compositor_frame_sink = |
726 vulkan_context_provider ? base::MakeUnique<cc::DirectCompositorFrameSink>( | 724 vulkan_context_provider |
727 frame_sink_id_, manager, display_.get(), | 725 ? base::MakeUnique<cc::DirectCompositorFrameSink>( |
728 vulkan_context_provider) | 726 frame_sink_id_, manager, display_.get(), |
729 : base::MakeUnique<cc::DirectCompositorFrameSink>( | 727 vulkan_context_provider) |
730 frame_sink_id_, manager, display_.get(), | 728 : base::MakeUnique<cc::DirectCompositorFrameSink>( |
731 context_provider, nullptr); | 729 frame_sink_id_, manager, display_.get(), context_provider, |
| 730 nullptr, BrowserGpuMemoryBufferManager::current(), |
| 731 HostSharedBitmapManager::current()); |
732 | 732 |
733 display_->SetVisible(true); | 733 display_->SetVisible(true); |
734 display_->Resize(size_); | 734 display_->Resize(size_); |
735 host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 735 host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
736 } | 736 } |
737 | 737 |
738 void CompositorImpl::AddObserver(VSyncObserver* observer) { | 738 void CompositorImpl::AddObserver(VSyncObserver* observer) { |
739 observer_list_.AddObserver(observer); | 739 observer_list_.AddObserver(observer); |
740 } | 740 } |
741 | 741 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 | 816 |
817 cc::FrameSinkId CompositorImpl::GetFrameSinkId() { | 817 cc::FrameSinkId CompositorImpl::GetFrameSinkId() { |
818 return frame_sink_id_; | 818 return frame_sink_id_; |
819 } | 819 } |
820 | 820 |
821 bool CompositorImpl::HavePendingReadbacks() { | 821 bool CompositorImpl::HavePendingReadbacks() { |
822 return !readback_layer_tree_->children().empty(); | 822 return !readback_layer_tree_->children().empty(); |
823 } | 823 } |
824 | 824 |
825 } // namespace content | 825 } // namespace content |
OLD | NEW |