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

Side by Side Diff: net/disk_cache/v3/backend_worker.cc

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
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 "net/disk_cache/backend_impl.h" 5 #include "net/disk_cache/backend_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 header.create_time = Time::Now().ToInternalValue(); 325 header.create_time = Time::Now().ToInternalValue();
326 326
327 if (!file->Write(&header, sizeof(header), 0)) 327 if (!file->Write(&header, sizeof(header), 0))
328 return false; 328 return false;
329 329
330 return file->SetLength(GetIndexSize(header.table_len)); 330 return file->SetLength(GetIndexSize(header.table_len));
331 } 331 }
332 332
333 bool BackendImpl::InitBackingStore(bool* file_created) { 333 bool BackendImpl::InitBackingStore(bool* file_created) {
334 if (!file_util::CreateDirectory(path_)) 334 if (!base::CreateDirectory(path_))
335 return false; 335 return false;
336 336
337 base::FilePath index_name = path_.AppendASCII(kIndexName); 337 base::FilePath index_name = path_.AppendASCII(kIndexName);
338 338
339 int flags = base::PLATFORM_FILE_READ | 339 int flags = base::PLATFORM_FILE_READ |
340 base::PLATFORM_FILE_WRITE | 340 base::PLATFORM_FILE_WRITE |
341 base::PLATFORM_FILE_OPEN_ALWAYS | 341 base::PLATFORM_FILE_OPEN_ALWAYS |
342 base::PLATFORM_FILE_EXCLUSIVE_WRITE; 342 base::PLATFORM_FILE_EXCLUSIVE_WRITE;
343 scoped_refptr<disk_cache::File> file(new disk_cache::File( 343 scoped_refptr<disk_cache::File> file(new disk_cache::File(
344 base::CreatePlatformFile(index_name, flags, file_created, NULL))); 344 base::CreatePlatformFile(index_name, flags, file_created, NULL)));
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 return false; 476 return false;
477 477
478 if (!stats_.Init(data.get(), size, address)) 478 if (!stats_.Init(data.get(), size, address))
479 return false; 479 return false;
480 if (cache_type_ == net::DISK_CACHE && ShouldReportAgain()) 480 if (cache_type_ == net::DISK_CACHE && ShouldReportAgain())
481 stats_.InitSizeHistogram(); 481 stats_.InitSizeHistogram();
482 return true; 482 return true;
483 } 483 }
484 484
485 } // namespace disk_cache 485 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_index_file_unittest.cc ('k') | net/proxy/proxy_config_service_linux_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698