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

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

Issue 315583005: Pepper: Simplify error reporting in PnaclResources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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 | « no previous file | ppapi/native_client/src/trusted/plugin/pnacl_coordinator.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_
7 7
8 #include <set> 8 #include <set>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 static PnaclCoordinator* BitcodeToNative( 62 static PnaclCoordinator* BitcodeToNative(
63 Plugin* plugin, 63 Plugin* plugin,
64 const nacl::string& pexe_url, 64 const nacl::string& pexe_url,
65 const PP_PNaClOptions& pnacl_options, 65 const PP_PNaClOptions& pnacl_options,
66 const pp::CompletionCallback& translate_notify_callback); 66 const pp::CompletionCallback& translate_notify_callback);
67 67
68 // Call this to take ownership of the FD of the translated nexe after 68 // Call this to take ownership of the FD of the translated nexe after
69 // BitcodeToNative has completed (and the finish_callback called). 69 // BitcodeToNative has completed (and the finish_callback called).
70 PP_FileHandle TakeTranslatedFileHandle(); 70 PP_FileHandle TakeTranslatedFileHandle();
71 71
72 // Run |translate_notify_callback_| with an error condition that is not
73 // PPAPI specific. Also set ErrorInfo report.
74 void ReportNonPpapiError(PP_NaClError err, const nacl::string& message);
75 // Run when faced with a PPAPI error condition. Bring control back to the
76 // plugin by invoking the |translate_notify_callback_|.
77 // Also set ErrorInfo report.
78 void ReportPpapiError(PP_NaClError err,
79 int32_t pp_error, const nacl::string& message);
80 // Bring control back to the plugin by invoking the
81 // |translate_notify_callback_|. This does not set the ErrorInfo report,
82 // it is assumed that it was already set.
83 void ExitWithError();
84
85 // Implement FileDownloader's template of the CallbackSource interface. 72 // Implement FileDownloader's template of the CallbackSource interface.
86 // This method returns a callback which will be called by the FileDownloader 73 // This method returns a callback which will be called by the FileDownloader
87 // to stream the bitcode data as it arrives. The callback 74 // to stream the bitcode data as it arrives. The callback
88 // (BitcodeStreamGotData) passes it to llc over SRPC. 75 // (BitcodeStreamGotData) passes it to llc over SRPC.
89 StreamCallback GetCallback(); 76 StreamCallback GetCallback();
90 77
91 // Return a callback that should be notified when |bytes_compiled| bytes 78 // Return a callback that should be notified when |bytes_compiled| bytes
92 // have been compiled. 79 // have been compiled.
93 pp::CompletionCallback GetCompileProgressCallback(int64_t bytes_compiled); 80 pp::CompletionCallback GetCompileProgressCallback(int64_t bytes_compiled);
94 81
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // Invoked when translation is finished. 138 // Invoked when translation is finished.
152 void TranslateFinished(int32_t pp_error); 139 void TranslateFinished(int32_t pp_error);
153 140
154 // Invoked when the read descriptor for nexe_file_ is created. 141 // Invoked when the read descriptor for nexe_file_ is created.
155 void NexeReadDidOpen(int32_t pp_error); 142 void NexeReadDidOpen(int32_t pp_error);
156 143
157 // Invoked when a UMA timing measurement from the translate thread is ready. 144 // Invoked when a UMA timing measurement from the translate thread is ready.
158 void DoUMATimeMeasure( 145 void DoUMATimeMeasure(
159 int32_t pp_error, const nacl::string& event_name, int64_t microsecs); 146 int32_t pp_error, const nacl::string& event_name, int64_t microsecs);
160 147
148 // Bring control back to the plugin by invoking the
149 // |translate_notify_callback_|. This does not set the ErrorInfo report,
150 // it is assumed that it was already set.
151 void ExitWithError();
152 // Run |translate_notify_callback_| with an error condition that is not
153 // PPAPI specific. Also set ErrorInfo report.
154 void ReportNonPpapiError(PP_NaClError err, const nacl::string& message);
155 // Run when faced with a PPAPI error condition. Bring control back to the
156 // plugin by invoking the |translate_notify_callback_|.
157 // Also set ErrorInfo report.
158 void ReportPpapiError(PP_NaClError err,
159 int32_t pp_error, const nacl::string& message);
160
161
161 // Keeps track of the pp_error upon entry to TranslateFinished, 162 // Keeps track of the pp_error upon entry to TranslateFinished,
162 // for inspection after cleanup. 163 // for inspection after cleanup.
163 int32_t translate_finish_error_; 164 int32_t translate_finish_error_;
164 165
165 // The plugin owning the nexe for which we are doing translation. 166 // The plugin owning the nexe for which we are doing translation.
166 Plugin* plugin_; 167 Plugin* plugin_;
167 168
168 pp::CompletionCallback translate_notify_callback_; 169 pp::CompletionCallback translate_notify_callback_;
169 // Set to true when the translation (if applicable) is finished and the nexe 170 // Set to true when the translation (if applicable) is finished and the nexe
170 // file is loaded, (or when there was an error), and the browser has been 171 // file is loaded, (or when there was an error), and the browser has been
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // The helper thread used to do translations via SRPC. 221 // The helper thread used to do translations via SRPC.
221 // It accesses fields of PnaclCoordinator so it must have a 222 // It accesses fields of PnaclCoordinator so it must have a
222 // shorter lifetime. 223 // shorter lifetime.
223 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; 224 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_;
224 }; 225 };
225 226
226 //---------------------------------------------------------------------- 227 //----------------------------------------------------------------------
227 228
228 } // namespace plugin; 229 } // namespace plugin;
229 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ 230 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_
OLDNEW
« no previous file with comments | « no previous file | ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698