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

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

Issue 2183403002: cc: Move data to LayerTree from LayerTreeHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@layer_tree_change
Patch Set: remove unused test file. Created 4 years, 4 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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 cc::LayerTreeHost::InitParams params; 496 cc::LayerTreeHost::InitParams params;
497 params.client = this; 497 params.client = this;
498 params.shared_bitmap_manager = HostSharedBitmapManager::current(); 498 params.shared_bitmap_manager = HostSharedBitmapManager::current();
499 params.gpu_memory_buffer_manager = BrowserGpuMemoryBufferManager::current(); 499 params.gpu_memory_buffer_manager = BrowserGpuMemoryBufferManager::current();
500 params.task_graph_runner = g_task_graph_runner.Pointer(); 500 params.task_graph_runner = g_task_graph_runner.Pointer();
501 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); 501 params.main_task_runner = base::ThreadTaskRunnerHandle::Get();
502 params.settings = &settings; 502 params.settings = &settings;
503 params.animation_host = cc::AnimationHost::CreateMainInstance(); 503 params.animation_host = cc::AnimationHost::CreateMainInstance();
504 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params); 504 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params);
505 DCHECK(!host_->visible()); 505 DCHECK(!host_->visible());
506 host_->SetRootLayer(root_window_->GetLayer()); 506 host_->GetLayerTree()->SetRootLayer(root_window_->GetLayer());
507 host_->set_surface_client_id(surface_id_allocator_->client_id()); 507 host_->set_surface_client_id(surface_id_allocator_->client_id());
508 host_->SetViewportSize(size_); 508 host_->GetLayerTree()->SetViewportSize(size_);
509 host_->set_has_transparent_background(has_transparent_background_); 509 host_->GetLayerTree()->set_has_transparent_background(
510 host_->SetDeviceScaleFactor(device_scale_factor_); 510 has_transparent_background_);
511 host_->GetLayerTree()->SetDeviceScaleFactor(device_scale_factor_);
511 512
512 if (needs_animate_) 513 if (needs_animate_)
513 host_->SetNeedsAnimate(); 514 host_->SetNeedsAnimate();
514 } 515 }
515 516
516 void CompositorImpl::SetVisible(bool visible) { 517 void CompositorImpl::SetVisible(bool visible) {
517 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible); 518 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible);
518 if (!visible) { 519 if (!visible) {
519 DCHECK(host_->visible()); 520 DCHECK(host_->visible());
520 521
(...skipping 11 matching lines...) Expand all
532 } else { 533 } else {
533 host_->SetVisible(true); 534 host_->SetVisible(true);
534 if (output_surface_request_pending_) 535 if (output_surface_request_pending_)
535 HandlePendingOutputSurfaceRequest(); 536 HandlePendingOutputSurfaceRequest();
536 } 537 }
537 } 538 }
538 539
539 void CompositorImpl::setDeviceScaleFactor(float factor) { 540 void CompositorImpl::setDeviceScaleFactor(float factor) {
540 device_scale_factor_ = factor; 541 device_scale_factor_ = factor;
541 if (host_) 542 if (host_)
542 host_->SetDeviceScaleFactor(factor); 543 host_->GetLayerTree()->SetDeviceScaleFactor(factor);
543 } 544 }
544 545
545 void CompositorImpl::SetWindowBounds(const gfx::Size& size) { 546 void CompositorImpl::SetWindowBounds(const gfx::Size& size) {
546 if (size_ == size) 547 if (size_ == size)
547 return; 548 return;
548 549
549 size_ = size; 550 size_ = size;
550 if (host_) 551 if (host_)
551 host_->SetViewportSize(size); 552 host_->GetLayerTree()->SetViewportSize(size);
552 if (display_) 553 if (display_)
553 display_->Resize(size); 554 display_->Resize(size);
554 root_window_->GetLayer()->SetBounds(size); 555 root_window_->GetLayer()->SetBounds(size);
555 } 556 }
556 557
557 void CompositorImpl::SetHasTransparentBackground(bool flag) { 558 void CompositorImpl::SetHasTransparentBackground(bool flag) {
558 has_transparent_background_ = flag; 559 has_transparent_background_ = flag;
559 if (host_) 560 if (host_)
560 host_->set_has_transparent_background(flag); 561 host_->GetLayerTree()->set_has_transparent_background(flag);
561 } 562 }
562 563
563 void CompositorImpl::SetNeedsComposite() { 564 void CompositorImpl::SetNeedsComposite() {
564 if (!host_->visible()) 565 if (!host_->visible())
565 return; 566 return;
566 TRACE_EVENT0("compositor", "Compositor::SetNeedsComposite"); 567 TRACE_EVENT0("compositor", "Compositor::SetNeedsComposite");
567 host_->SetNeedsAnimate(); 568 host_->SetNeedsAnimate();
568 } 569 }
569 570
570 void CompositorImpl::UpdateLayerTreeHost() { 571 void CompositorImpl::UpdateLayerTreeHost() {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 794
794 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); 795 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate");
795 host_->SetNeedsAnimate(); 796 host_->SetNeedsAnimate();
796 } 797 }
797 798
798 bool CompositorImpl::HavePendingReadbacks() { 799 bool CompositorImpl::HavePendingReadbacks() {
799 return !readback_layer_tree_->children().empty(); 800 return !readback_layer_tree_->children().empty();
800 } 801 }
801 802
802 } // namespace content 803 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698