OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/software_frame_manager.h" | 5 #include "content/browser/renderer_host/software_frame_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
10 #include "base/numerics/safe_math.h" | 10 #include "base/numerics/safe_math.h" |
11 #include "cc/resources/shared_bitmap.h" | 11 #include "cc/resources/shared_bitmap.h" |
12 #include "content/browser/renderer_host/dip_util.h" | |
13 #include "content/common/host_shared_bitmap_manager.h" | 12 #include "content/common/host_shared_bitmap_manager.h" |
14 #include "content/public/browser/user_metrics.h" | 13 #include "content/public/browser/user_metrics.h" |
| 14 #include "ui/gfx/geometry/dip_util.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 void ReleaseMailbox(scoped_refptr<content::SoftwareFrame> frame, | 18 void ReleaseMailbox(scoped_refptr<content::SoftwareFrame> frame, |
19 uint32 sync_point, | 19 uint32 sync_point, |
20 bool lost_resource) {} | 20 bool lost_resource) {} |
21 | 21 |
22 } // namespace | 22 } // namespace |
23 | 23 |
24 namespace content { | 24 namespace content { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return current_frame_->frame_device_scale_factor_; | 159 return current_frame_->frame_device_scale_factor_; |
160 } | 160 } |
161 | 161 |
162 gfx::Size SoftwareFrameManager::GetCurrentFrameSizeInPixels() const { | 162 gfx::Size SoftwareFrameManager::GetCurrentFrameSizeInPixels() const { |
163 DCHECK(HasCurrentFrame()); | 163 DCHECK(HasCurrentFrame()); |
164 return current_frame_->frame_size_pixels_; | 164 return current_frame_->frame_size_pixels_; |
165 } | 165 } |
166 | 166 |
167 gfx::Size SoftwareFrameManager::GetCurrentFrameSizeInDIP() const { | 167 gfx::Size SoftwareFrameManager::GetCurrentFrameSizeInDIP() const { |
168 DCHECK(HasCurrentFrame()); | 168 DCHECK(HasCurrentFrame()); |
169 return ConvertSizeToDIP(current_frame_->frame_device_scale_factor_, | 169 return gfx::ConvertSizeToDIP(current_frame_->frame_device_scale_factor_, |
170 current_frame_->frame_size_pixels_); | 170 current_frame_->frame_size_pixels_); |
171 } | 171 } |
172 | 172 |
173 void SoftwareFrameManager::EvictCurrentFrame() { | 173 void SoftwareFrameManager::EvictCurrentFrame() { |
174 DCHECK(HasCurrentFrame()); | 174 DCHECK(HasCurrentFrame()); |
175 DiscardCurrentFrame(); | 175 DiscardCurrentFrame(); |
176 if (client_) | 176 if (client_) |
177 client_->ReleaseReferencesToSoftwareFrame(); | 177 client_->ReleaseReferencesToSoftwareFrame(); |
178 } | 178 } |
179 | 179 |
180 } // namespace content | 180 } // namespace content |
OLD | NEW |