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

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: Missed one test. 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 cc::LayerTreeHost::InitParams params; 493 cc::LayerTreeHost::InitParams params;
494 params.client = this; 494 params.client = this;
495 params.shared_bitmap_manager = HostSharedBitmapManager::current(); 495 params.shared_bitmap_manager = HostSharedBitmapManager::current();
496 params.gpu_memory_buffer_manager = BrowserGpuMemoryBufferManager::current(); 496 params.gpu_memory_buffer_manager = BrowserGpuMemoryBufferManager::current();
497 params.task_graph_runner = g_task_graph_runner.Pointer(); 497 params.task_graph_runner = g_task_graph_runner.Pointer();
498 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); 498 params.main_task_runner = base::ThreadTaskRunnerHandle::Get();
499 params.settings = &settings; 499 params.settings = &settings;
500 params.animation_host = cc::AnimationHost::CreateMainInstance(); 500 params.animation_host = cc::AnimationHost::CreateMainInstance();
501 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params); 501 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params);
502 DCHECK(!host_->visible()); 502 DCHECK(!host_->visible());
503 host_->SetRootLayer(root_window_->GetLayer()); 503 host_->GetLayerTree()->SetRootLayer(root_window_->GetLayer());
504 host_->set_surface_client_id(surface_id_allocator_->client_id()); 504 host_->set_surface_client_id(surface_id_allocator_->client_id());
505 host_->SetViewportSize(size_); 505 host_->GetLayerTree()->SetViewportSize(size_);
506 host_->set_has_transparent_background(has_transparent_background_); 506 host_->GetLayerTree()->set_has_transparent_background(
507 host_->SetDeviceScaleFactor(device_scale_factor_); 507 has_transparent_background_);
508 host_->GetLayerTree()->SetDeviceScaleFactor(device_scale_factor_);
508 509
509 if (needs_animate_) 510 if (needs_animate_)
510 host_->SetNeedsAnimate(); 511 host_->SetNeedsAnimate();
511 } 512 }
512 513
513 void CompositorImpl::SetVisible(bool visible) { 514 void CompositorImpl::SetVisible(bool visible) {
514 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible); 515 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible);
515 if (!visible) { 516 if (!visible) {
516 DCHECK(host_->visible()); 517 DCHECK(host_->visible());
517 host_->SetVisible(false); 518 host_->SetVisible(false);
518 if (!host_->output_surface_lost()) 519 if (!host_->output_surface_lost())
519 host_->ReleaseOutputSurface(); 520 host_->ReleaseOutputSurface();
520 pending_swapbuffers_ = 0; 521 pending_swapbuffers_ = 0;
521 display_.reset(); 522 display_.reset();
522 } else { 523 } else {
523 host_->SetVisible(true); 524 host_->SetVisible(true);
524 if (output_surface_request_pending_) 525 if (output_surface_request_pending_)
525 HandlePendingOutputSurfaceRequest(); 526 HandlePendingOutputSurfaceRequest();
526 } 527 }
527 } 528 }
528 529
529 void CompositorImpl::setDeviceScaleFactor(float factor) { 530 void CompositorImpl::setDeviceScaleFactor(float factor) {
530 device_scale_factor_ = factor; 531 device_scale_factor_ = factor;
531 if (host_) 532 if (host_)
532 host_->SetDeviceScaleFactor(factor); 533 host_->GetLayerTree()->SetDeviceScaleFactor(factor);
533 } 534 }
534 535
535 void CompositorImpl::SetWindowBounds(const gfx::Size& size) { 536 void CompositorImpl::SetWindowBounds(const gfx::Size& size) {
536 if (size_ == size) 537 if (size_ == size)
537 return; 538 return;
538 539
539 size_ = size; 540 size_ = size;
540 if (host_) 541 if (host_)
541 host_->SetViewportSize(size); 542 host_->GetLayerTree()->SetViewportSize(size);
542 if (display_) 543 if (display_)
543 display_->Resize(size); 544 display_->Resize(size);
544 root_window_->GetLayer()->SetBounds(size); 545 root_window_->GetLayer()->SetBounds(size);
545 } 546 }
546 547
547 void CompositorImpl::SetHasTransparentBackground(bool flag) { 548 void CompositorImpl::SetHasTransparentBackground(bool flag) {
548 has_transparent_background_ = flag; 549 has_transparent_background_ = flag;
549 if (host_) 550 if (host_)
550 host_->set_has_transparent_background(flag); 551 host_->GetLayerTree()->set_has_transparent_background(flag);
551 } 552 }
552 553
553 void CompositorImpl::SetNeedsComposite() { 554 void CompositorImpl::SetNeedsComposite() {
554 if (!host_->visible()) 555 if (!host_->visible())
555 return; 556 return;
556 TRACE_EVENT0("compositor", "Compositor::SetNeedsComposite"); 557 TRACE_EVENT0("compositor", "Compositor::SetNeedsComposite");
557 host_->SetNeedsAnimate(); 558 host_->SetNeedsAnimate();
558 } 559 }
559 560
560 void CompositorImpl::UpdateLayerTreeHost() { 561 void CompositorImpl::UpdateLayerTreeHost() {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 void CompositorImpl::SetNeedsAnimate() { 776 void CompositorImpl::SetNeedsAnimate() {
776 needs_animate_ = true; 777 needs_animate_ = true;
777 if (!host_->visible()) 778 if (!host_->visible())
778 return; 779 return;
779 780
780 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); 781 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate");
781 host_->SetNeedsAnimate(); 782 host_->SetNeedsAnimate();
782 } 783 }
783 784
784 } // namespace content 785 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698