OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/nacl/browser/pnacl_translation_cache.h" | 5 #include "components/nacl/browser/pnacl_translation_cache.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 // Construction and cache backend initialization | 331 // Construction and cache backend initialization |
332 PnaclTranslationCache::PnaclTranslationCache() : in_memory_(false) {} | 332 PnaclTranslationCache::PnaclTranslationCache() : in_memory_(false) {} |
333 | 333 |
334 PnaclTranslationCache::~PnaclTranslationCache() {} | 334 PnaclTranslationCache::~PnaclTranslationCache() {} |
335 | 335 |
336 int PnaclTranslationCache::Init(net::CacheType cache_type, | 336 int PnaclTranslationCache::Init(net::CacheType cache_type, |
337 const base::FilePath& cache_dir, | 337 const base::FilePath& cache_dir, |
338 int cache_size, | 338 int cache_size, |
339 const CompletionCallback& callback) { | 339 const CompletionCallback& callback) { |
340 int rv = disk_cache::CreateCacheBackend( | 340 int rv = disk_cache::CreateCacheBackend( |
341 cache_type, | 341 cache_type, net::CACHE_BACKEND_DEFAULT, cache_dir, cache_size, |
342 net::CACHE_BACKEND_DEFAULT, | |
343 cache_dir, | |
344 cache_size, | |
345 true /* force_initialize */, | 342 true /* force_initialize */, |
346 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE).get(), | 343 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE).get(), |
347 NULL, /* dummy net log */ | 344 NULL, /* dummy net log */ |
348 &disk_cache_, | 345 &disk_cache_, |
349 base::Bind(&PnaclTranslationCache::OnCreateBackendComplete, AsWeakPtr())); | 346 base::Bind(&PnaclTranslationCache::OnCreateBackendComplete, AsWeakPtr())); |
350 if (rv == net::ERR_IO_PENDING) { | 347 if (rv == net::ERR_IO_PENDING) { |
351 init_callback_ = callback; | 348 init_callback_ = callback; |
352 } | 349 } |
353 return rv; | 350 return rv; |
354 } | 351 } |
355 | 352 |
356 void PnaclTranslationCache::OnCreateBackendComplete(int rv) { | 353 void PnaclTranslationCache::OnCreateBackendComplete(int rv) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 } | 438 } |
442 | 439 |
443 int PnaclTranslationCache::DoomEntriesBetween( | 440 int PnaclTranslationCache::DoomEntriesBetween( |
444 base::Time initial, | 441 base::Time initial, |
445 base::Time end, | 442 base::Time end, |
446 const CompletionCallback& callback) { | 443 const CompletionCallback& callback) { |
447 return disk_cache_->DoomEntriesBetween(initial, end, callback); | 444 return disk_cache_->DoomEntriesBetween(initial, end, callback); |
448 } | 445 } |
449 | 446 |
450 } // namespace pnacl | 447 } // namespace pnacl |
OLD | NEW |