#include "native_client/src/trusted/weak_ref/weak_ref.h"
#include "ppapi/cpp/completion_callback.h"
-
#include "ppapi/native_client/src/trusted/plugin/utility.h"
+#include "ppapi/utility/completion_callback_factory.h"
struct NaClFileInfo;
// creation templates aren't overwhelmed with too many parameters.
struct SelLdrStartParams {
SelLdrStartParams(const nacl::string& url,
- ErrorInfo* error_info,
bool uses_irt,
bool uses_ppapi,
bool enable_dev_interfaces,
bool enable_exception_handling,
bool enable_crash_throttling)
: url(url),
- error_info(error_info),
uses_irt(uses_irt),
uses_ppapi(uses_ppapi),
enable_dev_interfaces(enable_dev_interfaces),
enable_crash_throttling(enable_crash_throttling) {
}
nacl::string url;
- ErrorInfo* error_info;
bool uses_irt;
bool uses_ppapi;
bool enable_dev_interfaces;
};
// Callback resources are essentially our continuation state.
-
-struct LogToJavaScriptConsoleResource {
- public:
- explicit LogToJavaScriptConsoleResource(std::string msg)
- : message(msg) {}
- std::string message;
-};
-
struct PostMessageResource {
public:
explicit PostMessageResource(std::string msg)
void ShutDown();
- virtual void Log(nacl::string message);
-
virtual void DoPostMessage(nacl::string message);
virtual void StartupInitializationComplete();
void AddTempQuotaManagedFile(const nacl::string& file_id);
protected:
- virtual void Log_MainThreadContinuation(LogToJavaScriptConsoleResource* p,
- int32_t err);
-
virtual void PostMessage_MainThreadContinuation(PostMessageResource* p,
int32_t err);
// The destructor terminates the sel_ldr process.
~ServiceRuntime();
- // Spawn the sel_ldr instance. On success, returns true.
- // On failure, returns false and |error_string| is set to something
- // describing the error.
- bool StartSelLdr(const SelLdrStartParams& params);
+ // Spawn the sel_ldr instance.
+ void StartSelLdr(const SelLdrStartParams& params,
+ pp::CompletionCallback callback);
// If starting sel_ldr from a background thread, wait for sel_ldr to
// actually start.
// Establish an SrpcClient to the sel_ldr instance and load the nexe.
// The nexe to be started is passed through |nacl_file_desc|.
- // On success, returns true. On failure, returns false and |error_string|
- // is set to something describing the error.
+ // On success, returns true. On failure, returns false.
bool LoadNexeAndStart(nacl::DescWrapper* nacl_file_desc,
- ErrorInfo* error_info,
const pp::CompletionCallback& crash_cb);
// Starts the application channel to the nexe.
bool LoadModule(nacl::DescWrapper* shm, ErrorInfo* error_info);
bool InitReverseService(ErrorInfo* error_info);
bool StartModule(ErrorInfo* error_info);
+ void StartSelLdrContinuation(int32_t pp_error,
+ pp::CompletionCallback callback);
NaClSrpcChannel command_channel_;
Plugin* plugin_;
NaClCondVar cond_;
int exit_status_;
bool start_sel_ldr_done_;
+
+ PP_Var start_sel_ldr_error_message_;
+ pp::CompletionCallbackFactory<ServiceRuntime> callback_factory_;
};
} // namespace plugin