| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/app/android/blimp_compositor_manager_android.h" | 5 #include "blimp/client/app/android/blimp_compositor_manager_android.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 // The minimum valid content width in a tile. This is used to make sure the | 15 // The minimum valid content width in a tile. This is used to make sure the |
| 16 // width of the content on the rightmost tile isn't a tiny sliver. | 16 // width of the content on the rightmost tile isn't a tiny sliver. |
| 17 const int kMinimumTileContentWidthPixels = 64; | 17 const int kMinimumTileContentWidthPixels = 64; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace blimp { | 20 namespace blimp { |
| 21 namespace client { | 21 namespace client { |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 std::unique_ptr<BlimpCompositorManagerAndroid> | 24 std::unique_ptr<BlimpCompositorManagerAndroid> |
| 25 BlimpCompositorManagerAndroid::Create( | 25 BlimpCompositorManagerAndroid::Create( |
| 26 const gfx::Size& real_size, | 26 const gfx::Size& real_size, |
| 27 const gfx::Size& size, | 27 const gfx::Size& size, |
| 28 RenderWidgetFeature* render_widget_feature, | 28 RenderWidgetFeature* render_widget_feature, |
| 29 BlimpCompositorManagerClient* client) { | 29 cc::SurfaceManager* surface_manager, |
| 30 BlimpGpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 31 SurfaceIdAllocationCallback callback) { |
| 30 gfx::Size device_size(real_size); | 32 gfx::Size device_size(real_size); |
| 31 bool real_size_supported = true; | 33 bool real_size_supported = true; |
| 32 if (device_size.IsEmpty()) { | 34 if (device_size.IsEmpty()) { |
| 33 real_size_supported = false; | 35 real_size_supported = false; |
| 34 device_size = size; | 36 device_size = size; |
| 35 } | 37 } |
| 36 return base::WrapUnique(new BlimpCompositorManagerAndroid( | 38 return base::WrapUnique(new BlimpCompositorManagerAndroid( |
| 37 device_size, real_size_supported, render_widget_feature, client)); | 39 device_size, real_size_supported, render_widget_feature, surface_manager, |
| 40 gpu_memory_buffer_manager, callback)); |
| 38 } | 41 } |
| 39 | 42 |
| 40 BlimpCompositorManagerAndroid::BlimpCompositorManagerAndroid( | 43 BlimpCompositorManagerAndroid::BlimpCompositorManagerAndroid( |
| 41 const gfx::Size& size, | 44 const gfx::Size& size, |
| 42 bool real_size_supported, | 45 bool real_size_supported, |
| 43 RenderWidgetFeature* render_widget_feature, | 46 RenderWidgetFeature* render_widget_feature, |
| 44 BlimpCompositorManagerClient* client) | 47 cc::SurfaceManager* surface_manager, |
| 45 : BlimpCompositorManager(render_widget_feature, client), | 48 BlimpGpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 49 SurfaceIdAllocationCallback callback) |
| 50 : BlimpCompositorManager(render_widget_feature, |
| 51 surface_manager, |
| 52 gpu_memory_buffer_manager, |
| 53 callback), |
| 46 portrait_width_(std::min(size.width(), size.height())), | 54 portrait_width_(std::min(size.width(), size.height())), |
| 47 landscape_width_(std::max(size.width(), size.height())), | 55 landscape_width_(std::max(size.width(), size.height())), |
| 48 real_size_supported_(real_size_supported) {} | 56 real_size_supported_(real_size_supported) {} |
| 49 | 57 |
| 50 BlimpCompositorManagerAndroid::~BlimpCompositorManagerAndroid() {} | 58 BlimpCompositorManagerAndroid::~BlimpCompositorManagerAndroid() {} |
| 51 | 59 |
| 52 void BlimpCompositorManagerAndroid::GenerateLayerTreeSettings( | 60 void BlimpCompositorManagerAndroid::GenerateLayerTreeSettings( |
| 53 cc::LayerTreeSettings* settings) { | 61 cc::LayerTreeSettings* settings) { |
| 54 BlimpCompositorManager::GenerateLayerTreeSettings(settings); | 62 BlimpCompositorManager::GenerateLayerTreeSettings(settings); |
| 55 | 63 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (numTiles > 16) | 98 if (numTiles > 16) |
| 91 default_tile_size = 384; | 99 default_tile_size = 384; |
| 92 if (numTiles >= 40) | 100 if (numTiles >= 40) |
| 93 default_tile_size = 512; | 101 default_tile_size = 512; |
| 94 } | 102 } |
| 95 settings->default_tile_size.SetSize(default_tile_size, default_tile_size); | 103 settings->default_tile_size.SetSize(default_tile_size, default_tile_size); |
| 96 } | 104 } |
| 97 | 105 |
| 98 } // namespace client | 106 } // namespace client |
| 99 } // namespace blimp | 107 } // namespace blimp |
| OLD | NEW |