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/nacl_browser.h" | 5 #include "components/nacl/browser/nacl_browser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_proxy.h" | 10 #include "base/files/file_proxy.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/pickle.h" | 15 #include "base/pickle.h" |
16 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "base/win/windows_version.h" | |
21 #include "build/build_config.h" | 20 #include "build/build_config.h" |
22 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
23 #include "url/gurl.h" | 22 #include "url/gurl.h" |
24 | 23 |
| 24 #if defined(OS_WIN) |
| 25 #include "base/win/windows_version.h" |
| 26 #endif |
| 27 |
25 namespace { | 28 namespace { |
26 | 29 |
27 // An arbitrary delay to coalesce multiple writes to the cache. | 30 // An arbitrary delay to coalesce multiple writes to the cache. |
28 const int kValidationCacheCoalescingTimeMS = 6000; | 31 const int kValidationCacheCoalescingTimeMS = 6000; |
29 const char kValidationCacheSequenceName[] = "NaClValidationCache"; | 32 const char kValidationCacheSequenceName[] = "NaClValidationCache"; |
30 const base::FilePath::CharType kValidationCacheFileName[] = | 33 const base::FilePath::CharType kValidationCacheFileName[] = |
31 FILE_PATH_LITERAL("nacl_validation_cache.bin"); | 34 FILE_PATH_LITERAL("nacl_validation_cache.bin"); |
32 | 35 |
33 const bool kValidationCacheEnabledByDefault = true; | 36 const bool kValidationCacheEnabledByDefault = true; |
34 | 37 |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 bool NaClBrowser::IsThrottled() { | 569 bool NaClBrowser::IsThrottled() { |
567 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 570 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
568 if (crash_times_.size() != kMaxCrashesPerInterval) { | 571 if (crash_times_.size() != kMaxCrashesPerInterval) { |
569 return false; | 572 return false; |
570 } | 573 } |
571 base::TimeDelta delta = base::Time::Now() - crash_times_.front(); | 574 base::TimeDelta delta = base::Time::Now() - crash_times_.front(); |
572 return delta.InSeconds() <= kCrashesIntervalInSeconds; | 575 return delta.InSeconds() <= kCrashesIntervalInSeconds; |
573 } | 576 } |
574 | 577 |
575 } // namespace nacl | 578 } // namespace nacl |
OLD | NEW |