summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-27 02:07:29 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-27 02:07:29 +0000
commit4dd756d25890e948424a9284a49b86846c0d938f (patch)
tree606e9e0722d2b0dc3951cf3c6c6b209f9c16591d
parent8c20ef8993006ef208510d70318160d3f57921a3 (diff)
downloadchromium_src-4dd756d25890e948424a9284a49b86846c0d938f.zip
chromium_src-4dd756d25890e948424a9284a49b86846c0d938f.tar.gz
chromium_src-4dd756d25890e948424a9284a49b86846c0d938f.tar.bz2
Pepper: Remove PPP_ManifestService.
Now that enough logic has been moved out of the trusted plugin, we can get rid of PPP_ManifestService and make the code in the Non-SFI case much clearer. CQ_EXTRA_TRYBOTS=tryserver.chromium:linux_rel_precise32 BUG=239656 Review URL: https://codereview.chromium.org/356053004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280204 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--components/nacl/renderer/ppb_nacl_private_impl.cc60
-rw-r--r--ppapi/api/private/ppb_nacl_private.idl17
-rw-r--r--ppapi/c/private/ppb_nacl_private.h57
-rw-r--r--ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc4
-rw-r--r--ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h2
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.cc59
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c10
7 files changed, 40 insertions, 169 deletions
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index 5c52e63..cb94ca2 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -165,31 +165,37 @@ void DownloadFile(PP_Instance instance,
const std::string& url,
const DownloadFileCallback& callback);
+PP_Bool StartPpapiProxy(PP_Instance instance);
+
// Thin adapter from PPP_ManifestService to ManifestServiceChannel::Delegate.
// Note that user_data is managed by the caller of LaunchSelLdr. Please see
// also PP_ManifestService's comment for more details about resource
// management.
class ManifestServiceProxy : public ManifestServiceChannel::Delegate {
public:
- ManifestServiceProxy(PP_Instance pp_instance,
- const PPP_ManifestService* manifest_service,
- void* user_data)
- : pp_instance_(pp_instance),
- manifest_service_(*manifest_service),
- user_data_(user_data) {
+ ManifestServiceProxy(PP_Instance pp_instance)
+ : pp_instance_(pp_instance) {
}
- virtual ~ManifestServiceProxy() {
- Quit();
- }
+ virtual ~ManifestServiceProxy() { }
virtual void StartupInitializationComplete() OVERRIDE {
- if (!user_data_)
- return;
-
- if (!PP_ToBool(
- manifest_service_.StartupInitializationComplete(user_data_))) {
- user_data_ = NULL;
+ if (StartPpapiProxy(pp_instance_) == PP_TRUE) {
+ JsonManifest* manifest = GetJsonManifest(pp_instance_);
+ NexeLoadManager* load_manager = GetNexeLoadManager(pp_instance_);
+ if (load_manager && manifest) {
+ std::string full_url;
+ PP_PNaClOptions pnacl_options;
+ bool uses_nonsfi_mode;
+ JsonManifest::ErrorInfo error_info;
+ if (manifest->GetProgramURL(&full_url,
+ &pnacl_options,
+ &uses_nonsfi_mode,
+ &error_info)) {
+ int64_t nexe_size = load_manager->nexe_size();
+ load_manager->ReportLoadSuccess(full_url, nexe_size, nexe_size);
+ }
+ }
}
}
@@ -199,9 +205,6 @@ class ManifestServiceProxy : public ManifestServiceChannel::Delegate {
DCHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->
BelongsToCurrentThread());
- if (!user_data_)
- return;
-
std::string url;
// TODO(teravest): Clean up pnacl_options logic in JsonManifest so we don't
// have to initialize it like this here.
@@ -239,18 +242,7 @@ class ManifestServiceProxy : public ManifestServiceChannel::Delegate {
callback.Run(base::File(file_info.handle));
}
- void Quit() {
- if (!user_data_)
- return;
-
- bool result = PP_ToBool(manifest_service_.Quit(user_data_));
- DCHECK(!result);
- user_data_ = NULL;
- }
-
PP_Instance pp_instance_;
- PPP_ManifestService manifest_service_;
- void* user_data_;
DISALLOW_COPY_AND_ASSIGN(ManifestServiceProxy);
};
@@ -305,21 +297,15 @@ void LaunchSelLdr(PP_Instance instance,
PP_Bool enable_dyncode_syscalls,
PP_Bool enable_exception_handling,
PP_Bool enable_crash_throttling,
- const PPP_ManifestService* manifest_service_interface,
- void* manifest_service_user_data,
void* imc_handle,
PP_CompletionCallback callback) {
CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->
BelongsToCurrentThread());
// Create the manifest service proxy here, so on error case, it will be
- // destructed (without passing it to ManifestServiceChannel), and QUIT
- // will be called in its destructor so that the caller of this function
- // can free manifest_service_user_data properly.
+ // destructed (without passing it to ManifestServiceChannel).
scoped_ptr<ManifestServiceChannel::Delegate> manifest_service_proxy(
- new ManifestServiceProxy(instance,
- manifest_service_interface,
- manifest_service_user_data));
+ new ManifestServiceProxy(instance));
FileDescriptor result_socket;
IPC::Sender* sender = content::RenderThread::Get();
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
index 243a97f..944f87c 100644
--- a/ppapi/api/private/ppb_nacl_private.idl
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -143,21 +143,6 @@ struct PP_PNaClOptions {
typedef void PP_OpenResourceCompletionCallback([inout] mem_t user_data,
[in] PP_FileHandle file_handle);
-/* ManifestService to support irt_open_resource() function.
- * All functions of the service should have PP_Bool return value. It represents
- * whether the service is still alive or not. Trivially Quit() should always
- * return false. However, other functions also can return false.
- * Once false is called, as the service has been destructed, all functions
- * should never be called afterwords.
- */
-interface PPP_ManifestService {
- /* Called when ManifestService should be destructed. */
- PP_Bool Quit([inout] mem_t user_data);
-
- /* Called when PPAPI initialization in the NaCl plugin is finished. */
- PP_Bool StartupInitializationComplete([inout] mem_t user_data);
-};
-
/* Corresponds to NaClFileInfo in
* native_client/src/trusted/validator/nacl_file_info.h */
struct PP_NaClFileInfo {
@@ -203,8 +188,6 @@ interface PPB_NaCl_Private {
[in] PP_Bool enable_dyncode_syscalls,
[in] PP_Bool enable_exception_handling,
[in] PP_Bool enable_crash_throttling,
- [in] PPP_ManifestService manifest_service_interface,
- [inout] mem_t manifest_service_user_data,
[out] mem_t imc_handle,
[in] PP_CompletionCallback callback);
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index 8903693..8e754f9 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 Wed Jun 25 16:42:25 2014. */
+/* From private/ppb_nacl_private.idl modified Thu Jun 26 14:23:46 2014. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
@@ -15,9 +15,6 @@
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_var.h"
-#define PPP_MANIFESTSERVICE_INTERFACE_1_0 "PPP_ManifestService;1.0"
-#define PPP_MANIFESTSERVICE_INTERFACE PPP_MANIFESTSERVICE_INTERFACE_1_0
-
#define PPB_NACL_PRIVATE_INTERFACE_1_0 "PPB_NaCl_Private;1.0"
#define PPB_NACL_PRIVATE_INTERFACE PPB_NACL_PRIVATE_INTERFACE_1_0
@@ -179,29 +176,6 @@ typedef void (*PP_OpenResourceCompletionCallback)(void* user_data,
*/
/**
- * @addtogroup Interfaces
- * @{
- */
-/* ManifestService to support irt_open_resource() function.
- * All functions of the service should have PP_Bool return value. It represents
- * whether the service is still alive or not. Trivially Quit() should always
- * return false. However, other functions also can return false.
- * Once false is called, as the service has been destructed, all functions
- * should never be called afterwords.
- */
-struct PPP_ManifestService_1_0 {
- /* Called when ManifestService should be destructed. */
- PP_Bool (*Quit)(void* user_data);
- /* Called when PPAPI initialization in the NaCl plugin is finished. */
- PP_Bool (*StartupInitializationComplete)(void* user_data);
-};
-
-typedef struct PPP_ManifestService_1_0 PPP_ManifestService;
-/**
- * @}
- */
-
-/**
* @addtogroup Structs
* @{
*/
@@ -245,22 +219,19 @@ struct PPB_NaCl_Private_1_0 {
* the nexe contribute to crash throttling statisics and whether nexe starts
* are throttled by crash throttling.
*/
- void (*LaunchSelLdr)(
- PP_Instance instance,
- PP_Bool main_service_runtime,
- const char* alleged_url,
- const struct PP_NaClFileInfo* nexe_file_info,
- PP_Bool uses_irt,
- PP_Bool uses_ppapi,
- PP_Bool uses_nonsfi_mode,
- PP_Bool enable_ppapi_dev,
- PP_Bool enable_dyncode_syscalls,
- PP_Bool enable_exception_handling,
- PP_Bool enable_crash_throttling,
- const struct PPP_ManifestService_1_0* manifest_service_interface,
- void* manifest_service_user_data,
- void* imc_handle,
- struct PP_CompletionCallback callback);
+ void (*LaunchSelLdr)(PP_Instance instance,
+ PP_Bool main_service_runtime,
+ const char* alleged_url,
+ const struct PP_NaClFileInfo* nexe_file_info,
+ PP_Bool uses_irt,
+ PP_Bool uses_ppapi,
+ PP_Bool uses_nonsfi_mode,
+ PP_Bool enable_ppapi_dev,
+ PP_Bool enable_dyncode_syscalls,
+ PP_Bool enable_exception_handling,
+ PP_Bool enable_crash_throttling,
+ void* imc_handle,
+ struct PP_CompletionCallback callback);
/* This function starts the IPC proxy so the nexe can communicate with the
* browser.
*/
diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
index 4508fb9..f4c63a2 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
@@ -27,8 +27,6 @@ void SelLdrLauncherChrome::Start(
bool enable_dyncode_syscalls,
bool enable_exception_handling,
bool enable_crash_throttling,
- const PPP_ManifestService* manifest_service_interface,
- void* manifest_service_user_data,
pp::CompletionCallback callback) {
if (!GetNaClInterface()) {
pp::Module::Get()->core()->CallOnMainThread(0, callback, PP_ERROR_FAILED);
@@ -46,8 +44,6 @@ void SelLdrLauncherChrome::Start(
PP_FromBool(enable_dyncode_syscalls),
PP_FromBool(enable_exception_handling),
PP_FromBool(enable_crash_throttling),
- manifest_service_interface,
- manifest_service_user_data,
&channel_,
callback.pp_completion_callback());
}
diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
index f435098..4970b11 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
@@ -26,8 +26,6 @@ class SelLdrLauncherChrome : public nacl::SelLdrLauncherBase {
bool enable_dyncode_syscalls,
bool enable_exception_handling,
bool enable_crash_throttling,
- const PPP_ManifestService* manifest_service_interface,
- void* manifest_service_user_data,
pp::CompletionCallback callback);
};
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index 203f477..12ab431 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -51,61 +51,6 @@
namespace plugin {
-namespace {
-
-class ManifestService {
- public:
- ManifestService(nacl::WeakRefAnchor* anchor,
- PluginReverseInterface* plugin_reverse)
- : anchor_(anchor),
- plugin_reverse_(plugin_reverse) {
- }
-
- ~ManifestService() {
- anchor_->Unref();
- }
-
- bool Quit() {
- delete this;
- return false;
- }
-
- bool StartupInitializationComplete() {
- // Release this instance if the ServiceRuntime is already destructed.
- if (anchor_->is_abandoned()) {
- delete this;
- return false;
- }
-
- plugin_reverse_->StartupInitializationComplete();
- return true;
- }
-
- static PP_Bool QuitTrampoline(void* user_data) {
- return PP_FromBool(static_cast<ManifestService*>(user_data)->Quit());
- }
-
- static PP_Bool StartupInitializationCompleteTrampoline(void* user_data) {
- return PP_FromBool(static_cast<ManifestService*>(user_data)->
- StartupInitializationComplete());
- }
-
- private:
- // Weak reference to check if plugin_reverse is legally accessible or not.
- nacl::WeakRefAnchor* anchor_;
- PluginReverseInterface* plugin_reverse_;
-
- DISALLOW_COPY_AND_ASSIGN(ManifestService);
-};
-
-// Vtable to pass functions to LaunchSelLdr.
-const PPP_ManifestService kManifestServiceVTable = {
- &ManifestService::QuitTrampoline,
- &ManifestService::StartupInitializationCompleteTrampoline,
-};
-
-} // namespace
-
OpenManifestEntryResource::~OpenManifestEntryResource() {
}
@@ -450,8 +395,6 @@ void ServiceRuntime::StartSelLdr(const SelLdrStartParams& params,
return;
}
- ManifestService* manifest_service =
- new ManifestService(anchor_->Ref(), rev_interface_);
bool enable_dev_interfaces =
GetNaClInterface()->DevInterfacesEnabled(pp_instance_);
@@ -466,8 +409,6 @@ void ServiceRuntime::StartSelLdr(const SelLdrStartParams& params,
params.enable_dyncode_syscalls,
params.enable_exception_handling,
params.enable_crash_throttling,
- &kManifestServiceVTable,
- manifest_service,
callback);
subprocess_.reset(tmp_subprocess.release());
}
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 4027c00..c7b0e35 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
@@ -3275,13 +3275,11 @@ static int32_t Pnacl_M33_PPB_IsolatedFileSystem_Private_Open(PP_Instance instanc
/* End wrapper methods for PPB_IsolatedFileSystem_Private_0_2 */
-/* Not generating wrapper methods for PPP_ManifestService_1_0 */
-
/* Begin wrapper methods for PPB_NaCl_Private_1_0 */
-static void Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, PP_Bool main_service_runtime, const char* alleged_url, const struct PP_NaClFileInfo* nexe_file_info, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool uses_nonsfi_mode, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, const struct PPP_ManifestService_1_0* manifest_service_interface, void* manifest_service_user_data, void* imc_handle, struct PP_CompletionCallback* callback) {
+static void Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, PP_Bool main_service_runtime, const char* alleged_url, const struct PP_NaClFileInfo* nexe_file_info, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool uses_nonsfi_mode, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, void* imc_handle, struct PP_CompletionCallback* callback) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- iface->LaunchSelLdr(instance, main_service_runtime, alleged_url, nexe_file_info, uses_irt, uses_ppapi, uses_nonsfi_mode, enable_ppapi_dev, enable_dyncode_syscalls, enable_exception_handling, enable_crash_throttling, manifest_service_interface, manifest_service_user_data, imc_handle, *callback);
+ iface->LaunchSelLdr(instance, main_service_runtime, alleged_url, nexe_file_info, uses_irt, uses_ppapi, uses_nonsfi_mode, enable_ppapi_dev, enable_dyncode_syscalls, enable_exception_handling, enable_crash_throttling, imc_handle, *callback);
}
static PP_Bool Pnacl_M25_PPB_NaCl_Private_StartPpapiProxy(PP_Instance instance) {
@@ -5220,10 +5218,8 @@ static const struct PPB_IsolatedFileSystem_Private_0_2 Pnacl_Wrappers_PPB_Isolat
.Open = (int32_t (*)(PP_Instance instance, PP_IsolatedFileSystemType_Private type, PP_Resource* file_system, struct PP_CompletionCallback callback))&Pnacl_M33_PPB_IsolatedFileSystem_Private_Open
};
-/* Not generating wrapper interface for PPP_ManifestService_1_0 */
-
static const struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = {
- .LaunchSelLdr = (void (*)(PP_Instance instance, PP_Bool main_service_runtime, const char* alleged_url, const struct PP_NaClFileInfo* nexe_file_info, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool uses_nonsfi_mode, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, const struct PPP_ManifestService_1_0* manifest_service_interface, void* manifest_service_user_data, void* imc_handle, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr,
+ .LaunchSelLdr = (void (*)(PP_Instance instance, PP_Bool main_service_runtime, const char* alleged_url, const struct PP_NaClFileInfo* nexe_file_info, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool uses_nonsfi_mode, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, void* imc_handle, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr,
.StartPpapiProxy = (PP_Bool (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_StartPpapiProxy,
.UrandomFD = (int32_t (*)(void))&Pnacl_M25_PPB_NaCl_Private_UrandomFD,
.Are3DInterfacesDisabled = (PP_Bool (*)(void))&Pnacl_M25_PPB_NaCl_Private_Are3DInterfacesDisabled,