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

Side by Side Diff: storage/browser/fileapi/file_system_usage_cache.cc

Issue 818833004: Remove deprecated methods from Pickle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 12 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
« no previous file with comments | « skia/ext/skia_utils_base.cc ('k') | storage/browser/fileapi/sandbox_directory_database.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "storage/browser/fileapi/file_system_usage_cache.h" 5 #include "storage/browser/fileapi/file_system_usage_cache.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 char buffer[kUsageFileSize]; 178 char buffer[kUsageFileSize];
179 const char *header; 179 const char *header;
180 if (usage_file_path.empty() || 180 if (usage_file_path.empty() ||
181 !ReadBytes(usage_file_path, buffer, kUsageFileSize)) 181 !ReadBytes(usage_file_path, buffer, kUsageFileSize))
182 return false; 182 return false;
183 Pickle read_pickle(buffer, kUsageFileSize); 183 Pickle read_pickle(buffer, kUsageFileSize);
184 PickleIterator iter(read_pickle); 184 PickleIterator iter(read_pickle);
185 uint32 dirty = 0; 185 uint32 dirty = 0;
186 int64 usage = 0; 186 int64 usage = 0;
187 187
188 if (!read_pickle.ReadBytes(&iter, &header, kUsageFileHeaderSize) || 188 if (!iter.ReadBytes(&header, kUsageFileHeaderSize) ||
189 !read_pickle.ReadBool(&iter, is_valid) || 189 !iter.ReadBool(is_valid) ||
190 !read_pickle.ReadUInt32(&iter, &dirty) || 190 !iter.ReadUInt32(&dirty) ||
191 !read_pickle.ReadInt64(&iter, &usage)) 191 !iter.ReadInt64(&usage))
192 return false; 192 return false;
193 193
194 if (header[0] != kUsageFileHeader[0] || 194 if (header[0] != kUsageFileHeader[0] ||
195 header[1] != kUsageFileHeader[1] || 195 header[1] != kUsageFileHeader[1] ||
196 header[2] != kUsageFileHeader[2] || 196 header[2] != kUsageFileHeader[2] ||
197 header[3] != kUsageFileHeader[3]) 197 header[3] != kUsageFileHeader[3])
198 return false; 198 return false;
199 199
200 *dirty_out = dirty; 200 *dirty_out = dirty;
201 *usage_out = usage; 201 *usage_out = usage;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return !task_runner_.get() || task_runner_->RunsTasksOnCurrentThread(); 298 return !task_runner_.get() || task_runner_->RunsTasksOnCurrentThread();
299 } 299 }
300 300
301 bool FileSystemUsageCache::HasCacheFileHandle(const base::FilePath& file_path) { 301 bool FileSystemUsageCache::HasCacheFileHandle(const base::FilePath& file_path) {
302 DCHECK(CalledOnValidThread()); 302 DCHECK(CalledOnValidThread());
303 DCHECK_LE(cache_files_.size(), kMaxHandleCacheSize); 303 DCHECK_LE(cache_files_.size(), kMaxHandleCacheSize);
304 return ContainsKey(cache_files_, file_path); 304 return ContainsKey(cache_files_, file_path);
305 } 305 }
306 306
307 } // namespace storage 307 } // namespace storage
OLDNEW
« no previous file with comments | « skia/ext/skia_utils_base.cc ('k') | storage/browser/fileapi/sandbox_directory_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698