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

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

Issue 2608023002: Remove unused function Compositor::setDeviceScaleFactor. (Closed)
Patch Set: refine Created 3 years, 11 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // static 317 // static
318 bool CompositorImpl::IsInitialized() { 318 bool CompositorImpl::IsInitialized() {
319 return g_initialized; 319 return g_initialized;
320 } 320 }
321 321
322 CompositorImpl::CompositorImpl(CompositorClient* client, 322 CompositorImpl::CompositorImpl(CompositorClient* client,
323 gfx::NativeWindow root_window) 323 gfx::NativeWindow root_window)
324 : frame_sink_id_( 324 : frame_sink_id_(
325 ui::ContextProviderFactory::GetInstance()->AllocateFrameSinkId()), 325 ui::ContextProviderFactory::GetInstance()->AllocateFrameSinkId()),
326 resource_manager_(root_window), 326 resource_manager_(root_window),
327 device_scale_factor_(1),
328 window_(NULL), 327 window_(NULL),
329 surface_handle_(gpu::kNullSurfaceHandle), 328 surface_handle_(gpu::kNullSurfaceHandle),
330 client_(client), 329 client_(client),
331 root_window_(root_window), 330 root_window_(root_window),
332 needs_animate_(false), 331 needs_animate_(false),
333 pending_swapbuffers_(0U), 332 pending_swapbuffers_(0U),
334 num_successive_context_creation_failures_(0), 333 num_successive_context_creation_failures_(0),
335 compositor_frame_sink_request_pending_(false), 334 compositor_frame_sink_request_pending_(false),
336 weak_factory_(this) { 335 weak_factory_(this) {
337 ui::ContextProviderFactory::GetInstance() 336 ui::ContextProviderFactory::GetInstance()
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 params.task_graph_runner = g_task_graph_runner.Pointer(); 435 params.task_graph_runner = g_task_graph_runner.Pointer();
437 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); 436 params.main_task_runner = base::ThreadTaskRunnerHandle::Get();
438 params.settings = &settings; 437 params.settings = &settings;
439 params.mutator_host = animation_host_.get(); 438 params.mutator_host = animation_host_.get();
440 host_ = cc::LayerTreeHostInProcess::CreateSingleThreaded(this, &params); 439 host_ = cc::LayerTreeHostInProcess::CreateSingleThreaded(this, &params);
441 DCHECK(!host_->IsVisible()); 440 DCHECK(!host_->IsVisible());
442 host_->GetLayerTree()->SetRootLayer(root_window_->GetLayer()); 441 host_->GetLayerTree()->SetRootLayer(root_window_->GetLayer());
443 host_->SetFrameSinkId(frame_sink_id_); 442 host_->SetFrameSinkId(frame_sink_id_);
444 host_->GetLayerTree()->SetViewportSize(size_); 443 host_->GetLayerTree()->SetViewportSize(size_);
445 SetHasTransparentBackground(false); 444 SetHasTransparentBackground(false);
446 host_->GetLayerTree()->SetDeviceScaleFactor(device_scale_factor_); 445 host_->GetLayerTree()->SetDeviceScaleFactor(1);
447 446
448 if (needs_animate_) 447 if (needs_animate_)
449 host_->SetNeedsAnimate(); 448 host_->SetNeedsAnimate();
450 } 449 }
451 450
452 void CompositorImpl::SetVisible(bool visible) { 451 void CompositorImpl::SetVisible(bool visible) {
453 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible); 452 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible);
454 if (!visible) { 453 if (!visible) {
455 DCHECK(host_->IsVisible()); 454 DCHECK(host_->IsVisible());
456 455
457 // Make a best effort to try to complete pending readbacks. 456 // Make a best effort to try to complete pending readbacks.
458 // TODO(crbug.com/637035): Consider doing this in a better way, 457 // TODO(crbug.com/637035): Consider doing this in a better way,
459 // ideally with the guarantee of readbacks completing. 458 // ideally with the guarantee of readbacks completing.
460 if (display_.get() && HavePendingReadbacks()) 459 if (display_.get() && HavePendingReadbacks())
461 display_->ForceImmediateDrawAndSwapIfPossible(); 460 display_->ForceImmediateDrawAndSwapIfPossible();
462 461
463 host_->SetVisible(false); 462 host_->SetVisible(false);
464 host_->ReleaseCompositorFrameSink(); 463 host_->ReleaseCompositorFrameSink();
465 pending_swapbuffers_ = 0; 464 pending_swapbuffers_ = 0;
466 display_.reset(); 465 display_.reset();
467 } else { 466 } else {
468 host_->SetVisible(true); 467 host_->SetVisible(true);
469 if (compositor_frame_sink_request_pending_) 468 if (compositor_frame_sink_request_pending_)
470 HandlePendingCompositorFrameSinkRequest(); 469 HandlePendingCompositorFrameSinkRequest();
471 } 470 }
472 } 471 }
473 472
474 void CompositorImpl::setDeviceScaleFactor(float factor) {
475 device_scale_factor_ = factor;
476 if (host_)
477 host_->GetLayerTree()->SetDeviceScaleFactor(factor);
478 }
479
480 void CompositorImpl::SetWindowBounds(const gfx::Size& size) { 473 void CompositorImpl::SetWindowBounds(const gfx::Size& size) {
481 if (size_ == size) 474 if (size_ == size)
482 return; 475 return;
483 476
484 size_ = size; 477 size_ = size;
485 if (host_) 478 if (host_)
486 host_->GetLayerTree()->SetViewportSize(size); 479 host_->GetLayerTree()->SetViewportSize(size);
487 if (display_) 480 if (display_)
488 display_->Resize(size); 481 display_->Resize(size);
489 root_window_->GetLayer()->SetBounds(size); 482 root_window_->GetLayer()->SetBounds(size);
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 727
735 cc::FrameSinkId CompositorImpl::GetFrameSinkId() { 728 cc::FrameSinkId CompositorImpl::GetFrameSinkId() {
736 return frame_sink_id_; 729 return frame_sink_id_;
737 } 730 }
738 731
739 bool CompositorImpl::HavePendingReadbacks() { 732 bool CompositorImpl::HavePendingReadbacks() {
740 return !readback_layer_tree_->children().empty(); 733 return !readback_layer_tree_->children().empty();
741 } 734 }
742 735
743 } // namespace content 736 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.h ('k') | content/public/browser/android/compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698