summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/component_updater/component_updater_service.h3
-rw-r--r--chrome/browser/component_updater/pnacl/pnacl_component_installer.cc59
-rw-r--r--chrome/browser/component_updater/pnacl/pnacl_component_installer.h21
-rw-r--r--chrome/browser/component_updater/pnacl/pnacl_updater_observer.cc49
-rw-r--r--chrome/browser/component_updater/pnacl/pnacl_updater_observer.h31
-rw-r--r--chrome/browser/nacl_host/nacl_browser_delegate_impl.cc10
-rw-r--r--chrome/browser/nacl_host/nacl_browser_delegate_impl.h2
-rw-r--r--chrome/browser/nacl_host/nacl_file_host.cc44
-rw-r--r--chrome/browser/nacl_host/nacl_file_host.h17
-rw-r--r--chrome/browser/nacl_host/nacl_file_host_unittest.cc128
-rw-r--r--chrome/browser/nacl_host/nacl_host_message_filter.cc23
-rw-r--r--chrome/browser/nacl_host/nacl_host_message_filter.h7
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/renderer/pepper/pnacl_translation_resource_host.cc69
-rw-r--r--chrome/renderer/pepper/pnacl_translation_resource_host.h14
-rw-r--r--chrome/renderer/pepper/ppb_nacl_private_impl.cc14
-rw-r--r--components/nacl/common/nacl_browser_delegate.h7
-rw-r--r--components/nacl/common/nacl_host_messages.h11
-rw-r--r--components/nacl/common/pnacl_types.cc16
-rw-r--r--components/nacl/common/pnacl_types.h15
-rw-r--r--ppapi/api/private/ppb_nacl_private.idl8
-rw-r--r--ppapi/c/private/ppb_nacl_private.h9
-rw-r--r--ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc106
-rw-r--r--ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h3
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c6
25 files changed, 46 insertions, 628 deletions
diff --git a/chrome/browser/component_updater/component_updater_service.h b/chrome/browser/component_updater/component_updater_service.h
index 41ddfb3..ff05c14 100644
--- a/chrome/browser/component_updater/component_updater_service.h
+++ b/chrome/browser/component_updater/component_updater_service.h
@@ -201,10 +201,7 @@ class ComponentUpdateService {
virtual ~ComponentUpdateService() {}
- // TODO(waffles): Remove PNaCl as a friend once an alternative on-demand
- // trigger is available.
friend class ComponentsUI;
- friend class PnaclComponentInstaller;
friend class OnDemandTester;
private:
diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
index 2f8f426..a90c99d 100644
--- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
+++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
@@ -195,7 +195,6 @@ PnaclComponentInstaller::PnaclComponentInstaller()
#if defined(OS_CHROMEOS)
per_user_ = true;
#endif
- updater_observer_.reset(new PnaclUpdaterObserver(this));
}
PnaclComponentInstaller::~PnaclComponentInstaller() {
@@ -243,20 +242,17 @@ bool PnaclComponentInstaller::Install(const base::DictionaryValue& manifest,
ReadPnaclManifest(unpack_path));
if (pnacl_manifest == NULL) {
LOG(WARNING) << "Failed to read pnacl manifest.";
- NotifyInstallError();
return false;
}
Version version;
if (!CheckPnaclComponentManifest(manifest, *pnacl_manifest, &version)) {
LOG(WARNING) << "CheckPnaclComponentManifest failed, not installing.";
- NotifyInstallError();
return false;
}
// Don't install if the current version is actually newer.
if (current_version().CompareTo(version) > 0) {
- NotifyInstallError();
return false;
}
@@ -265,12 +261,10 @@ bool PnaclComponentInstaller::Install(const base::DictionaryValue& manifest,
version.GetString());
if (base::PathExists(path)) {
LOG(WARNING) << "Target path already exists, not installing.";
- NotifyInstallError();
return false;
}
if (!base::Move(unpack_path, path)) {
LOG(WARNING) << "Move failed, not installing.";
- NotifyInstallError();
return false;
}
@@ -278,7 +272,6 @@ bool PnaclComponentInstaller::Install(const base::DictionaryValue& manifest,
// - The path service.
// - Callbacks that requested an update.
set_current_version(version);
- NotifyInstallSuccess();
OverrideDirPnaclComponent(path);
return true;
}
@@ -297,44 +290,11 @@ bool PnaclComponentInstaller::GetInstalledFile(
return true;
}
-void PnaclComponentInstaller::NotifyInstallError() {
- if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&PnaclComponentInstaller::NotifyInstallError,
- // Unretained because installer lives until process shutdown.
- base::Unretained(this)));
- return;
- }
- if (!install_callback_.is_null()) {
- updater_observer_->StopObserving();
- install_callback_.Run(false);
- install_callback_.Reset();
- }
-}
-
-void PnaclComponentInstaller::NotifyInstallSuccess() {
- if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&PnaclComponentInstaller::NotifyInstallSuccess,
- // Unretained because installer lives until process shutdown.
- base::Unretained(this)));
- return;
- }
- if (!install_callback_.is_null()) {
- updater_observer_->StopObserving();
- install_callback_.Run(true);
- install_callback_.Reset();
- }
-}
-
CrxComponent PnaclComponentInstaller::GetCrxComponent() {
CrxComponent pnacl_component;
pnacl_component.version = current_version();
pnacl_component.name = "pnacl";
pnacl_component.installer = this;
- pnacl_component.observer = updater_observer_.get();
pnacl_component.fingerprint = current_fingerprint();
SetPnaclHash(&pnacl_component);
@@ -478,22 +438,3 @@ void PnaclComponentInstaller::ReRegisterPnacl() {
BrowserThread::UI, FROM_HERE,
base::Bind(&GetProfileInformation, this));
}
-
-void PnaclComponentInstaller::RequestFirstInstall(const InstallCallback& cb) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- // Only one request can happen at once.
- if (!install_callback_.is_null()) {
- cb.Run(false);
- return;
- }
- set_current_version(Version(kNullVersion));
- CrxComponent pnacl_component = GetCrxComponent();
- ComponentUpdateService::Status status = cus_->OnDemandUpdate(
- GetCrxComponentID(pnacl_component));
- if (status != ComponentUpdateService::kOk) {
- cb.Run(false);
- return;
- }
- install_callback_ = cb;
- updater_observer_->EnsureObserving();
-}
diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.h b/chrome/browser/component_updater/pnacl/pnacl_component_installer.h
index 0848883..0469a49 100644
--- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.h
+++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.h
@@ -14,7 +14,6 @@
#include "base/version.h"
#include "chrome/browser/component_updater/component_updater_service.h"
#include "chrome/browser/component_updater/pnacl/pnacl_profile_observer.h"
-#include "chrome/browser/component_updater/pnacl/pnacl_updater_observer.h"
class CommandLine;
@@ -75,22 +74,7 @@ class PnaclComponentInstaller : public ComponentInstaller {
ComponentUpdateService* cus() const { return cus_; }
- typedef base::Callback<void(bool)> InstallCallback;
-
- // Ask the component updater service to do a first-install for PNaCl.
- // The |installed| callback will be run with |true| on success,
- // or run with |false| on an error. The callback is called on the UI thread.
- void RequestFirstInstall(const InstallCallback& installed);
-
private:
- friend class PnaclUpdaterObserver;
-
- // Called when a RequestFirstInstall completed successfully.
- void NotifyInstallSuccess();
-
- // Called when a RequestFirstInstall will not happen, or an error occurred.
- void NotifyInstallError();
-
bool per_user_;
bool updates_disabled_;
scoped_ptr<PnaclProfileObserver> profile_observer_;
@@ -98,11 +82,6 @@ class PnaclComponentInstaller : public ComponentInstaller {
base::Version current_version_;
std::string current_fingerprint_;
ComponentUpdateService* cus_;
- // The one callback to call when there is a RequestFirstInstall.
- InstallCallback install_callback_;
- // Component updater service observer, to determine when an on-demand
- // install request failed.
- scoped_ptr<PnaclUpdaterObserver> updater_observer_;
DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller);
};
diff --git a/chrome/browser/component_updater/pnacl/pnacl_updater_observer.cc b/chrome/browser/component_updater/pnacl/pnacl_updater_observer.cc
deleted file mode 100644
index 6041b5d..0000000
--- a/chrome/browser/component_updater/pnacl/pnacl_updater_observer.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/component_updater/pnacl/pnacl_updater_observer.h"
-
-#include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
-#include "content/public/browser/browser_thread.h"
-
-using content::BrowserThread;
-
-PnaclUpdaterObserver::PnaclUpdaterObserver(PnaclComponentInstaller* pci)
- : must_observe_(false), pnacl_installer_(pci) {}
-
-PnaclUpdaterObserver::~PnaclUpdaterObserver() {}
-
-void PnaclUpdaterObserver::EnsureObserving() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- must_observe_ = true;
-}
-
-void PnaclUpdaterObserver::StopObserving() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- must_observe_ = false;
-}
-
-void PnaclUpdaterObserver::OnEvent(Events event, int extra) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (must_observe_) {
- switch (event) {
- default:
- break;
- case COMPONENT_UPDATE_READY:
- // If the component updater says there is an UPDATE_READY w/ source
- // being the PNaCl ID, then installation is handed off to the PNaCl
- // installer and we can stop observing. The installer will be the one
- // to run the callback w/ success or failure.
- must_observe_ = false;
- break;
- case COMPONENT_UPDATER_SLEEPING:
- // If the component updater sleeps before an UPDATE_READY for this
- // component, then requests for installs were likely skipped,
- // an error occurred, or there was no new update.
- must_observe_ = false;
- pnacl_installer_->NotifyInstallError();
- break;
- }
- }
-}
diff --git a/chrome/browser/component_updater/pnacl/pnacl_updater_observer.h b/chrome/browser/component_updater/pnacl/pnacl_updater_observer.h
deleted file mode 100644
index aa00ca2..0000000
--- a/chrome/browser/component_updater/pnacl/pnacl_updater_observer.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_UPDATER_OBSERVER_H_
-#define CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_UPDATER_OBSERVER_H_
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/component_updater/component_updater_service.h"
-
-class PnaclComponentInstaller;
-
-// Monitors the component updater service, so that the callbacks registered
-// against the PnaclComponentInstaller can be notified of events.
-class PnaclUpdaterObserver : public ComponentObserver {
- public:
- explicit PnaclUpdaterObserver(PnaclComponentInstaller* pci);
- virtual ~PnaclUpdaterObserver();
-
- virtual void OnEvent(Events event, int extra) OVERRIDE;
-
- void EnsureObserving();
- void StopObserving();
-
- private:
- bool must_observe_;
- PnaclComponentInstaller* pnacl_installer_;
- DISALLOW_COPY_AND_ASSIGN(PnaclUpdaterObserver);
-};
-
-#endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_UPDATER_OBSERVER_H_
diff --git a/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc b/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc
index b31daad..342e05a 100644
--- a/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc
+++ b/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc
@@ -78,16 +78,6 @@ ppapi::host::HostFactory* NaClBrowserDelegateImpl::CreatePpapiHostFactory(
return new chrome::ChromeBrowserPepperHostFactory(ppapi_host);
}
-void NaClBrowserDelegateImpl::TryInstallPnacl(
- const base::Callback<void(bool)>& installed) {
- PnaclComponentInstaller* pci =
- g_browser_process->pnacl_component_installer();
- if (pci)
- pci->RequestFirstInstall(installed);
- else
- installed.Run(false);
-}
-
void NaClBrowserDelegateImpl::SetDebugPatterns(std::string debug_patterns) {
if (!debug_patterns.empty() && debug_patterns[0] == '!') {
inverse_debug_patterns_ = true;
diff --git a/chrome/browser/nacl_host/nacl_browser_delegate_impl.h b/chrome/browser/nacl_host/nacl_browser_delegate_impl.h
index a91a35b..de75b82 100644
--- a/chrome/browser/nacl_host/nacl_browser_delegate_impl.h
+++ b/chrome/browser/nacl_host/nacl_browser_delegate_impl.h
@@ -24,8 +24,6 @@ class NaClBrowserDelegateImpl : public NaClBrowserDelegate {
virtual std::string GetVersionString() const OVERRIDE;
virtual ppapi::host::HostFactory* CreatePpapiHostFactory(
content::BrowserPpapiHost* ppapi_host) OVERRIDE;
- virtual void TryInstallPnacl(
- const base::Callback<void(bool)>& installed) OVERRIDE;
virtual bool MapUrlToLocalFilePath(const GURL& url,
bool is_blocking,
base::FilePath* file_path) OVERRIDE;
diff --git a/chrome/browser/nacl_host/nacl_file_host.cc b/chrome/browser/nacl_host/nacl_file_host.cc
index 1ff6378..0596376 100644
--- a/chrome/browser/nacl_host/nacl_file_host.cc
+++ b/chrome/browser/nacl_host/nacl_file_host.cc
@@ -15,7 +15,6 @@
#include "components/nacl/browser/nacl_browser.h"
#include "components/nacl/common/nacl_browser_delegate.h"
#include "components/nacl/common/nacl_host_messages.h"
-#include "components/nacl/common/pnacl_types.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/site_instance.h"
@@ -39,37 +38,6 @@ void NotifyRendererOfError(
nacl_host_message_filter->Send(reply_msg);
}
-void TryInstallPnacl(
- const nacl_file_host::InstallCallback& done_callback,
- const nacl_file_host::InstallProgressCallback& progress_callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- // TODO(jvoung): Figure out a way to get progress events and
- // call progress_callback.
- nacl::NaClBrowser::GetDelegate()->TryInstallPnacl(done_callback);
-}
-
-void DoEnsurePnaclInstalled(
- const nacl_file_host::InstallCallback& done_callback,
- const nacl_file_host::InstallProgressCallback& progress_callback) {
- DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
- // If already installed, return reply w/ success immediately.
- base::FilePath pnacl_dir;
- if (nacl::NaClBrowser::GetDelegate()->GetPnaclDirectory(&pnacl_dir)
- && !pnacl_dir.empty()
- && base::PathExists(pnacl_dir)) {
- done_callback.Run(true);
- return;
- }
-
- // Otherwise, request an install (but send some "unknown" progress first).
- progress_callback.Run(nacl::PnaclInstallProgress::Unknown());
- // TryInstall after sending the progress event so that they are more ordered.
- BrowserThread::PostTask(
- BrowserThread::UI,
- FROM_HERE,
- base::Bind(&TryInstallPnacl, done_callback, progress_callback));
-}
-
bool PnaclDoOpenFile(const base::FilePath& file_to_open,
base::PlatformFile* out_file) {
base::PlatformFileError error_code;
@@ -186,18 +154,6 @@ void DoOpenNaClExecutableOnThreadPool(
namespace nacl_file_host {
-void EnsurePnaclInstalled(
- const InstallCallback& done_callback,
- const InstallProgressCallback& progress_callback) {
- if (!BrowserThread::PostBlockingPoolTask(
- FROM_HERE,
- base::Bind(&DoEnsurePnaclInstalled,
- done_callback,
- progress_callback))) {
- done_callback.Run(false);
- }
-}
-
void GetReadonlyPnaclFd(
scoped_refptr<NaClHostMessageFilter> nacl_host_message_filter,
const std::string& filename,
diff --git a/chrome/browser/nacl_host/nacl_file_host.h b/chrome/browser/nacl_host/nacl_file_host.h
index baf2d5a..a34c8ac 100644
--- a/chrome/browser/nacl_host/nacl_file_host.h
+++ b/chrome/browser/nacl_host/nacl_file_host.h
@@ -7,7 +7,6 @@
#include <string>
-#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
class GURL;
@@ -21,25 +20,9 @@ namespace IPC {
class Message;
}
-namespace nacl {
-struct PnaclInstallProgress;
-}
-
// Opens NaCl Files in the Browser process, on behalf of the NaCl plugin.
namespace nacl_file_host {
-typedef base::Callback<void(bool)> InstallCallback;
-typedef base::Callback<void(const nacl::PnaclInstallProgress&)>
- InstallProgressCallback;
-
-// Ensure that PNaCl is installed. Calls |done_callback| if PNaCl is already
-// installed. Otherwise, issues a request to install and calls |done_callback|
-// after that request completes w/ success or failure.
-// If a request to install is issued, then |progress_callback| is called
-// with progress updates.
-void EnsurePnaclInstalled(
- const InstallCallback& done_callback,
- const InstallProgressCallback& progress_callback);
// Open a PNaCl file (readonly) on behalf of the NaCl plugin.
void GetReadonlyPnaclFd(
diff --git a/chrome/browser/nacl_host/nacl_file_host_unittest.cc b/chrome/browser/nacl_host/nacl_file_host_unittest.cc
index 0870376..2eb8066 100644
--- a/chrome/browser/nacl_host/nacl_file_host_unittest.cc
+++ b/chrome/browser/nacl_host/nacl_file_host_unittest.cc
@@ -7,23 +7,17 @@
#include "base/basictypes.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/run_loop.h"
#include "base/test/scoped_path_override.h"
-#include "base/threading/sequenced_worker_pool.h"
#include "components/nacl/browser/nacl_browser.h"
#include "components/nacl/common/nacl_browser_delegate.h"
-#include "components/nacl/common/pnacl_types.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
using nacl_file_host::PnaclCanOpenFile;
-using nacl_file_host::EnsurePnaclInstalled;
class TestNaClBrowserDelegate : public NaClBrowserDelegate {
public:
- TestNaClBrowserDelegate() : should_pnacl_install_succeed_(false) { }
+ TestNaClBrowserDelegate() {}
virtual void ShowNaClInfobar(int render_process_id,
int render_view_id,
@@ -73,24 +67,12 @@ class TestNaClBrowserDelegate : public NaClBrowserDelegate {
return false;
}
- virtual void TryInstallPnacl(
- const base::Callback<void(bool)>& installed) OVERRIDE {
- installed.Run(should_pnacl_install_succeed_);
- }
-
void SetPnaclDirectory(const base::FilePath& pnacl_dir) {
pnacl_path_ = pnacl_dir;
}
- // Indicate if we should mock the PNaCl install as succeeding
- // or failing for the next test.
- void SetShouldPnaclInstallSucceed(bool succeed) {
- should_pnacl_install_succeed_ = succeed;
- }
-
private:
base::FilePath pnacl_path_;
- bool should_pnacl_install_succeed_;
};
class NaClFileHostTest : public testing::Test {
@@ -112,55 +94,12 @@ class NaClFileHostTest : public testing::Test {
return nacl_browser_delegate_;
}
- bool install_success() { return install_success_; }
- size_t install_call_count() {
- return std::count(events_.begin(), events_.end(), INSTALL_DONE);
- }
- size_t progress_call_count() {
- return std::count(events_.begin(), events_.end(), INSTALL_PROGRESS);
- }
- bool events_in_correct_order() {
- // INSTALL_DONE should be the last thing.
- // The rest should be progress events.
- size_t size = events_.size();
- return size > 0 && events_[size - 1] == INSTALL_DONE
- && progress_call_count() == (size - 1);
- }
-
- public: // Allow classes to bind these callback methods.
- void CallbackInstall(bool success) {
- install_success_ = success;
- events_.push_back(INSTALL_DONE);
- }
-
- void CallbackProgress(const nacl::PnaclInstallProgress& p) {
- // Check that the first event has an unknown total.
- if (events_.size() == 0) {
- EXPECT_FALSE(nacl::PnaclInstallProgress::progress_known(p));
- }
- events_.push_back(INSTALL_PROGRESS);
- // TODO(jvoung): be able to check that current_progress
- // goes up monotonically and hits total_progress at the end,
- // when we actually get real progress events.
- }
-
private:
- enum EventType {
- INSTALL_DONE,
- INSTALL_PROGRESS
- };
TestNaClBrowserDelegate* nacl_browser_delegate_;
- bool install_success_;
- std::vector<EventType> events_;
- content::TestBrowserThreadBundle thread_bundle_;
DISALLOW_COPY_AND_ASSIGN(NaClFileHostTest);
};
-NaClFileHostTest::NaClFileHostTest()
- : nacl_browser_delegate_(NULL),
- install_success_(false),
- thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {
-}
+NaClFileHostTest::NaClFileHostTest() : nacl_browser_delegate_(NULL) {}
NaClFileHostTest::~NaClFileHostTest() {
}
@@ -221,66 +160,3 @@ TEST_F(NaClFileHostTest, TestFilenamesWithPnaclPath) {
EXPECT_FALSE(PnaclCanOpenFile("$HOME/.bashrc", &out_path));
#endif
}
-
-// Test that callbacks return success when PNaCl looks like it is
-// already installed. No intermediate progress events are expected.
-TEST_F(NaClFileHostTest, TestEnsureInstalledAlreadyInstalled) {
- base::ScopedTempDir scoped_tmp_dir;
- ASSERT_TRUE(scoped_tmp_dir.CreateUniqueTempDir());
-
- base::FilePath kTestPnaclPath = scoped_tmp_dir.path();
- nacl_browser_delegate()->SetPnaclDirectory(kTestPnaclPath);
- ASSERT_TRUE(nacl::NaClBrowser::GetDelegate()->GetPnaclDirectory(
- &kTestPnaclPath));
-
- EnsurePnaclInstalled(
- base::Bind(&NaClFileHostTest::CallbackInstall, base::Unretained(this)),
- base::Bind(&NaClFileHostTest::CallbackProgress, base::Unretained(this)));
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
-
- EXPECT_TRUE(install_success());
- EXPECT_EQ(1u, install_call_count());
- EXPECT_EQ(0u, progress_call_count());
- EXPECT_TRUE(events_in_correct_order());
-}
-
-// Test that final callback is called with success, when PNaCl does not
-// look like it's already installed, but mock installer says success.
-// Also check that intermediate progress events are called.
-TEST_F(NaClFileHostTest, TestEnsureInstalledNotInstalledSuccess) {
- base::FilePath kTestPnaclPath;
- nacl_browser_delegate()->SetPnaclDirectory(kTestPnaclPath);
- nacl_browser_delegate()->SetShouldPnaclInstallSucceed(true);
-
- EnsurePnaclInstalled(
- base::Bind(&NaClFileHostTest::CallbackInstall, base::Unretained(this)),
- base::Bind(&NaClFileHostTest::CallbackProgress, base::Unretained(this)));
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
-
- EXPECT_TRUE(install_success());
- EXPECT_EQ(1u, install_call_count());
- EXPECT_GE(progress_call_count(), 1u);
- EXPECT_TRUE(events_in_correct_order());
-}
-
-// Test that final callback is called with error, when PNaCl does not look
-// like it's already installed, but mock installer says error.
-// Also check that intermediate progress events are called.
-TEST_F(NaClFileHostTest, TestEnsureInstalledNotInstalledError) {
- base::FilePath kTestPnaclPath;
- nacl_browser_delegate()->SetPnaclDirectory(kTestPnaclPath);
- nacl_browser_delegate()->SetShouldPnaclInstallSucceed(false);
-
- EnsurePnaclInstalled(
- base::Bind(&NaClFileHostTest::CallbackInstall, base::Unretained(this)),
- base::Bind(&NaClFileHostTest::CallbackProgress, base::Unretained(this)));
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
-
- EXPECT_FALSE(install_success());
- EXPECT_EQ(1u, install_call_count());
- EXPECT_GE(progress_call_count(), 1u);
- EXPECT_TRUE(events_in_correct_order());
-}
diff --git a/chrome/browser/nacl_host/nacl_host_message_filter.cc b/chrome/browser/nacl_host/nacl_host_message_filter.cc
index 0b7a8cb..1c87b6c 100644
--- a/chrome/browser/nacl_host/nacl_host_message_filter.cc
+++ b/chrome/browser/nacl_host/nacl_host_message_filter.cc
@@ -39,8 +39,6 @@ bool NaClHostMessageFilter::OnMessageReceived(const IPC::Message& message,
IPC_BEGIN_MESSAGE_MAP_EX(NaClHostMessageFilter, message, *message_was_ok)
#if !defined(DISABLE_NACL)
IPC_MESSAGE_HANDLER_DELAY_REPLY(NaClHostMsg_LaunchNaCl, OnLaunchNaCl)
- IPC_MESSAGE_HANDLER(NaClHostMsg_EnsurePnaclInstalled,
- OnEnsurePnaclInstalled)
IPC_MESSAGE_HANDLER_DELAY_REPLY(NaClHostMsg_GetReadonlyPnaclFD,
OnGetReadonlyPnaclFd)
IPC_MESSAGE_HANDLER_DELAY_REPLY(NaClHostMsg_NaClCreateTemporaryFile,
@@ -87,27 +85,6 @@ void NaClHostMessageFilter::OnLaunchNaCl(
host->Launch(this, reply_msg, manifest_path);
}
-void NaClHostMessageFilter::ReplyEnsurePnaclInstalled(
- int instance,
- bool success) {
- Send(new NaClViewMsg_EnsurePnaclInstalledReply(instance, success));
-}
-
-void NaClHostMessageFilter::SendProgressEnsurePnaclInstalled(
- int instance,
- const nacl::PnaclInstallProgress& progress) {
- // TODO(jvoung): actually send an IPC.
-}
-
-void NaClHostMessageFilter::OnEnsurePnaclInstalled(
- int instance) {
- nacl_file_host::EnsurePnaclInstalled(
- base::Bind(&NaClHostMessageFilter::ReplyEnsurePnaclInstalled,
- this, instance),
- base::Bind(&NaClHostMessageFilter::SendProgressEnsurePnaclInstalled,
- this, instance));
-}
-
void NaClHostMessageFilter::OnGetReadonlyPnaclFd(
const std::string& filename, IPC::Message* reply_msg) {
// This posts a task to another thread, but the renderer will
diff --git a/chrome/browser/nacl_host/nacl_host_message_filter.h b/chrome/browser/nacl_host/nacl_host_message_filter.h
index f4493fc..b8b201a 100644
--- a/chrome/browser/nacl_host/nacl_host_message_filter.h
+++ b/chrome/browser/nacl_host/nacl_host_message_filter.h
@@ -15,7 +15,6 @@ class GURL;
namespace nacl {
struct NaClLaunchParams;
struct PnaclCacheInfo;
-struct PnaclInstallProgress;
}
namespace net {
@@ -50,7 +49,6 @@ class NaClHostMessageFilter : public content::BrowserMessageFilter {
#if !defined(DISABLE_NACL)
void OnLaunchNaCl(const nacl::NaClLaunchParams& launch_params,
IPC::Message* reply_msg);
- void OnEnsurePnaclInstalled(int instance);
void OnGetReadonlyPnaclFd(const std::string& filename,
IPC::Message* reply_msg);
void OnNaClCreateTemporaryFile(IPC::Message* reply_msg);
@@ -62,11 +60,6 @@ class NaClHostMessageFilter : public content::BrowserMessageFilter {
void OnOpenNaClExecutable(int render_view_id,
const GURL& file_url,
IPC::Message* reply_msg);
-
- void ReplyEnsurePnaclInstalled(int instance, bool success);
- void SendProgressEnsurePnaclInstalled(
- int instance,
- const nacl::PnaclInstallProgress& progress);
void SyncReturnTemporaryFile(IPC::Message* reply_msg,
base::PlatformFile fd);
void AsyncReturnTemporaryFile(int pp_instance,
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 17e3b3f..eb44924 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -434,8 +434,6 @@
'browser/component_updater/pnacl/pnacl_component_installer.h',
'browser/component_updater/pnacl/pnacl_profile_observer.cc',
'browser/component_updater/pnacl/pnacl_profile_observer.h',
- 'browser/component_updater/pnacl/pnacl_updater_observer.cc',
- 'browser/component_updater/pnacl/pnacl_updater_observer.h',
'browser/component_updater/ppapi_utils.cc',
'browser/component_updater/ppapi_utils.h',
'browser/component_updater/recovery_component_installer.cc',
diff --git a/chrome/renderer/pepper/pnacl_translation_resource_host.cc b/chrome/renderer/pepper/pnacl_translation_resource_host.cc
index 609ddec..0546c75 100644
--- a/chrome/renderer/pepper/pnacl_translation_resource_host.cc
+++ b/chrome/renderer/pepper/pnacl_translation_resource_host.cc
@@ -27,7 +27,6 @@ PnaclTranslationResourceHost::PnaclTranslationResourceHost(
PnaclTranslationResourceHost::~PnaclTranslationResourceHost() {
DCHECK(io_message_loop_->BelongsToCurrentThread());
CleanupCacheRequests();
- CleanupEnsurePnaclRequests();
}
void PnaclTranslationResourceHost::OnFilterAdded(IPC::Channel* channel) {
@@ -51,8 +50,6 @@ bool PnaclTranslationResourceHost::OnMessageReceived(
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PnaclTranslationResourceHost, message)
IPC_MESSAGE_HANDLER(NaClViewMsg_NexeTempFileReply, OnNexeTempFileReply)
- IPC_MESSAGE_HANDLER(NaClViewMsg_EnsurePnaclInstalledReply,
- OnEnsurePnaclInstalledReply)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -168,70 +165,4 @@ void PnaclTranslationResourceHost::CleanupCacheRequests() {
pending_cache_requests_.clear();
}
-void PnaclTranslationResourceHost::EnsurePnaclInstalled(
- PP_Instance instance,
- scoped_refptr<TrackedCallback> callback) {
- DCHECK(PpapiGlobals::Get()->
- GetMainThreadMessageLoop()->BelongsToCurrentThread());
- io_message_loop_->PostTask(
- FROM_HERE,
- base::Bind(&PnaclTranslationResourceHost::SendEnsurePnaclInstalled,
- this, instance, callback));
- return;
-}
-
-void PnaclTranslationResourceHost::SendEnsurePnaclInstalled(
- PP_Instance instance,
- scoped_refptr<TrackedCallback> callback) {
- DCHECK(io_message_loop_->BelongsToCurrentThread());
- // If a request is already in, just queue this one and wait for notification.
- // Hope that the request is not canceled.
- if (pending_ensure_pnacl_requests_.size() > 0) {
- pending_ensure_pnacl_requests_.push_back(callback);
- return;
- }
- // Otherwise, try to send the request, then queue.
- if (!channel_ || !channel_->Send(new NaClHostMsg_EnsurePnaclInstalled(
- instance))) {
- PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
- FROM_HERE,
- base::Bind(&TrackedCallback::Run,
- callback,
- static_cast<int32_t>(PP_ERROR_FAILED)));
- return;
- }
- pending_ensure_pnacl_requests_.push_back(callback);
-}
-
-void PnaclTranslationResourceHost::OnEnsurePnaclInstalledReply(
- PP_Instance instance,
- bool success) {
- DCHECK(io_message_loop_->BelongsToCurrentThread());
- // Broadcast to all listeners.
- for (EnsurePnaclInstalledList::iterator
- i = pending_ensure_pnacl_requests_.begin(),
- e = pending_ensure_pnacl_requests_.end();
- i != e; ++i) {
- if (TrackedCallback::IsPending(*i)) {
- PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
- FROM_HERE,
- base::Bind(&TrackedCallback::Run,
- *i,
- static_cast<int32_t>(success ? PP_OK : PP_ERROR_FAILED)));
- }
- }
- pending_ensure_pnacl_requests_.clear();
-}
-
-void PnaclTranslationResourceHost::CleanupEnsurePnaclRequests() {
- DCHECK(io_message_loop_->BelongsToCurrentThread());
- for (EnsurePnaclInstalledList::iterator
- i = pending_ensure_pnacl_requests_.begin(),
- e = pending_ensure_pnacl_requests_.end();
- i != e; ++i) {
- (*i)->PostAbort();
- }
- pending_ensure_pnacl_requests_.clear();
-}
-
#endif // DISABLE_NACL
diff --git a/chrome/renderer/pepper/pnacl_translation_resource_host.h b/chrome/renderer/pepper/pnacl_translation_resource_host.h
index 5958544..6570cd0 100644
--- a/chrome/renderer/pepper/pnacl_translation_resource_host.h
+++ b/chrome/renderer/pepper/pnacl_translation_resource_host.h
@@ -6,7 +6,6 @@
#define CHROME_RENDERER_PEPPER_PNACL_TRANSLATION_RESOURCE_HOST_H_
#include <map>
-#include <vector>
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_platform_file.h"
@@ -35,10 +34,6 @@ class PnaclTranslationResourceHost : public IPC::ChannelProxy::MessageFilter {
scoped_refptr<ppapi::TrackedCallback> callback);
void ReportTranslationFinished(PP_Instance instance, PP_Bool success);
- // Ensure that PNaCl resources (pnacl-llc.nexe, linker, libs) are installed.
- void EnsurePnaclInstalled(PP_Instance instance,
- scoped_refptr<ppapi::TrackedCallback> callback);
-
protected:
virtual ~PnaclTranslationResourceHost();
@@ -59,9 +54,6 @@ class PnaclTranslationResourceHost : public IPC::ChannelProxy::MessageFilter {
// Maps the instance with an outstanding cache request to the info
// about that request.
typedef std::map<PP_Instance, CacheRequestInfo> CacheRequestInfoMap;
- // A list of outstanding EnsurePnaclInstalled requests.
- typedef std::vector<scoped_refptr<ppapi::TrackedCallback> >
- EnsurePnaclInstalledList;
// IPC::ChannelProxy::MessageFilter implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
@@ -76,22 +68,16 @@ class PnaclTranslationResourceHost : public IPC::ChannelProxy::MessageFilter {
scoped_refptr<ppapi::TrackedCallback> callback);
void SendReportTranslationFinished(PP_Instance instance,
PP_Bool success);
- void SendEnsurePnaclInstalled(PP_Instance instance,
- scoped_refptr<ppapi::TrackedCallback> callback);
-
void OnNexeTempFileReply(PP_Instance instance,
bool is_hit,
IPC::PlatformFileForTransit file);
void CleanupCacheRequests();
- void OnEnsurePnaclInstalledReply(PP_Instance instance, bool success);
- void CleanupEnsurePnaclRequests();
scoped_refptr<base::MessageLoopProxy> io_message_loop_;
// Should be accessed on the io thread.
IPC::Channel* channel_;
CacheRequestInfoMap pending_cache_requests_;
- EnsurePnaclInstalledList pending_ensure_pnacl_requests_;
DISALLOW_COPY_AND_ASSIGN(PnaclTranslationResourceHost);
};
diff --git a/chrome/renderer/pepper/ppb_nacl_private_impl.cc b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
index 6717bba..18193f3 100644
--- a/chrome/renderer/pepper/ppb_nacl_private_impl.cc
+++ b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
@@ -204,19 +204,6 @@ int32_t BrokerDuplicateHandle(PP_FileHandle source_handle,
#endif
}
-int32_t EnsurePnaclInstalled(PP_Instance instance,
- PP_CompletionCallback callback) {
- ppapi::thunk::EnterInstance enter(instance, callback);
- if (enter.failed())
- return enter.retval();
- if (!InitializePnaclResourceHost())
- return enter.SetResult(PP_ERROR_FAILED);
- g_pnacl_resource_host.Get()->EnsurePnaclInstalled(
- instance,
- enter.callback());
- return enter.SetResult(PP_OK_COMPLETIONPENDING);
-}
-
PP_FileHandle GetReadonlyPnaclFD(const char* filename) {
IPC::PlatformFileForTransit out_fd = IPC::InvalidPlatformFileForTransit();
IPC::Sender* sender = content::RenderThread::Get();
@@ -355,7 +342,6 @@ const PPB_NaCl_Private nacl_interface = {
&UrandomFD,
&Are3DInterfacesDisabled,
&BrokerDuplicateHandle,
- &EnsurePnaclInstalled,
&GetReadonlyPnaclFD,
&CreateTemporaryFile,
&GetNexeFd,
diff --git a/components/nacl/common/nacl_browser_delegate.h b/components/nacl/common/nacl_browser_delegate.h
index ba577de..10d0148 100644
--- a/components/nacl/common/nacl_browser_delegate.h
+++ b/components/nacl/common/nacl_browser_delegate.h
@@ -68,13 +68,6 @@ class NaClBrowserDelegate {
virtual bool MapUrlToLocalFilePath(const GURL& url,
bool use_blocking_api,
base::FilePath* file_path) = 0;
- // Install PNaCl if this operation is supported. On success, the |installed|
- // callback should be called with true, and on failure (or not supported),
- // the |installed| callback should be called with false.
- // TODO(jvoung): Add the progress callback as well.
- virtual void TryInstallPnacl(
- const base::Callback<void(bool)>& installed) = 0;
-
// Set match patterns which will be checked before enabling debug stub.
virtual void SetDebugPatterns(std::string debug_patterns) = 0;
diff --git a/components/nacl/common/nacl_host_messages.h b/components/nacl/common/nacl_host_messages.h
index 4afa1c7..ec0f07b 100644
--- a/components/nacl/common/nacl_host_messages.h
+++ b/components/nacl/common/nacl_host_messages.h
@@ -55,17 +55,6 @@ IPC_SYNC_MESSAGE_CONTROL1_2(NaClHostMsg_LaunchNaCl,
std::string /* error_message */)
// A renderer sends this to the browser process when it wants to
-// ensure that PNaCl is installed.
-IPC_MESSAGE_CONTROL1(NaClHostMsg_EnsurePnaclInstalled,
- int /* pp_instance */)
-
-// The browser replies to the renderer's request to ensure that
-// PNaCl is installed.
-IPC_MESSAGE_CONTROL2(NaClViewMsg_EnsurePnaclInstalledReply,
- int /* pp_instance */,
- bool /* success */)
-
-// A renderer sends this to the browser process when it wants to
// open a file for from the Pnacl component directory.
IPC_SYNC_MESSAGE_CONTROL1_1(NaClHostMsg_GetReadonlyPnaclFD,
std::string /* name of requested PNaCl file */,
diff --git a/components/nacl/common/pnacl_types.cc b/components/nacl/common/pnacl_types.cc
index 75384b6..b8e85d9 100644
--- a/components/nacl/common/pnacl_types.cc
+++ b/components/nacl/common/pnacl_types.cc
@@ -10,20 +10,4 @@ PnaclCacheInfo::PnaclCacheInfo()
: abi_version(0), opt_level(0), has_no_store_header(0) {}
PnaclCacheInfo::~PnaclCacheInfo() {}
-// static
-bool PnaclInstallProgress::progress_known(const PnaclInstallProgress& p) {
- return p.total_size >= 0;
-}
-
-// static
-PnaclInstallProgress PnaclInstallProgress::Unknown() {
- PnaclInstallProgress p;
- p.current = 0;
- // Use -1 to indicate that total is not determined.
- // This matches the -1 of the OnURLFetchDownloadProgress interface in
- // net/url_request/url_fetcher_delegate.h
- p.total_size = -1;
- return p;
-}
-
} // namespace nacl
diff --git a/components/nacl/common/pnacl_types.h b/components/nacl/common/pnacl_types.h
index d1a12c8..b897a19 100644
--- a/components/nacl/common/pnacl_types.h
+++ b/components/nacl/common/pnacl_types.h
@@ -9,7 +9,6 @@
// nacl_types is built into nacl_helper in addition to chrome, and we don't
// want to pull src/url/ into there, since it would be unnecessary bloat.
-#include "base/basictypes.h"
#include "base/time/time.h"
#include "url/gurl.h"
@@ -30,20 +29,6 @@ struct PnaclCacheInfo {
bool has_no_store_header;
};
-// Progress information for PNaCl on-demand installs.
-struct PnaclInstallProgress {
- int64 current;
- int64 total_size;
-
- // Returns an instance of PnaclInstallProgress where the
- // total is marked as unknown.
- static PnaclInstallProgress Unknown();
-
- // Returns true if the given instance of PnaclInstallProgress has
- // an unknown total.
- static bool progress_known(const PnaclInstallProgress& p);
-};
-
} // namespace nacl
#endif // COMPONENTS_NACL_COMMON_PNACL_TYPES_H_
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
index 3b965e9..7a52372 100644
--- a/ppapi/api/private/ppb_nacl_private.idl
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -87,14 +87,6 @@ interface PPB_NaCl_Private {
[in] uint32_t desired_access,
[in] uint32_t options);
- /* Check if PNaCl is installed and attempt to install if necessary.
- * Callback is called when the check is done and PNaCl is already installed,
- * or after an on-demand install is attempted. Called back with PP_OK if
- * PNaCl is available. Called back with an error otherwise.
- */
- int32_t EnsurePnaclInstalled([in] PP_Instance instance,
- [in] PP_CompletionCallback callback);
-
/* Returns a read-only file descriptor of a file rooted in the Pnacl
* component directory, or an invalid handle on failure.
*/
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index 923e9cb..3b67740 100644
--- a/ppapi/c/private/ppb_nacl_private.h
+++ b/ppapi/c/private/ppb_nacl_private.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_nacl_private.idl modified Fri Oct 18 08:23:34 2013. */
+/* From private/ppb_nacl_private.idl modified Thu Oct 31 15:10:06 2013. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
@@ -106,13 +106,6 @@ struct PPB_NaCl_Private_1_0 {
PP_FileHandle* target_handle,
uint32_t desired_access,
uint32_t options);
- /* Check if PNaCl is installed and attempt to install if necessary.
- * Callback is called when the check is done and PNaCl is already installed,
- * or after an on-demand install is attempted. Called back with PP_OK if
- * PNaCl is available. Called back with an error otherwise.
- */
- int32_t (*EnsurePnaclInstalled)(PP_Instance instance,
- struct PP_CompletionCallback callback);
/* Returns a read-only file descriptor of a file rooted in the Pnacl
* component directory, or an invalid handle on failure.
*/
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
index 860a67e..9d7fa0d 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
@@ -426,26 +426,55 @@ void PnaclCoordinator::NexeReadDidOpen(int32_t pp_error) {
translate_notify_callback_.Run(pp_error);
}
-void PnaclCoordinator::DidCheckPnaclInstalled(int32_t pp_error) {
- if (pp_error != PP_OK) {
+void PnaclCoordinator::OpenBitcodeStream() {
+ // Now open the pexe stream.
+ streaming_downloader_.reset(new FileDownloader());
+ streaming_downloader_->Initialize(plugin_);
+ // Mark the request as requesting a PNaCl bitcode file,
+ // so that component updater can detect this user action.
+ streaming_downloader_->set_request_headers(
+ "Accept: application/x-pnacl, */*");
+
+ // Even though we haven't started downloading, create the translation
+ // thread object immediately. This ensures that any pieces of the file
+ // that get downloaded before the compilation thread is accepting
+ // SRPCs won't get dropped.
+ translate_thread_.reset(new PnaclTranslateThread());
+ if (translate_thread_ == NULL) {
+ ReportNonPpapiError(
+ ERROR_PNACL_THREAD_CREATE,
+ "PnaclCoordinator: could not allocate translation thread.");
+ return;
+ }
+
+ pp::CompletionCallback cb =
+ callback_factory_.NewCallback(&PnaclCoordinator::BitcodeStreamDidOpen);
+ if (!streaming_downloader_->OpenStream(pexe_url_, cb, this)) {
ReportNonPpapiError(
- ERROR_PNACL_RESOURCE_FETCH,
- nacl::string("The Portable Native Client (pnacl) component is not "
- "installed. Please consult chrome://components for more "
- "information."));
+ ERROR_PNACL_PEXE_FETCH_OTHER,
+ nacl::string("PnaclCoordinator: failed to open stream ") + pexe_url_);
+ return;
+ }
+}
+
+void PnaclCoordinator::BitcodeStreamDidOpen(int32_t pp_error) {
+ if (pp_error != PP_OK) {
+ BitcodeStreamDidFinish(pp_error);
+ // We have not spun up the translation process yet, so we need to call
+ // TranslateFinished here.
+ TranslateFinished(pp_error);
return;
}
- // Loading resources (e.g. llc and ld nexes) is done with PnaclResources.
- resources_.reset(new PnaclResources(plugin_,
- this,
- this->manifest_.get()));
+ // The component updater's resource throttles + OnDemand update/install
+ // should block the URL request until the compiler is present. Now we
+ // can load the resources (e.g. llc and ld nexes).
+ resources_.reset(new PnaclResources(plugin_, this, this->manifest_.get()));
CHECK(resources_ != NULL);
// The first step of loading resources: read the resource info file.
pp::CompletionCallback resource_info_read_cb =
- callback_factory_.NewCallback(
- &PnaclCoordinator::ResourceInfoWasRead);
+ callback_factory_.NewCallback(&PnaclCoordinator::ResourceInfoWasRead);
resources_->ReadResourceInfo(PnaclUrls::GetResourceInfoUrl(),
resource_info_read_cb);
}
@@ -453,7 +482,8 @@ void PnaclCoordinator::DidCheckPnaclInstalled(int32_t pp_error) {
void PnaclCoordinator::ResourceInfoWasRead(int32_t pp_error) {
PLUGIN_PRINTF(("PluginCoordinator::ResourceInfoWasRead (pp_error=%"
NACL_PRId32 ")\n", pp_error));
- // Second step of loading resources: call StartLoad.
+ // Second step of loading resources: call StartLoad to load pnacl-llc
+ // and pnacl-ld, based on the filenames found in the resource info file.
pp::CompletionCallback resources_cb =
callback_factory_.NewCallback(&PnaclCoordinator::ResourcesDidLoad);
resources_->StartLoad(resources_cb);
@@ -499,56 +529,6 @@ void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) {
}
}
-void PnaclCoordinator::OpenBitcodeStream() {
- // Now open the pexe stream.
- streaming_downloader_.reset(new FileDownloader());
- streaming_downloader_->Initialize(plugin_);
- // Mark the request as requesting a PNaCl bitcode file,
- // so that component updater can detect this user action.
- streaming_downloader_->set_request_headers(
- "Accept: application/x-pnacl, */*");
-
- // Even though we haven't started downloading, create the translation
- // thread object immediately. This ensures that any pieces of the file
- // that get downloaded before the compilation thread is accepting
- // SRPCs won't get dropped.
- translate_thread_.reset(new PnaclTranslateThread());
- if (translate_thread_ == NULL) {
- ReportNonPpapiError(
- ERROR_PNACL_THREAD_CREATE,
- "PnaclCoordinator: could not allocate translation thread.");
- return;
- }
-
- pp::CompletionCallback cb =
- callback_factory_.NewCallback(&PnaclCoordinator::BitcodeStreamDidOpen);
- if (!streaming_downloader_->OpenStream(pexe_url_, cb, this)) {
- ReportNonPpapiError(
- ERROR_PNACL_PEXE_FETCH_OTHER,
- nacl::string("PnaclCoordinator: failed to open stream ") + pexe_url_);
- return;
- }
-}
-
-void PnaclCoordinator::BitcodeStreamDidOpen(int32_t pp_error) {
- if (pp_error != PP_OK) {
- BitcodeStreamDidFinish(pp_error);
- // We have not spun up the translation process yet, so we need to call
- // TranslateFinished here.
- TranslateFinished(pp_error);
- return;
- }
-
- // Now that we've started the url request for the response headers and
- // for tickling the component updater's On-Demand API, check that the
- // compiler is present, or block until it is present or an error is hit.
- pp::CompletionCallback pnacl_installed_cb =
- callback_factory_.NewCallback(&PnaclCoordinator::DidCheckPnaclInstalled);
- plugin_->nacl_interface()->EnsurePnaclInstalled(
- plugin_->pp_instance(),
- pnacl_installed_cb.pp_completion_callback());
-}
-
void PnaclCoordinator::NexeFdDidOpen(int32_t pp_error) {
PLUGIN_PRINTF(("PnaclCoordinator::NexeFdDidOpen (pp_error=%"
NACL_PRId32 ", hit=%d, handle=%d)\n", pp_error,
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
index 4b65e9e..00d6beb 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
@@ -145,9 +145,6 @@ class PnaclCoordinator: public CallbackSource<FileStreamData> {
// caching metadata.
void BitcodeStreamDidOpen(int32_t pp_error);
- // Callback for when we know PNaCl is installed.
- void DidCheckPnaclInstalled(int32_t pp_error);
-
// Callback for when the resource info JSON file has been read.
void ResourceInfoWasRead(int32_t pp_error);
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index d8ca859..1365a3e 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -3063,11 +3063,6 @@ static int32_t Pnacl_M25_PPB_NaCl_Private_BrokerDuplicateHandle(PP_FileHandle so
return iface->BrokerDuplicateHandle(source_handle, process_id, target_handle, desired_access, options);
}
-static int32_t Pnacl_M25_PPB_NaCl_Private_EnsurePnaclInstalled(PP_Instance instance, struct PP_CompletionCallback* callback) {
- const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- return iface->EnsurePnaclInstalled(instance, *callback);
-}
-
static PP_FileHandle Pnacl_M25_PPB_NaCl_Private_GetReadonlyPnaclFd(const char* filename) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
return iface->GetReadonlyPnaclFd(filename);
@@ -4944,7 +4939,6 @@ struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = {
.UrandomFD = (int32_t (*)(void))&Pnacl_M25_PPB_NaCl_Private_UrandomFD,
.Are3DInterfacesDisabled = (PP_Bool (*)(void))&Pnacl_M25_PPB_NaCl_Private_Are3DInterfacesDisabled,
.BrokerDuplicateHandle = (int32_t (*)(PP_FileHandle source_handle, uint32_t process_id, PP_FileHandle* target_handle, uint32_t desired_access, uint32_t options))&Pnacl_M25_PPB_NaCl_Private_BrokerDuplicateHandle,
- .EnsurePnaclInstalled = (int32_t (*)(PP_Instance instance, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_EnsurePnaclInstalled,
.GetReadonlyPnaclFd = (PP_FileHandle (*)(const char* filename))&Pnacl_M25_PPB_NaCl_Private_GetReadonlyPnaclFd,
.CreateTemporaryFile = (PP_FileHandle (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_CreateTemporaryFile,
.GetNexeFd = (int32_t (*)(PP_Instance instance, const char* pexe_url, uint32_t abi_version, uint32_t opt_level, const char* last_modified, const char* etag, PP_Bool has_no_store_header, PP_Bool* is_hit, PP_FileHandle* nexe_handle, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_GetNexeFd,