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

Side by Side Diff: ui/android/resources/resource_manager.cc

Issue 2440393002: [tracing] Implement composable memory usage estimators. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 | « ui/android/resources/resource_manager.h ('k') | ui/android/resources/resource_manager_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/android/resources/resource_manager.h" 5 #include "ui/android/resources/resource_manager.h"
6 6
7 #include "base/trace_event/estimate_memory_usage.h"
7 #include "ui/gfx/geometry/insets_f.h" 8 #include "ui/gfx/geometry/insets_f.h"
8 9
9 namespace ui { 10 namespace ui {
10 11
11 ResourceManager::Resource::Resource() { 12 ResourceManager::Resource::Resource() {
12 } 13 }
13 14
14 ResourceManager::Resource::~Resource() { 15 ResourceManager::Resource::~Resource() {
15 } 16 }
16 17
(...skipping 11 matching lines...) Expand all
28 float left_scale = std::min(x_scale * scale.left(), 1.f); 29 float left_scale = std::min(x_scale * scale.left(), 1.f);
29 float right_scale = std::min(x_scale * scale.right(), 1.f); 30 float right_scale = std::min(x_scale * scale.right(), 1.f);
30 float top_scale = std::min(y_scale * scale.top(), 1.f); 31 float top_scale = std::min(y_scale * scale.top(), 1.f);
31 float bottom_scale = std::min(y_scale * scale.bottom(), 1.f); 32 float bottom_scale = std::min(y_scale * scale.bottom(), 1.f);
32 33
33 return gfx::Rect(aperture.x() * left_scale, aperture.y() * top_scale, 34 return gfx::Rect(aperture.x() * left_scale, aperture.y() * top_scale,
34 (size.width() - aperture.width()) * right_scale, 35 (size.width() - aperture.width()) * right_scale,
35 (size.height() - aperture.height()) * bottom_scale); 36 (size.height() - aperture.height()) * bottom_scale);
36 } 37 }
37 38
39 size_t ResourceManager::Resource::EstimateMemoryUsage() const {
40 using base::trace_event::EstimateMemoryUsage;
41 return EstimateMemoryUsage(ui_resource);
42 }
43
38 } // namespace ui 44 } // namespace ui
OLDNEW
« no previous file with comments | « ui/android/resources/resource_manager.h ('k') | ui/android/resources/resource_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698