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

Unified Diff: base/memory/discardable_memory_allocator_android.cc

Issue 191673003: Implement ScopedFD in terms of ScopedGeneric. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « base/file_util_unittest.cc ('k') | base/memory/shared_memory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_memory_allocator_android.cc
diff --git a/base/memory/discardable_memory_allocator_android.cc b/base/memory/discardable_memory_allocator_android.cc
index 97e9abd7d6eec8baa54e2d58bed24fd6d1b2c3ba..ec51f1f0f3e01d37f4e3fd6ca2fd11ae8afe7d80 100644
--- a/base/memory/discardable_memory_allocator_android.cc
+++ b/base/memory/discardable_memory_allocator_android.cc
@@ -16,6 +16,7 @@
#include "base/basictypes.h"
#include "base/containers/hash_tables.h"
#include "base/file_util.h"
+#include "base/files/scoped_file.h"
#include "base/logging.h"
#include "base/memory/discardable_memory.h"
#include "base/memory/scoped_vector.h"
@@ -65,14 +66,13 @@ bool CreateAshmemRegion(const char* name,
size_t size,
int* out_fd,
void** out_address) {
- int fd = ashmem_create_region(name, size);
- if (fd < 0) {
+ base::ScopedFD fd(ashmem_create_region(name, size));
+ if (!fd) {
viettrungluu 2014/03/08 03:06:04 So, it occurs to me that this is extremely confusi
DLOG(ERROR) << "ashmem_create_region() failed";
return false;
}
- file_util::ScopedFD fd_closer(&fd);
- const int err = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE);
+ const int err = ashmem_set_prot_region(fd.get(), PROT_READ | PROT_WRITE);
if (err < 0) {
DLOG(ERROR) << "Error " << err << " when setting protection of ashmem";
return false;
« no previous file with comments | « base/file_util_unittest.cc ('k') | base/memory/shared_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698