diff options
author | dschuff@chromium.org <dschuff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-09 03:59:49 +0000 |
---|---|---|
committer | dschuff@chromium.org <dschuff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-09 03:59:49 +0000 |
commit | f6566c94894a39495976e9047c8100022f528e3d (patch) | |
tree | 64df78f614ae46919b646e7955a1a47ceaf04365 | |
parent | 1ac7a58fa16d5a3e6df1c49818d0e2ca1762e481 (diff) | |
download | chromium_src-f6566c94894a39495976e9047c8100022f528e3d.zip chromium_src-f6566c94894a39495976e9047c8100022f528e3d.tar.gz chromium_src-f6566c94894a39495976e9047c8100022f528e3d.tar.bz2 |
Enable new PNaCl translation cache by default
This flips the env variable to disable rather than enable the new cache
and flips the extra minimal testing to test the old path.
R=jvoung@chromium.org, ncbray@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3372
Review URL: https://codereview.chromium.org/22273009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216559 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/nacl_host/pnacl_translation_cache.cc | 5 | ||||
-rw-r--r-- | chrome/test/nacl/nacl_browsertest.cc | 4 | ||||
-rw-r--r-- | chrome/test/nacl/nacl_browsertest_util.cc | 4 | ||||
-rw-r--r-- | chrome/test/nacl/nacl_browsertest_util.h | 8 | ||||
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc | 26 | ||||
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h | 3 |
6 files changed, 28 insertions, 22 deletions
diff --git a/chrome/browser/nacl_host/pnacl_translation_cache.cc b/chrome/browser/nacl_host/pnacl_translation_cache.cc index 22ff22d..8d7fcda 100644 --- a/chrome/browser/nacl_host/pnacl_translation_cache.cc +++ b/chrome/browser/nacl_host/pnacl_translation_cache.cc @@ -26,9 +26,8 @@ void CloseDiskCacheEntry(disk_cache::Entry* entry) { entry->Close(); } } // namespace namespace pnacl { -// These are in pnacl namespace instead of static so they can be used +// This is in pnacl namespace instead of static so they can be used // by the unit test. -const int kMaxDiskCacheSize = 1000 * 1024 * 1024; const int kMaxMemCacheSize = 100 * 1024 * 1024; ////////////////////////////////////////////////////////////////////// @@ -383,7 +382,7 @@ int PnaclTranslationCache::InitCache(const base::FilePath& cache_directory, if (in_memory_) { rv = InitWithMemBackend(kMaxMemCacheSize, callback); } else { - rv = InitWithDiskBackend(cache_directory, kMaxDiskCacheSize, callback); + rv = InitWithDiskBackend(cache_directory, 0, callback); } return rv; diff --git a/chrome/test/nacl/nacl_browsertest.cc b/chrome/test/nacl/nacl_browsertest.cc index e24b910..356d183 100644 --- a/chrome/test/nacl/nacl_browsertest.cc +++ b/chrome/test/nacl/nacl_browsertest.cc @@ -52,12 +52,12 @@ NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_SimpleLoad, { RunLoadTest(FILE_PATH_LITERAL("nacl_load_test.html")); }) -IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnaclWithNewCache, +IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnaclWithOldCache, MAYBE_PNACL(SimpleLoad)) { RunLoadTest(FILE_PATH_LITERAL("nacl_load_test.html")); } -IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnaclWithNewCache, +IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnaclWithOldCache, MAYBE_PNACL(PnaclErrorHandling)) { RunNaClIntegrationTest(FILE_PATH_LITERAL("pnacl_error_handling.html")); } diff --git a/chrome/test/nacl/nacl_browsertest_util.cc b/chrome/test/nacl/nacl_browsertest_util.cc index 266a5d7..3cd7e35 100644 --- a/chrome/test/nacl/nacl_browsertest_util.cc +++ b/chrome/test/nacl/nacl_browsertest_util.cc @@ -320,9 +320,9 @@ void NaClBrowserTestPnaclDisabled::SetUpCommandLine(CommandLine* command_line) { command_line->AppendSwitch(switches::kDisablePnacl); } -NaClBrowserTestPnaclWithNewCache::NaClBrowserTestPnaclWithNewCache() { +NaClBrowserTestPnaclWithOldCache::NaClBrowserTestPnaclWithOldCache() { scoped_ptr<base::Environment> env(base::Environment::Create()); - env->SetVar("PNACL_USE_NEW_CACHE", "true"); + env->SetVar("PNACL_USE_OLD_CACHE", "true"); } base::FilePath::StringType NaClBrowserTestStatic::Variant() { diff --git a/chrome/test/nacl/nacl_browsertest_util.h b/chrome/test/nacl/nacl_browsertest_util.h index ba58e93..5400acc 100644 --- a/chrome/test/nacl/nacl_browsertest_util.h +++ b/chrome/test/nacl/nacl_browsertest_util.h @@ -136,11 +136,11 @@ class NaClBrowserTestPnaclDisabled : public NaClBrowserTestBase { virtual bool IsPnaclDisabled() OVERRIDE; }; -// Temporary class for running tests with the new cache enabled. Once all the -// pieces land, this will go away and the new cache will be on by default. -class NaClBrowserTestPnaclWithNewCache : public NaClBrowserTestPnacl { +// Temporary class for running tests with the old cache enabled. Once all the +// pieces are stable and the old code is gone, this will go away. +class NaClBrowserTestPnaclWithOldCache : public NaClBrowserTestPnacl { public: - NaClBrowserTestPnaclWithNewCache(); + NaClBrowserTestPnaclWithOldCache(); }; // A NaCl browser test only using static files. diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc index c7671dc..4362ec4 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc @@ -263,7 +263,7 @@ PnaclCoordinator::PnaclCoordinator( manifest_(new PnaclManifest()), pexe_url_(pexe_url), pnacl_options_(pnacl_options), - use_new_cache_(false), + use_new_cache_(true), is_cache_hit_(PP_FALSE), nexe_handle_(PP_kInvalidFileHandle), error_already_reported_(false), @@ -275,9 +275,9 @@ PnaclCoordinator::PnaclCoordinator( PLUGIN_PRINTF(("PnaclCoordinator::PnaclCoordinator (this=%p, plugin=%p)\n", static_cast<void*>(this), static_cast<void*>(plugin))); callback_factory_.Initialize(this); - if (getenv("PNACL_USE_NEW_CACHE")) { - PLUGIN_PRINTF(("PnaclCoordinator using new translation cache\n")); - use_new_cache_ = true; + if (getenv("PNACL_USE_OLD_CACHE")) { + PLUGIN_PRINTF(("PnaclCoordinator using old translation cache\n")); + use_new_cache_ = false; } } @@ -397,6 +397,15 @@ void PnaclCoordinator::TranslateFinished(int32_t pp_error) { // care of caching. plugin_->nacl_interface()->ReportTranslationFinished( plugin_->pp_instance(), PP_TRUE); + + // These can maybe move up with the rest of the UMA stats when we remove + // the old cache code + int64_t total_time = NaClGetTimeOfDayMicroseconds() - pnacl_init_time_; + HistogramTime("NaCl.Perf.PNaClLoadTime.TotalUncachedTime", + total_time / NACL_MICROS_PER_MILLI); + HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.TotalUncachedKBPerSec", + pexe_size_ / 1024.0, + total_time / 1000000.0); NexeReadDidOpen(PP_OK); return; } @@ -866,8 +875,9 @@ void PnaclCoordinator::BitcodeStreamDidOpen(int32_t pp_error) { plugin_->nacl_interface()->GetNexeFd( plugin_->pp_instance(), streaming_downloader_->url().c_str(), - // TODO(dschuff): use the right abi version here. - 0, + // TODO(dschuff): Get this value from the pnacl json file after it + // rolls in from NaCl. + 1, pnacl_options_.opt_level(), parser.GetHeader("last-modified").c_str(), parser.GetHeader("etag").c_str(), @@ -912,11 +922,11 @@ void PnaclCoordinator::NexeFdDidOpen(int32_t pp_error) { "PnaclCoordinator: Got bad temp file handle from GetNexeFd")); return; } + HistogramEnumerateTranslationCache(is_cache_hit_); + if (is_cache_hit_ == PP_TRUE) { // Cache hit -- no need to stream the rest of the file. streaming_downloader_.reset(NULL); - // TODO(dschuff): update UMA stats for hit/miss once there could actually - // be hits/misses. // Open it for reading as the cached nexe file. pp::CompletionCallback cb = callback_factory_.NewCallback(&PnaclCoordinator::NexeReadDidOpen); diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h index 06ff7c7..42f1207 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h +++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h @@ -79,9 +79,6 @@ class TempFile; // TRANSLATION_COMPLETE // Complete when TranslateFinished is invoked. // -// If cache is enabled: -// TODO: notify browser of finished translation (and re-open read-only?) -// // OPEN_NEXE_FOR_SEL_LDR // Complete when NexeReadDidOpen is invoked. class PnaclCoordinator: public CallbackSource<FileStreamData> { |