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

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

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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/simple/simple_index_file_unittest.cc ('k') | ppapi/proxy/file_io_resource.h » ('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_synchronous_entry.h" 5 #include "net/disk_cache/simple/simple_synchronous_entry.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <functional> 9 #include <functional>
10 #include <limits> 10 #include <limits>
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 SimpleEntryStat* out_entry_stat) { 761 SimpleEntryStat* out_entry_stat) {
762 for (int i = 0; i < kSimpleEntryFileCount; ++i) { 762 for (int i = 0; i < kSimpleEntryFileCount; ++i) {
763 File::Error error; 763 File::Error error;
764 if (!MaybeOpenFile(i, &error)) { 764 if (!MaybeOpenFile(i, &error)) {
765 // TODO(ttuttle,gavinp): Remove one each of these triplets of histograms. 765 // TODO(ttuttle,gavinp): Remove one each of these triplets of histograms.
766 // We can calculate the third as the sum or difference of the other two. 766 // We can calculate the third as the sum or difference of the other two.
767 RecordSyncOpenResult( 767 RecordSyncOpenResult(
768 cache_type_, OPEN_ENTRY_PLATFORM_FILE_ERROR, had_index); 768 cache_type_, OPEN_ENTRY_PLATFORM_FILE_ERROR, had_index);
769 SIMPLE_CACHE_UMA(ENUMERATION, 769 SIMPLE_CACHE_UMA(ENUMERATION,
770 "SyncOpenPlatformFileError", cache_type_, 770 "SyncOpenPlatformFileError", cache_type_,
771 -error, -base::PLATFORM_FILE_ERROR_MAX); 771 -error, -base::File::FILE_ERROR_MAX);
772 if (had_index) { 772 if (had_index) {
773 SIMPLE_CACHE_UMA(ENUMERATION, 773 SIMPLE_CACHE_UMA(ENUMERATION,
774 "SyncOpenPlatformFileError_WithIndex", cache_type_, 774 "SyncOpenPlatformFileError_WithIndex", cache_type_,
775 -error, -base::PLATFORM_FILE_ERROR_MAX); 775 -error, -base::File::FILE_ERROR_MAX);
776 } else { 776 } else {
777 SIMPLE_CACHE_UMA(ENUMERATION, 777 SIMPLE_CACHE_UMA(ENUMERATION,
778 "SyncOpenPlatformFileError_WithoutIndex", 778 "SyncOpenPlatformFileError_WithoutIndex",
779 cache_type_, 779 cache_type_,
780 -error, -base::PLATFORM_FILE_ERROR_MAX); 780 -error, -base::File::FILE_ERROR_MAX);
781 } 781 }
782 while (--i >= 0) 782 while (--i >= 0)
783 CloseFile(i); 783 CloseFile(i);
784 return false; 784 return false;
785 } 785 }
786 } 786 }
787 787
788 have_open_files_ = true; 788 have_open_files_ = true;
789 789
790 base::TimeDelta entry_age = base::Time::Now() - base::Time::UnixEpoch(); 790 base::TimeDelta entry_age = base::Time::Now() - base::Time::UnixEpoch();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 bool had_index, 840 bool had_index,
841 SimpleEntryStat* out_entry_stat) { 841 SimpleEntryStat* out_entry_stat) {
842 for (int i = 0; i < kSimpleEntryFileCount; ++i) { 842 for (int i = 0; i < kSimpleEntryFileCount; ++i) {
843 File::Error error; 843 File::Error error;
844 if (!MaybeCreateFile(i, FILE_NOT_REQUIRED, &error)) { 844 if (!MaybeCreateFile(i, FILE_NOT_REQUIRED, &error)) {
845 // TODO(ttuttle,gavinp): Remove one each of these triplets of histograms. 845 // TODO(ttuttle,gavinp): Remove one each of these triplets of histograms.
846 // We can calculate the third as the sum or difference of the other two. 846 // We can calculate the third as the sum or difference of the other two.
847 RecordSyncCreateResult(CREATE_ENTRY_PLATFORM_FILE_ERROR, had_index); 847 RecordSyncCreateResult(CREATE_ENTRY_PLATFORM_FILE_ERROR, had_index);
848 SIMPLE_CACHE_UMA(ENUMERATION, 848 SIMPLE_CACHE_UMA(ENUMERATION,
849 "SyncCreatePlatformFileError", cache_type_, 849 "SyncCreatePlatformFileError", cache_type_,
850 -error, -base::PLATFORM_FILE_ERROR_MAX); 850 -error, -base::File::FILE_ERROR_MAX);
851 if (had_index) { 851 if (had_index) {
852 SIMPLE_CACHE_UMA(ENUMERATION, 852 SIMPLE_CACHE_UMA(ENUMERATION,
853 "SyncCreatePlatformFileError_WithIndex", cache_type_, 853 "SyncCreatePlatformFileError_WithIndex", cache_type_,
854 -error, -base::PLATFORM_FILE_ERROR_MAX); 854 -error, -base::File::FILE_ERROR_MAX);
855 } else { 855 } else {
856 SIMPLE_CACHE_UMA(ENUMERATION, 856 SIMPLE_CACHE_UMA(ENUMERATION,
857 "SyncCreatePlatformFileError_WithoutIndex", 857 "SyncCreatePlatformFileError_WithoutIndex",
858 cache_type_, 858 cache_type_,
859 -error, -base::PLATFORM_FILE_ERROR_MAX); 859 -error, -base::File::FILE_ERROR_MAX);
860 } 860 }
861 while (--i >= 0) 861 while (--i >= 0)
862 CloseFile(i); 862 CloseFile(i);
863 return false; 863 return false;
864 } 864 }
865 } 865 }
866 866
867 have_open_files_ = true; 867 have_open_files_ = true;
868 868
869 base::Time creation_time = Time::Now(); 869 base::Time creation_time = Time::Now();
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 range.offset = offset; 1425 range.offset = offset;
1426 range.length = len; 1426 range.length = len;
1427 range.data_crc32 = data_crc32; 1427 range.data_crc32 = data_crc32;
1428 range.file_offset = data_file_offset; 1428 range.file_offset = data_file_offset;
1429 sparse_ranges_.insert(std::make_pair(offset, range)); 1429 sparse_ranges_.insert(std::make_pair(offset, range));
1430 1430
1431 return true; 1431 return true;
1432 } 1432 }
1433 1433
1434 } // namespace disk_cache 1434 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_index_file_unittest.cc ('k') | ppapi/proxy/file_io_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698