| OLD | NEW |
| 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 "chrome/browser/nacl_host/nacl_browser.h" | 5 #include "chrome/browser/nacl_host/nacl_browser.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 void WriteCache(const base::FilePath& filename, const Pickle* pickle) { | 94 void WriteCache(const base::FilePath& filename, const Pickle* pickle) { |
| 95 file_util::WriteFile(filename, static_cast<const char*>(pickle->data()), | 95 file_util::WriteFile(filename, static_cast<const char*>(pickle->data()), |
| 96 pickle->size()); | 96 pickle->size()); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void RemoveCache(const base::FilePath& filename, | 99 void RemoveCache(const base::FilePath& filename, |
| 100 const base::Closure& callback) { | 100 const base::Closure& callback) { |
| 101 base::Delete(filename, false); | 101 base::DeleteFile(filename, false); |
| 102 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, | 102 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, |
| 103 callback); | 103 callback); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void LogCacheQuery(ValidationCacheStatus status) { | 106 void LogCacheQuery(ValidationCacheStatus status) { |
| 107 UMA_HISTOGRAM_ENUMERATION("NaCl.ValidationCache.Query", status, CACHE_MAX); | 107 UMA_HISTOGRAM_ENUMERATION("NaCl.ValidationCache.Query", status, CACHE_MAX); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void LogCacheSet(ValidationCacheStatus status) { | 110 void LogCacheSet(ValidationCacheStatus status) { |
| 111 // Bucket zero is reserved for future use. | 111 // Bucket zero is reserved for future use. |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 // because it can degrade the responsiveness of the browser. | 569 // because it can degrade the responsiveness of the browser. |
| 570 // The task is sequenced so that multiple writes happen in order. | 570 // The task is sequenced so that multiple writes happen in order. |
| 571 content::BrowserThread::PostBlockingPoolSequencedTask( | 571 content::BrowserThread::PostBlockingPoolSequencedTask( |
| 572 kValidationCacheSequenceName, | 572 kValidationCacheSequenceName, |
| 573 FROM_HERE, | 573 FROM_HERE, |
| 574 base::Bind(WriteCache, validation_cache_file_path_, | 574 base::Bind(WriteCache, validation_cache_file_path_, |
| 575 base::Owned(pickle))); | 575 base::Owned(pickle))); |
| 576 } | 576 } |
| 577 validation_cache_is_modified_ = false; | 577 validation_cache_is_modified_ = false; |
| 578 } | 578 } |
| OLD | NEW |