Index: chrome/browser/component_updater/pnacl/pnacl_component_installer.cc |
diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc |
index f9cf2dad38a50780cf32dcc6528f733f3084f56f..d6ab1a0b44046a8311c17b4642b30245f554da7f 100644 |
--- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc |
+++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc |
@@ -25,6 +25,11 @@ using content::BrowserThread; |
namespace { |
+// If PNaCl isn't installed yet, but a user is running chrome with |
+// --enable-pnacl, this is the amount of time to wait before starting |
+// a background install. |
+const int kInitialDelaySeconds = 10; |
+ |
// One of the Pnacl component files, for checking that expected files exist. |
// TODO(jvoung): perhaps replace this with a list of the expected files in the |
// manifest.json. Use that to check that everything is unpacked. |
@@ -127,10 +132,6 @@ void SetPnaclHash(CrxComponent* component) { |
// If we don't have Pnacl installed, this is the version we claim. |
-// TODO(jvoung): Is there a way to trick the configurator to ping the server |
-// earlier if there are components that are not yet installed (version 0.0.0.0), |
-// So that they will be available ASAP? Be careful not to hurt startup speed. |
-// Make kNullVersion part of ComponentUpdater in that case, to avoid skew? |
const char kNullVersion[] = "0.0.0.0"; |
// Pnacl components have the version encoded in the path itself: |
@@ -315,6 +316,13 @@ bool PnaclComponentInstaller::Install(base::DictionaryValue* manifest, |
namespace { |
+void DoCheckForUpdate(ComponentUpdateService* cus, |
+ const CrxComponent& pnacl) { |
+ if (cus->CheckForUpdateSoon(pnacl) != ComponentUpdateService::kOk) { |
+ LOG(WARNING) << "Pnacl check for update failed."; |
+ } |
+} |
+ |
// Finally, do the registration with the right version number. |
void FinishPnaclUpdateRegistration(ComponentUpdateService* cus, |
const Version& current_version) { |
@@ -329,6 +337,17 @@ void FinishPnaclUpdateRegistration(ComponentUpdateService* cus, |
if (cus->RegisterComponent(pnacl) != ComponentUpdateService::kOk) { |
NOTREACHED() << "Pnacl component registration failed."; |
} |
+ |
+ // If PNaCl is not yet installed but it is requested by --enable-pnacl, |
+ // we want it to be available "soon", so kick off an update check |
cpu_(ooo_6.6-7.5)
2013/02/12 23:34:26
wait, where is the command line check?
jvoung (off chromium)
2013/02/12 23:38:37
In chrome/browser/chrome_browser_main.cc, PNaCl is
|
+ // earlier than usual. |
+ Version null_version(kNullVersion); |
+ if (current_version.Equals(null_version)) { |
+ BrowserThread::PostDelayedTask( |
+ BrowserThread::UI, FROM_HERE, |
+ base::Bind(DoCheckForUpdate, cus, pnacl), |
+ base::TimeDelta::FromSeconds(kInitialDelaySeconds)); |
+ } |
} |
// Check if there is an existing version on disk first to know when |