Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(842)

Side by Side Diff: ppapi/native_client/src/trusted/plugin/plugin.h

Issue 315753003: Pepper: Miscellaneous trusted plugin cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/c/private/ppb_nacl_private.h ('k') | ppapi/native_client/src/trusted/plugin/plugin.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 // Load support. 104 // Load support.
105 // A helper SRPC NaCl module can be loaded given a PP_FileHandle. 105 // A helper SRPC NaCl module can be loaded given a PP_FileHandle.
106 // Blocks until the helper module signals initialization is done. 106 // Blocks until the helper module signals initialization is done.
107 // Does not update nacl_module_origin(). 107 // Does not update nacl_module_origin().
108 // Returns NULL or the NaClSubprocess of the new helper NaCl module. 108 // Returns NULL or the NaClSubprocess of the new helper NaCl module.
109 NaClSubprocess* LoadHelperNaClModule(const nacl::string& helper_url, 109 NaClSubprocess* LoadHelperNaClModule(const nacl::string& helper_url,
110 PP_FileHandle file_handle, 110 PP_FileHandle file_handle,
111 ErrorInfo* error_info); 111 ErrorInfo* error_info);
112 112
113 // Report successful loading of a module.
114 void ReportLoadSuccess(uint64_t loaded_bytes, uint64_t total_bytes);
115 // Report an error that was encountered while loading a module. 113 // Report an error that was encountered while loading a module.
116 void ReportLoadError(const ErrorInfo& error_info); 114 void ReportLoadError(const ErrorInfo& error_info);
117 // Report loading a module was aborted, typically due to user action.
118 void ReportLoadAbort();
119
120 // Report the error code that sel_ldr produces when starting a nexe.
121 void ReportSelLdrLoadStatus(int status);
122 115
123 nacl::DescWrapperFactory* wrapper_factory() const { return wrapper_factory_; } 116 nacl::DescWrapperFactory* wrapper_factory() const { return wrapper_factory_; }
124 117
125 // Requests a NaCl manifest download from a |url| relative to the page origin.
126 void RequestNaClManifest(const nacl::string& url);
127
128 // Called back by CallOnMainThread. Dispatches the first enqueued progress 118 // Called back by CallOnMainThread. Dispatches the first enqueued progress
129 // event. 119 // event.
130 void DispatchProgressEvent(int32_t result); 120 void DispatchProgressEvent(int32_t result);
131 121
132 // A helper function that indicates if |url| can be requested by the document 122 // A helper function that indicates if |url| can be requested by the document
133 // under the same-origin policy. Strictly speaking, it may be possible for the 123 // under the same-origin policy. Strictly speaking, it may be possible for the
134 // document to request the URL using CORS even if this function returns false. 124 // document to request the URL using CORS even if this function returns false.
135 bool DocumentCanRequest(const std::string& url); 125 bool DocumentCanRequest(const std::string& url);
136 126
137 // set_exit_status may be called off the main thread. 127 // set_exit_status may be called off the main thread.
138 void set_exit_status(int exit_status); 128 void set_exit_status(int exit_status);
139 129
140 const PPB_NaCl_Private* nacl_interface() const { return nacl_interface_; } 130 const PPB_NaCl_Private* nacl_interface() const { return nacl_interface_; }
141 pp::UMAPrivate& uma_interface() { return uma_interface_; } 131 pp::UMAPrivate& uma_interface() { return uma_interface_; }
142 132
143 private: 133 private:
144 NACL_DISALLOW_COPY_AND_ASSIGN(Plugin); 134 NACL_DISALLOW_COPY_AND_ASSIGN(Plugin);
145 // The browser will invoke the destructor via the pp::Instance 135 // The browser will invoke the destructor via the pp::Instance
146 // pointer to this object, not from base's Delete(). 136 // pointer to this object, not from base's Delete().
147 ~Plugin(); 137 ~Plugin();
148 138
149 // Shuts down socket connection, service runtime, and receive thread, 139 // Shuts down socket connection, service runtime, and receive thread,
150 // in this order, for the main nacl subprocess. 140 // in this order, for the main nacl subprocess.
151 void ShutDownSubprocesses(); 141 void ShutDownSubprocesses();
152 142
153 // Histogram helper functions, internal to Plugin so they can use 143 // Histogram helper functions, internal to Plugin so they can use
154 // uma_interface_ normally. 144 // uma_interface_ normally.
155 void HistogramTimeSmall(const std::string& name, int64_t ms); 145 void HistogramTimeSmall(const std::string& name, int64_t ms);
156 void HistogramEnumerateLoadStatus(PP_NaClError error_code);
157 void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code);
158 146
159 // Load a nacl module from the file specified in file_handle. 147 // Load a nacl module from the file specified in file_handle.
160 // Only to be used from a background (non-main) thread. 148 // Only to be used from a background (non-main) thread.
161 // This will fully initialize the |subprocess| if the load was successful. 149 // This will fully initialize the |subprocess| if the load was successful.
162 bool LoadNaClModuleFromBackgroundThread(PP_FileHandle file_handle, 150 bool LoadNaClModuleFromBackgroundThread(PP_FileHandle file_handle,
163 NaClSubprocess* subprocess, 151 NaClSubprocess* subprocess,
164 const SelLdrStartParams& params); 152 const SelLdrStartParams& params);
165 153
166 // Start sel_ldr from the main thread, given the start params. 154 // Start sel_ldr from the main thread, given the start params.
167 // |pp_error| is set by CallOnMainThread (should be PP_OK). 155 // |pp_error| is set by CallOnMainThread (should be PP_OK).
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 230
243 PP_NaClFileInfo nexe_file_info_; 231 PP_NaClFileInfo nexe_file_info_;
244 232
245 const PPB_NaCl_Private* nacl_interface_; 233 const PPB_NaCl_Private* nacl_interface_;
246 pp::UMAPrivate uma_interface_; 234 pp::UMAPrivate uma_interface_;
247 }; 235 };
248 236
249 } // namespace plugin 237 } // namespace plugin
250 238
251 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ 239 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_
OLDNEW
« no previous file with comments | « ppapi/c/private/ppb_nacl_private.h ('k') | ppapi/native_client/src/trusted/plugin/plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698