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

Unified Diff: src/utils/android/ashmem.cpp

Issue 241123002: Ashmem functions compile when size_t != __u32 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/android/ashmem.cpp
diff --git a/src/utils/android/ashmem.cpp b/src/utils/android/ashmem.cpp
index 461c062390142fdf3ab37532816c69f41e574007..1e512be2b1cc394cd78563d6b7f04c930f85090e 100644
--- a/src/utils/android/ashmem.cpp
+++ b/src/utils/android/ashmem.cpp
@@ -22,6 +22,8 @@
#include <linux/ashmem.h>
+#include <SkTypes.h> // SkASSERT
+
#define ASHMEM_DEVICE "/dev/ashmem"
/*
@@ -66,13 +68,19 @@ int ashmem_set_prot_region(int fd, int prot)
int ashmem_pin_region(int fd, size_t offset, size_t len)
{
- struct ashmem_pin pin = { offset, len };
+ // Skia only calls this when offset=len=0.
+ struct ashmem_pin pin = { static_cast<__u32>(offset),
+ static_cast<__u32>(len) };
+ SkASSERT(pin.offset == offset && pin.len == len);
return ioctl(fd, ASHMEM_PIN, &pin);
}
int ashmem_unpin_region(int fd, size_t offset, size_t len)
{
- struct ashmem_pin pin = { offset, len };
+ // Skia only calls this when offset=len=0.
+ struct ashmem_pin pin = { static_cast<__u32>(offset),
+ static_cast<__u32>(len) };
+ SkASSERT(pin.offset == offset && pin.len == len);
return ioctl(fd, ASHMEM_UNPIN, &pin);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698