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

Unified Diff: cc/output/software_frame_data.cc

Issue 196423027: Move SoftwareFrameData overflow checks to the IPC code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: softwareframesize: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/software_frame_data.h ('k') | content/browser/renderer_host/software_frame_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/software_frame_data.cc
diff --git a/cc/output/software_frame_data.cc b/cc/output/software_frame_data.cc
index 0b430325092f02a162776910aced9beca59c1a38..4bc09807e08125c472004be1325145faf9d9e2bb 100644
--- a/cc/output/software_frame_data.cc
+++ b/cc/output/software_frame_data.cc
@@ -12,4 +12,17 @@ SoftwareFrameData::SoftwareFrameData()
SoftwareFrameData::~SoftwareFrameData() {}
+size_t SoftwareFrameData::SizeInBytes() const {
+ size_t bytes_per_pixel = 4;
+ size_t width = size.width();
+ size_t height = size.height();
+ return bytes_per_pixel * width * height;
+}
+
+base::CheckedNumeric<size_t> SoftwareFrameData::CheckedSizeInBytes() const {
+ return base::CheckedNumeric<size_t>(4) *
+ base::CheckedNumeric<size_t>(size.width()) *
+ base::CheckedNumeric<size_t>(size.height());
+}
+
} // namespace cc
« no previous file with comments | « cc/output/software_frame_data.h ('k') | content/browser/renderer_host/software_frame_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698