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

Unified Diff: mojo/nacl/nonsfi/file_util.cc

Issue 2069663002: Some scoped_ptr -> std::unique_ptr conversion, especially under //mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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 | « mojo/message_pump/message_pump_mojo_unittest.cc ('k') | mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/nacl/nonsfi/file_util.cc
diff --git a/mojo/nacl/nonsfi/file_util.cc b/mojo/nacl/nonsfi/file_util.cc
index d79e3c2750a0f1746edc66b7207b4088a834ce44..3288ed6c4e759e642ce7734dbda7eec578977f77 100644
--- a/mojo/nacl/nonsfi/file_util.cc
+++ b/mojo/nacl/nonsfi/file_util.cc
@@ -2,8 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "mojo/nacl/nonsfi/file_util.h"
+
#include <fcntl.h>
#include <unistd.h>
+
+#include <memory>
#include <vector>
#include "base/files/file_util.h"
@@ -14,7 +18,8 @@ namespace nacl {
int DataToTempFileDescriptor(const mojo::embed::Data& data) {
base::FilePath path;
- CHECK(CreateTemporaryFile(&path)) << "Could not create temp file for data";
+ CHECK(base::CreateTemporaryFile(&path))
+ << "Could not create temp file for data";
int fd = open(path.value().c_str(), O_RDWR);
CHECK_GE(fd, 0) << "Could not open temporary file";
@@ -34,7 +39,8 @@ int DataToTempFileDescriptor(const mojo::embed::Data& data) {
int MojoFileToTempFileDescriptor(mojo::files::FilePtr mojo_file) {
base::FilePath path;
- CHECK(CreateTemporaryFile(&path)) << "Could not create temp file for data";
+ CHECK(base::CreateTemporaryFile(&path))
+ << "Could not create temp file for data";
int fd = open(path.value().c_str(), O_RDWR);
CHECK_GE(fd, 0) << "Could not open temporary file";
@@ -84,7 +90,7 @@ void FileDescriptorToMojoFile(int fd, mojo::files::FilePtr mojo_file) {
mojo::files::Error error = mojo::files::Error::INTERNAL;
static const size_t kBufferSize = 0x100000;
- scoped_ptr<uint8_t[]> buf(new uint8_t[kBufferSize]);
+ std::unique_ptr<uint8_t[]> buf(new uint8_t[kBufferSize]);
int64_t offset = 0;
while (true) {
ssize_t bytes = HANDLE_EINTR(read(fd, buf.get(), kBufferSize));
« no previous file with comments | « mojo/message_pump/message_pump_mojo_unittest.cc ('k') | mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698