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

Unified Diff: chrome/browser/chromeos/drive/file_system/create_file_operation.cc

Issue 15915008: drive: Stop using /dev/null to store an empty file to the cache from CreateFileOperation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | chrome/browser/chromeos/drive/file_system_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/file_system/create_file_operation.cc
diff --git a/chrome/browser/chromeos/drive/file_system/create_file_operation.cc b/chrome/browser/chromeos/drive/file_system/create_file_operation.cc
index 36ac498d808a3e2ebed73d3b0435280a786f95ec..44110195f8516588ef814f137d356179db2bebb5 100644
--- a/chrome/browser/chromeos/drive/file_system/create_file_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/create_file_operation.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "base/file_util.h"
#include "chrome/browser/chromeos/drive/drive.pb.h"
#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/operation_observer.h"
@@ -94,14 +95,17 @@ FileError UpdateLocalStateForCreateFile(
// Populate the |file_path| which will be used to notify the observer.
*file_path = metadata->GetFilePath(entry.resource_id());
- // Also store the entry to the cache. Here, failure is not a fatal error,
- // so ignore the returned code.
- FileError cache_store_error = cache->Store(
- entry.resource_id(),
- entry.file_specific_info().file_md5(),
- base::FilePath(util::kSymLinkToDevNull),
- internal::FileCache::FILE_OPERATION_COPY);
-
+ // Also store an empty file to the cache.
+ // Here, failure is not a fatal error, so ignore the returned code.
+ FileError cache_store_error = FILE_ERROR_FAILED;
+ base::FilePath empty_file;
+ if (file_util::CreateTemporaryFile(&empty_file)) {
+ cache_store_error = cache->Store(
+ entry.resource_id(),
+ entry.file_specific_info().file_md5(),
+ empty_file,
+ internal::FileCache::FILE_OPERATION_MOVE);
+ }
DLOG_IF(WARNING, cache_store_error != FILE_ERROR_OK)
<< "Failed to store a cache file: "
<< FileErrorToString(cache_store_error)
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_system_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698