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

Side by Side Diff: net/disk_cache/simple/simple_index_file.cc

Issue 18383003: Move DeleteAfterReboot and Move to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/cache_util_posix.cc ('k') | third_party/leveldatabase/env_chromium.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/disk_cache/simple/simple_index_file.h" 5 #include "net/disk_cache/simple/simple_index_file.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 reinterpret_cast<const char*>(pickle->data()), 47 reinterpret_cast<const char*>(pickle->data()),
48 pickle->size()); 48 pickle->size());
49 DCHECK_EQ(bytes_written, implicit_cast<int>(pickle->size())); 49 DCHECK_EQ(bytes_written, implicit_cast<int>(pickle->size()));
50 if (bytes_written != static_cast<int>(pickle->size())) { 50 if (bytes_written != static_cast<int>(pickle->size())) {
51 // TODO(felipeg): Add better error handling. 51 // TODO(felipeg): Add better error handling.
52 LOG(ERROR) << "Could not write Simple Cache index to temporary file: " 52 LOG(ERROR) << "Could not write Simple Cache index to temporary file: "
53 << temp_filename.value(); 53 << temp_filename.value();
54 base::Delete(temp_filename, /* recursive = */ false); 54 base::Delete(temp_filename, /* recursive = */ false);
55 } else { 55 } else {
56 // Swap temp and index_file. 56 // Swap temp and index_file.
57 bool result = file_util::ReplaceFile(temp_filename, index_filename); 57 bool result = base::ReplaceFile(temp_filename, index_filename, NULL);
58 DCHECK(result); 58 DCHECK(result);
59 } 59 }
60 if (app_on_background) { 60 if (app_on_background) {
61 UMA_HISTOGRAM_TIMES("SimpleCache.IndexWriteToDiskTime.Background", 61 UMA_HISTOGRAM_TIMES("SimpleCache.IndexWriteToDiskTime.Background",
62 (base::TimeTicks::Now() - start_time)); 62 (base::TimeTicks::Now() - start_time));
63 } else { 63 } else {
64 UMA_HISTOGRAM_TIMES("SimpleCache.IndexWriteToDiskTime.Foreground", 64 UMA_HISTOGRAM_TIMES("SimpleCache.IndexWriteToDiskTime.Foreground",
65 (base::TimeTicks::Now() - start_time)); 65 (base::TimeTicks::Now() - start_time));
66 } 66 }
67 } 67 }
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 index_file_entries.get()); 380 index_file_entries.get());
381 } else { 381 } else {
382 // Summing up the total size of the entry through all the *_[0-2] files 382 // Summing up the total size of the entry through all the *_[0-2] files
383 it->second.SetEntrySize(it->second.GetEntrySize() + file_size); 383 it->second.SetEntrySize(it->second.GetEntrySize() + file_size);
384 } 384 }
385 } 385 }
386 return index_file_entries.Pass(); 386 return index_file_entries.Pass();
387 } 387 }
388 388
389 } // namespace disk_cache 389 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/cache_util_posix.cc ('k') | third_party/leveldatabase/env_chromium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698