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

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: virtual dtor 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
« no previous file with comments | « cc/trees/single_thread_proxy.cc ('k') | ui/android/resources/resource_manager_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 observer_list_.AddObserver(observer); 740 observer_list_.AddObserver(observer);
740 } 741 }
741 742
742 void CompositorImpl::RemoveObserver(VSyncObserver* observer) { 743 void CompositorImpl::RemoveObserver(VSyncObserver* observer) {
743 observer_list_.RemoveObserver(observer); 744 observer_list_.RemoveObserver(observer);
744 } 745 }
745 746
746 cc::UIResourceId CompositorImpl::CreateUIResource( 747 cc::UIResourceId CompositorImpl::CreateUIResource(
747 cc::UIResourceClient* client) { 748 cc::UIResourceClient* client) {
748 TRACE_EVENT0("compositor", "CompositorImpl::CreateUIResource"); 749 TRACE_EVENT0("compositor", "CompositorImpl::CreateUIResource");
749 return host_->CreateUIResource(client); 750 return host_->GetUIResourceManager()->CreateUIResource(client);
750 } 751 }
751 752
752 void CompositorImpl::DeleteUIResource(cc::UIResourceId resource_id) { 753 void CompositorImpl::DeleteUIResource(cc::UIResourceId resource_id) {
753 TRACE_EVENT0("compositor", "CompositorImpl::DeleteUIResource"); 754 TRACE_EVENT0("compositor", "CompositorImpl::DeleteUIResource");
754 host_->DeleteUIResource(resource_id); 755 host_->GetUIResourceManager()->DeleteUIResource(resource_id);
755 } 756 }
756 757
757 bool CompositorImpl::SupportsETC1NonPowerOfTwo() const { 758 bool CompositorImpl::SupportsETC1NonPowerOfTwo() const {
758 return gpu_capabilities_.texture_format_etc1_npot; 759 return gpu_capabilities_.texture_format_etc1_npot;
759 } 760 }
760 761
761 void CompositorImpl::DidPostSwapBuffers() { 762 void CompositorImpl::DidPostSwapBuffers() {
762 TRACE_EVENT0("compositor", "CompositorImpl::DidPostSwapBuffers"); 763 TRACE_EVENT0("compositor", "CompositorImpl::DidPostSwapBuffers");
763 pending_swapbuffers_++; 764 pending_swapbuffers_++;
764 } 765 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 818
818 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); 819 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate");
819 host_->SetNeedsAnimate(); 820 host_->SetNeedsAnimate();
820 } 821 }
821 822
822 bool CompositorImpl::HavePendingReadbacks() { 823 bool CompositorImpl::HavePendingReadbacks() {
823 return !readback_layer_tree_->children().empty(); 824 return !readback_layer_tree_->children().empty();
824 } 825 }
825 826
826 } // namespace content 827 } // namespace content
OLDNEW
« no previous file with comments | « cc/trees/single_thread_proxy.cc ('k') | ui/android/resources/resource_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698