| 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/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| 11 #include "base/win/windows_version.h" | 11 #include "base/win/windows_version.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
| 14 #include "chrome/common/chrome_paths_internal.h" | 14 #include "chrome/common/chrome_paths_internal.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // An arbitrary delay to coalesce multiple writes to the cache. | 19 // An arbitrary delay to coalesce multiple writes to the cache. |
| 20 const int kValidationCacheCoalescingTimeMS = 6000; | 20 const int kValidationCacheCoalescingTimeMS = 6000; |
| 21 const char kValidationCacheSequenceName[] = "NaClValidationCache"; | 21 const char kValidationCacheSequenceName[] = "NaClValidationCache"; |
| 22 const FilePath::CharType kValidationCacheFileName[] = | 22 const FilePath::CharType kValidationCacheFileName[] = |
| 23 FILE_PATH_LITERAL("nacl_validation_cache.bin"); | 23 FILE_PATH_LITERAL("nacl_validation_cache.bin"); |
| 24 | 24 |
| 25 #if defined(OS_CHROMEOS) | |
| 26 // TODO(ncbray) enable on ChromeOS. | |
| 27 // http://code.google.com/p/chromium/issues/detail?id=131218 | |
| 28 const bool kValidationCacheEnabledByDefault = false; | |
| 29 #else | |
| 30 const bool kValidationCacheEnabledByDefault = true; | 25 const bool kValidationCacheEnabledByDefault = true; |
| 31 #endif | |
| 32 | |
| 33 | 26 |
| 34 enum ValidationCacheStatus { | 27 enum ValidationCacheStatus { |
| 35 CACHE_MISS = 0, | 28 CACHE_MISS = 0, |
| 36 CACHE_HIT, | 29 CACHE_HIT, |
| 37 CACHE_MAX | 30 CACHE_MAX |
| 38 }; | 31 }; |
| 39 | 32 |
| 40 // Determine the name of the IRT file based on the architecture. | 33 // Determine the name of the IRT file based on the architecture. |
| 41 #define NACL_IRT_FILE_NAME(arch_string) \ | 34 #define NACL_IRT_FILE_NAME(arch_string) \ |
| 42 (FILE_PATH_LITERAL("nacl_irt_") \ | 35 (FILE_PATH_LITERAL("nacl_irt_") \ |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 // because it can degrade the responsiveness of the browser. | 388 // because it can degrade the responsiveness of the browser. |
| 396 // The task is sequenced so that multiple writes happen in order. | 389 // The task is sequenced so that multiple writes happen in order. |
| 397 content::BrowserThread::PostBlockingPoolSequencedTask( | 390 content::BrowserThread::PostBlockingPoolSequencedTask( |
| 398 kValidationCacheSequenceName, | 391 kValidationCacheSequenceName, |
| 399 FROM_HERE, | 392 FROM_HERE, |
| 400 base::Bind(WriteCache, validation_cache_file_path_, | 393 base::Bind(WriteCache, validation_cache_file_path_, |
| 401 base::Owned(pickle))); | 394 base::Owned(pickle))); |
| 402 } | 395 } |
| 403 validation_cache_is_modified_ = false; | 396 validation_cache_is_modified_ = false; |
| 404 } | 397 } |
| OLD | NEW |