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

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

Issue 2615793003: android: Remove DeviceDisplayInfo usage from ComopsitorImpl (Closed)
Patch Set: const 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
« no previous file with comments | « no previous file | no next file » | 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "gpu/command_buffer/client/gles2_interface.h" 59 #include "gpu/command_buffer/client/gles2_interface.h"
60 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 60 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
61 #include "gpu/ipc/client/gpu_channel_host.h" 61 #include "gpu/ipc/client/gpu_channel_host.h"
62 #include "gpu/ipc/common/gpu_surface_tracker.h" 62 #include "gpu/ipc/common/gpu_surface_tracker.h"
63 #include "gpu/vulkan/vulkan_surface.h" 63 #include "gpu/vulkan/vulkan_surface.h"
64 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" 64 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h"
65 #include "third_party/khronos/GLES2/gl2.h" 65 #include "third_party/khronos/GLES2/gl2.h"
66 #include "third_party/khronos/GLES2/gl2ext.h" 66 #include "third_party/khronos/GLES2/gl2ext.h"
67 #include "third_party/skia/include/core/SkMallocPixelRef.h" 67 #include "third_party/skia/include/core/SkMallocPixelRef.h"
68 #include "ui/android/window_android.h" 68 #include "ui/android/window_android.h"
69 #include "ui/gfx/android/device_display_info.h" 69 #include "ui/display/display.h"
70 #include "ui/display/screen.h"
70 #include "ui/gfx/swap_result.h" 71 #include "ui/gfx/swap_result.h"
71 72
72 namespace gpu { 73 namespace gpu {
73 struct GpuProcessHostedCALayerTreeParamsMac; 74 struct GpuProcessHostedCALayerTreeParamsMac;
74 } 75 }
75 76
76 namespace content { 77 namespace content {
77 78
78 namespace { 79 namespace {
79 80
80 const unsigned int kMaxDisplaySwapBuffers = 1U; 81 const unsigned int kMaxDisplaySwapBuffers = 1U;
81 82
82 gpu::SharedMemoryLimits GetCompositorContextSharedMemoryLimits() { 83 gpu::SharedMemoryLimits GetCompositorContextSharedMemoryLimits(
84 gfx::NativeWindow window) {
83 constexpr size_t kBytesPerPixel = 4; 85 constexpr size_t kBytesPerPixel = 4;
86 const gfx::Size size = display::Screen::GetScreen()
87 ->GetDisplayNearestWindow(window)
88 .GetSizeInPixel();
84 const size_t full_screen_texture_size_in_bytes = 89 const size_t full_screen_texture_size_in_bytes =
85 gfx::DeviceDisplayInfo().GetDisplayHeight() * 90 size.width() * size.height() * kBytesPerPixel;
86 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel;
87 91
88 gpu::SharedMemoryLimits limits; 92 gpu::SharedMemoryLimits limits;
89 // This limit is meant to hold the contents of the display compositor 93 // This limit is meant to hold the contents of the display compositor
90 // drawing the scene. See discussion here: 94 // drawing the scene. See discussion here:
91 // https://codereview.chromium.org/1900993002/diff/90001/content/browser/rende rer_host/compositor_impl_android.cc?context=3&column_width=80&tab_spaces=8 95 // https://codereview.chromium.org/1900993002/diff/90001/content/browser/rende rer_host/compositor_impl_android.cc?context=3&column_width=80&tab_spaces=8
92 limits.command_buffer_size = 64 * 1024; 96 limits.command_buffer_size = 64 * 1024;
93 // These limits are meant to hold the uploads for the browser UI without 97 // These limits are meant to hold the uploads for the browser UI without
94 // any excess space. 98 // any excess space.
95 limits.start_transfer_buffer_size = 64 * 1024; 99 limits.start_transfer_buffer_size = 64 * 1024;
96 limits.min_transfer_buffer_size = 64 * 1024; 100 limits.min_transfer_buffer_size = 64 * 1024;
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 case ui::ContextProviderFactory::GpuChannelHostResult::SUCCESS: 600 case ui::ContextProviderFactory::GpuChannelHostResult::SUCCESS:
597 // We don't need the context anymore if we are invisible. 601 // We don't need the context anymore if we are invisible.
598 if (!host_->IsVisible()) 602 if (!host_->IsVisible())
599 return; 603 return;
600 604
601 DCHECK(window_); 605 DCHECK(window_);
602 DCHECK_NE(surface_handle_, gpu::kNullSurfaceHandle); 606 DCHECK_NE(surface_handle_, gpu::kNullSurfaceHandle);
603 scoped_refptr<cc::ContextProvider> context_provider = 607 scoped_refptr<cc::ContextProvider> context_provider =
604 ContextProviderFactoryImpl::GetInstance() 608 ContextProviderFactoryImpl::GetInstance()
605 ->CreateDisplayContextProvider( 609 ->CreateDisplayContextProvider(
606 surface_handle_, GetCompositorContextSharedMemoryLimits(), 610 surface_handle_,
611 GetCompositorContextSharedMemoryLimits(root_window_),
607 GetCompositorContextAttributes(has_transparent_background_), 612 GetCompositorContextAttributes(has_transparent_background_),
608 false /*support_locking*/, false /*automatic_flushes*/, 613 false /*support_locking*/, false /*automatic_flushes*/,
609 std::move(gpu_channel_host)); 614 std::move(gpu_channel_host));
610 if (!context_provider->BindToCurrentThread()) { 615 if (!context_provider->BindToCurrentThread()) {
611 LOG(ERROR) << "Failed to init ContextProvider for compositor."; 616 LOG(ERROR) << "Failed to init ContextProvider for compositor.";
612 LOG_IF(FATAL, ++num_successive_context_creation_failures_ >= 2) 617 LOG_IF(FATAL, ++num_successive_context_creation_failures_ >= 2)
613 << "Too many context creation failures. Giving up... "; 618 << "Too many context creation failures. Giving up... ";
614 HandlePendingCompositorFrameSinkRequest(); 619 HandlePendingCompositorFrameSinkRequest();
615 break; 620 break;
616 } 621 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 732
728 cc::FrameSinkId CompositorImpl::GetFrameSinkId() { 733 cc::FrameSinkId CompositorImpl::GetFrameSinkId() {
729 return frame_sink_id_; 734 return frame_sink_id_;
730 } 735 }
731 736
732 bool CompositorImpl::HavePendingReadbacks() { 737 bool CompositorImpl::HavePendingReadbacks() {
733 return !readback_layer_tree_->children().empty(); 738 return !readback_layer_tree_->children().empty();
734 } 739 }
735 740
736 } // namespace content 741 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698