Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(772)

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 2322943003: cc: Move UI Resource management out of LayerTreeHost. (Closed)
Patch Set: format Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
32 #include "cc/base/switches.h" 32 #include "cc/base/switches.h"
33 #include "cc/input/input_handler.h" 33 #include "cc/input/input_handler.h"
34 #include "cc/layers/layer.h" 34 #include "cc/layers/layer.h"
35 #include "cc/output/compositor_frame.h" 35 #include "cc/output/compositor_frame.h"
36 #include "cc/output/context_provider.h" 36 #include "cc/output/context_provider.h"
37 #include "cc/output/output_surface.h" 37 #include "cc/output/output_surface.h"
38 #include "cc/output/output_surface_client.h" 38 #include "cc/output/output_surface_client.h"
39 #include "cc/output/texture_mailbox_deleter.h" 39 #include "cc/output/texture_mailbox_deleter.h"
40 #include "cc/output/vulkan_in_process_context_provider.h" 40 #include "cc/output/vulkan_in_process_context_provider.h"
41 #include "cc/raster/single_thread_task_graph_runner.h" 41 #include "cc/raster/single_thread_task_graph_runner.h"
42 #include "cc/resources/ui_resource_manager.h"
42 #include "cc/scheduler/begin_frame_source.h" 43 #include "cc/scheduler/begin_frame_source.h"
43 #include "cc/surfaces/display.h" 44 #include "cc/surfaces/display.h"
44 #include "cc/surfaces/display_scheduler.h" 45 #include "cc/surfaces/display_scheduler.h"
45 #include "cc/surfaces/surface_display_output_surface.h" 46 #include "cc/surfaces/surface_display_output_surface.h"
46 #include "cc/surfaces/surface_id_allocator.h" 47 #include "cc/surfaces/surface_id_allocator.h"
47 #include "cc/trees/layer_tree_host.h" 48 #include "cc/trees/layer_tree_host.h"
48 #include "cc/trees/layer_tree_settings.h" 49 #include "cc/trees/layer_tree_settings.h"
49 #include "components/display_compositor/compositor_overlay_candidate_validator_a ndroid.h" 50 #include "components/display_compositor/compositor_overlay_candidate_validator_a ndroid.h"
50 #include "components/display_compositor/gl_helper.h" 51 #include "components/display_compositor/gl_helper.h"
51 #include "content/browser/android/child_process_launcher_android.h" 52 #include "content/browser/android/child_process_launcher_android.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 ->RegisterSurfaceClientId(surface_id_allocator_->client_id()); 404 ->RegisterSurfaceClientId(surface_id_allocator_->client_id());
404 DCHECK(client); 405 DCHECK(client);
405 DCHECK(root_window); 406 DCHECK(root_window);
406 DCHECK(root_window->GetLayer() == nullptr); 407 DCHECK(root_window->GetLayer() == nullptr);
407 root_window->SetLayer(cc::Layer::Create()); 408 root_window->SetLayer(cc::Layer::Create());
408 readback_layer_tree_ = cc::Layer::Create(); 409 readback_layer_tree_ = cc::Layer::Create();
409 readback_layer_tree_->SetHideLayerAndSubtree(true); 410 readback_layer_tree_->SetHideLayerAndSubtree(true);
410 root_window->GetLayer()->AddChild(readback_layer_tree_); 411 root_window->GetLayer()->AddChild(readback_layer_tree_);
411 root_window->AttachCompositor(this); 412 root_window->AttachCompositor(this);
412 CreateLayerTreeHost(); 413 CreateLayerTreeHost();
413 resource_manager_.Init(host_.get()); 414 resource_manager_.Init(host_->GetUIResourceManager());
414 } 415 }
415 416
416 CompositorImpl::~CompositorImpl() { 417 CompositorImpl::~CompositorImpl() {
417 root_window_->DetachCompositor(); 418 root_window_->DetachCompositor();
418 root_window_->SetLayer(nullptr); 419 root_window_->SetLayer(nullptr);
419 // Clean-up any surface references. 420 // Clean-up any surface references.
420 SetSurface(NULL); 421 SetSurface(NULL);
421 ui::ContextProviderFactory::GetInstance() 422 ui::ContextProviderFactory::GetInstance()
422 ->GetSurfaceManager() 423 ->GetSurfaceManager()
423 ->InvalidateSurfaceClientId(surface_id_allocator_->client_id()); 424 ->InvalidateSurfaceClientId(surface_id_allocator_->client_id());
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 observer_list_.AddObserver(observer); 739 observer_list_.AddObserver(observer);
739 } 740 }
740 741
741 void CompositorImpl::RemoveObserver(VSyncObserver* observer) { 742 void CompositorImpl::RemoveObserver(VSyncObserver* observer) {
742 observer_list_.RemoveObserver(observer); 743 observer_list_.RemoveObserver(observer);
743 } 744 }
744 745
745 cc::UIResourceId CompositorImpl::CreateUIResource( 746 cc::UIResourceId CompositorImpl::CreateUIResource(
746 cc::UIResourceClient* client) { 747 cc::UIResourceClient* client) {
747 TRACE_EVENT0("compositor", "CompositorImpl::CreateUIResource"); 748 TRACE_EVENT0("compositor", "CompositorImpl::CreateUIResource");
748 return host_->CreateUIResource(client); 749 return host_->GetUIResourceManager()->CreateUIResource(client);
749 } 750 }
750 751
751 void CompositorImpl::DeleteUIResource(cc::UIResourceId resource_id) { 752 void CompositorImpl::DeleteUIResource(cc::UIResourceId resource_id) {
752 TRACE_EVENT0("compositor", "CompositorImpl::DeleteUIResource"); 753 TRACE_EVENT0("compositor", "CompositorImpl::DeleteUIResource");
753 host_->DeleteUIResource(resource_id); 754 host_->GetUIResourceManager()->DeleteUIResource(resource_id);
754 } 755 }
755 756
756 bool CompositorImpl::SupportsETC1NonPowerOfTwo() const { 757 bool CompositorImpl::SupportsETC1NonPowerOfTwo() const {
757 return gpu_capabilities_.texture_format_etc1_npot; 758 return gpu_capabilities_.texture_format_etc1_npot;
758 } 759 }
759 760
760 void CompositorImpl::DidPostSwapBuffers() { 761 void CompositorImpl::DidPostSwapBuffers() {
761 TRACE_EVENT0("compositor", "CompositorImpl::DidPostSwapBuffers"); 762 TRACE_EVENT0("compositor", "CompositorImpl::DidPostSwapBuffers");
762 pending_swapbuffers_++; 763 pending_swapbuffers_++;
763 } 764 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 817
817 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); 818 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate");
818 host_->SetNeedsAnimate(); 819 host_->SetNeedsAnimate();
819 } 820 }
820 821
821 bool CompositorImpl::HavePendingReadbacks() { 822 bool CompositorImpl::HavePendingReadbacks() {
822 return !readback_layer_tree_->children().empty(); 823 return !readback_layer_tree_->children().empty();
823 } 824 }
824 825
825 } // namespace content 826 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698