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

Unified Diff: cc/resources/texture_mailbox.cc

Issue 221523003: cc: Remove all usage of GetArea() from production code in cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: getarea: 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/resources/texture_mailbox.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/resources/texture_mailbox.cc
diff --git a/cc/resources/texture_mailbox.cc b/cc/resources/texture_mailbox.cc
index 8c1a6ede9e1f8327f87a18cac022467db8ba06bc..90ce6be79c79272508dcba015fd9549c0f11b961 100644
--- a/cc/resources/texture_mailbox.cc
+++ b/cc/resources/texture_mailbox.cc
@@ -5,6 +5,7 @@
#include "cc/resources/texture_mailbox.h"
#include "base/logging.h"
+#include "cc/resources/shared_bitmap.h"
#include "third_party/khronos/GLES2/gl2.h"
namespace cc {
@@ -29,8 +30,8 @@ TextureMailbox::TextureMailbox(base::SharedMemory* shared_memory,
shared_memory_size_(size),
allow_overlay_(false) {
// If an embedder of cc gives an invalid TextureMailbox, we should crash
- // safely rather than overflow.
- CHECK(CheckedSharedMemorySizeInBytes().IsValid());
+ // here to identify the offender.
+ CHECK(SharedBitmap::VerifySizeInBytes(shared_memory_size_));
}
TextureMailbox::~TextureMailbox() {}
@@ -50,17 +51,9 @@ bool TextureMailbox::Equals(const TextureMailbox& other) const {
}
size_t TextureMailbox::SharedMemorySizeInBytes() const {
- size_t bytes_per_pixel = 4;
- size_t width = shared_memory_size_.width();
- size_t height = shared_memory_size_.height();
- return bytes_per_pixel * width * height;
-}
-
-base::CheckedNumeric<size_t> TextureMailbox::CheckedSharedMemorySizeInBytes()
- const {
- return base::CheckedNumeric<size_t>(4) *
- base::CheckedNumeric<size_t>(shared_memory_size_.width()) *
- base::CheckedNumeric<size_t>(shared_memory_size_.height());
+ // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the
+ // constructor and the field is immutable.
+ return SharedBitmap::UncheckedSizeInBytes(shared_memory_size_);
}
} // namespace cc
« no previous file with comments | « cc/resources/texture_mailbox.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