| OLD | NEW |
| 1 // -*- c++ -*- | 1 // -*- c++ -*- |
| 2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 // The portable representation of an instance and root scriptable object. | 6 // The portable representation of an instance and root scriptable object. |
| 7 // The PPAPI version of the plugin instantiates a subclass of this class. | 7 // The PPAPI version of the plugin instantiates a subclass of this class. |
| 8 | 8 |
| 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
| 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 class URLUtil_Dev; | 45 class URLUtil_Dev; |
| 46 } | 46 } |
| 47 | 47 |
| 48 namespace plugin { | 48 namespace plugin { |
| 49 | 49 |
| 50 class ErrorInfo; | 50 class ErrorInfo; |
| 51 class Manifest; | 51 class Manifest; |
| 52 | 52 |
| 53 int32_t ConvertFileDescriptor(PP_FileHandle handle); | 53 int32_t ConvertFileDescriptor(PP_FileHandle handle); |
| 54 | 54 |
| 55 const PP_NaClFileInfo kInvalidNaClFileInfo = { |
| 56 PP_kInvalidFileHandle, |
| 57 0, // token_lo |
| 58 0, // token_hi |
| 59 }; |
| 60 |
| 55 class Plugin : public pp::Instance { | 61 class Plugin : public pp::Instance { |
| 56 public: | 62 public: |
| 57 explicit Plugin(PP_Instance instance); | 63 explicit Plugin(PP_Instance instance); |
| 58 | 64 |
| 59 // ----- Methods inherited from pp::Instance: | 65 // ----- Methods inherited from pp::Instance: |
| 60 | 66 |
| 61 // Initializes this plugin with <embed/object ...> tag attribute count |argc|, | 67 // Initializes this plugin with <embed/object ...> tag attribute count |argc|, |
| 62 // names |argn| and values |argn|. Returns false on failure. | 68 // names |argn| and values |argn|. Returns false on failure. |
| 63 // Gets called by the browser right after New(). | 69 // Gets called by the browser right after New(). |
| 64 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); | 70 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 95 | 101 |
| 96 // Continuation for starting SRPC/JSProxy services as appropriate. | 102 // Continuation for starting SRPC/JSProxy services as appropriate. |
| 97 // This is invoked as a callback when the NaCl module makes the | 103 // This is invoked as a callback when the NaCl module makes the |
| 98 // init_done reverse RPC to tell us that low-level initialization | 104 // init_done reverse RPC to tell us that low-level initialization |
| 99 // such as ld.so processing is done. That initialization requires | 105 // such as ld.so processing is done. That initialization requires |
| 100 // that the main thread be free in order to do Pepper | 106 // that the main thread be free in order to do Pepper |
| 101 // main-thread-only operations such as file processing. | 107 // main-thread-only operations such as file processing. |
| 102 bool LoadNaClModuleContinuation(int32_t pp_error); | 108 bool LoadNaClModuleContinuation(int32_t pp_error); |
| 103 | 109 |
| 104 // Load support. | 110 // Load support. |
| 105 // A helper SRPC NaCl module can be loaded given a PP_FileHandle. | 111 // A helper SRPC NaCl module can be loaded given a PP_NaClFileInfo. |
| 106 // Blocks until the helper module signals initialization is done. | 112 // Blocks until the helper module signals initialization is done. |
| 107 // Does not update nacl_module_origin(). | 113 // Does not update nacl_module_origin(). |
| 108 // Returns NULL or the NaClSubprocess of the new helper NaCl module. | 114 // Returns NULL or the NaClSubprocess of the new helper NaCl module. |
| 109 NaClSubprocess* LoadHelperNaClModule(const nacl::string& helper_url, | 115 NaClSubprocess* LoadHelperNaClModule(const nacl::string& helper_url, |
| 110 PP_FileHandle file_handle, | 116 PP_NaClFileInfo file_info, |
| 111 ErrorInfo* error_info); | 117 ErrorInfo* error_info); |
| 112 | 118 |
| 113 // Report an error that was encountered while loading a module. | 119 // Report an error that was encountered while loading a module. |
| 114 void ReportLoadError(const ErrorInfo& error_info); | 120 void ReportLoadError(const ErrorInfo& error_info); |
| 115 | 121 |
| 116 nacl::DescWrapperFactory* wrapper_factory() const { return wrapper_factory_; } | 122 nacl::DescWrapperFactory* wrapper_factory() const { return wrapper_factory_; } |
| 117 | 123 |
| 118 // A helper function that indicates if |url| can be requested by the document | 124 // A helper function that indicates if |url| can be requested by the document |
| 119 // under the same-origin policy. Strictly speaking, it may be possible for the | 125 // under the same-origin policy. Strictly speaking, it may be possible for the |
| 120 // document to request the URL using CORS even if this function returns false. | 126 // document to request the URL using CORS even if this function returns false. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 133 ~Plugin(); | 139 ~Plugin(); |
| 134 | 140 |
| 135 // Shuts down socket connection, service runtime, and receive thread, | 141 // Shuts down socket connection, service runtime, and receive thread, |
| 136 // in this order, for the main nacl subprocess. | 142 // in this order, for the main nacl subprocess. |
| 137 void ShutDownSubprocesses(); | 143 void ShutDownSubprocesses(); |
| 138 | 144 |
| 139 // Histogram helper functions, internal to Plugin so they can use | 145 // Histogram helper functions, internal to Plugin so they can use |
| 140 // uma_interface_ normally. | 146 // uma_interface_ normally. |
| 141 void HistogramTimeSmall(const std::string& name, int64_t ms); | 147 void HistogramTimeSmall(const std::string& name, int64_t ms); |
| 142 | 148 |
| 143 // Load a nacl module from the file specified in file_handle. | 149 // Load a nacl module from the file specified in file_info. |
| 144 // Only to be used from a background (non-main) thread for the PNaCl | 150 // Only to be used from a background (non-main) thread for the PNaCl |
| 145 // translator. This will fully initialize the |subprocess| if the load was | 151 // translator. This will fully initialize the |subprocess| if the load was |
| 146 // successful. | 152 // successful. |
| 147 bool LoadHelperNaClModule(PP_FileHandle file_handle, | 153 bool LoadHelperNaClModule(PP_NaClFileInfo file_info, |
| 148 NaClSubprocess* subprocess, | 154 NaClSubprocess* subprocess, |
| 149 const SelLdrStartParams& params); | 155 const SelLdrStartParams& params); |
| 150 | 156 |
| 151 // Start sel_ldr from the main thread, given the start params. | 157 // Start sel_ldr from the main thread, given the start params. |
| 152 // |pp_error| is set by CallOnMainThread (should be PP_OK). | 158 // |pp_error| is set by CallOnMainThread (should be PP_OK). |
| 153 void StartSelLdrOnMainThread(int32_t pp_error, | 159 void StartSelLdrOnMainThread(int32_t pp_error, |
| 154 ServiceRuntime* service_runtime, | 160 ServiceRuntime* service_runtime, |
| 155 const SelLdrStartParams& params, | 161 const SelLdrStartParams& params, |
| 156 pp::CompletionCallback callback); | 162 pp::CompletionCallback callback); |
| 157 | 163 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 228 |
| 223 PP_NaClFileInfo nexe_file_info_; | 229 PP_NaClFileInfo nexe_file_info_; |
| 224 | 230 |
| 225 const PPB_NaCl_Private* nacl_interface_; | 231 const PPB_NaCl_Private* nacl_interface_; |
| 226 pp::UMAPrivate uma_interface_; | 232 pp::UMAPrivate uma_interface_; |
| 227 }; | 233 }; |
| 228 | 234 |
| 229 } // namespace plugin | 235 } // namespace plugin |
| 230 | 236 |
| 231 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 237 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
| OLD | NEW |