OLD | NEW |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Implement FileDownloader's template of the CallbackSource interface. | 72 // Implement FileDownloader's template of the CallbackSource interface. |
73 // 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 |
74 // to stream the bitcode data as it arrives. The callback | 74 // to stream the bitcode data as it arrives. The callback |
75 // (BitcodeStreamGotData) passes it to llc over SRPC. | 75 // (BitcodeStreamGotData) passes it to llc over SRPC. |
76 StreamCallback GetCallback(); | 76 StreamCallback GetCallback(); |
77 | 77 |
78 // Return a callback that should be notified when |bytes_compiled| bytes | 78 // Return a callback that should be notified when |bytes_compiled| bytes |
79 // have been compiled. | 79 // have been compiled. |
80 pp::CompletionCallback GetCompileProgressCallback(int64_t bytes_compiled); | 80 pp::CompletionCallback GetCompileProgressCallback(int64_t bytes_compiled); |
81 | 81 |
82 // Return a callback that should be notified when an interesting UMA timing | |
83 // is ready to be reported. | |
84 pp::CompletionCallback GetUMATimeCallback(const nacl::string& event_name, | |
85 int64_t microsecs); | |
86 | |
87 // Get the last known load progress. | 82 // Get the last known load progress. |
88 void GetCurrentProgress(int64_t* bytes_loaded, int64_t* bytes_total); | 83 void GetCurrentProgress(int64_t* bytes_loaded, int64_t* bytes_total); |
89 | 84 |
90 // Return true if we should delay the progress event reporting. | 85 // Return true if we should delay the progress event reporting. |
91 // This delay approximates: | 86 // This delay approximates: |
92 // - the size of the buffer of bytes sent but not-yet-compiled by LLC. | 87 // - the size of the buffer of bytes sent but not-yet-compiled by LLC. |
93 // - the linking time. | 88 // - the linking time. |
94 bool ShouldDelayProgressEvent() { | 89 bool ShouldDelayProgressEvent() { |
95 const uint32_t kProgressEventSlopPct = 5; | 90 const uint32_t kProgressEventSlopPct = 5; |
96 return ((expected_pexe_size_ - pexe_bytes_compiled_) * 100 / | 91 return ((expected_pexe_size_ - pexe_bytes_compiled_) * 100 / |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // been created, this starts the translation. Translation starts two | 126 // been created, this starts the translation. Translation starts two |
132 // subprocesses, one for llc and one for ld. | 127 // subprocesses, one for llc and one for ld. |
133 void RunTranslate(int32_t pp_error); | 128 void RunTranslate(int32_t pp_error); |
134 | 129 |
135 // Invoked when translation is finished. | 130 // Invoked when translation is finished. |
136 void TranslateFinished(int32_t pp_error); | 131 void TranslateFinished(int32_t pp_error); |
137 | 132 |
138 // Invoked when the read descriptor for nexe_file_ is created. | 133 // Invoked when the read descriptor for nexe_file_ is created. |
139 void NexeReadDidOpen(int32_t pp_error); | 134 void NexeReadDidOpen(int32_t pp_error); |
140 | 135 |
141 // Invoked when a UMA timing measurement from the translate thread is ready. | |
142 void DoUMATimeMeasure( | |
143 int32_t pp_error, const nacl::string& event_name, int64_t microsecs); | |
144 | |
145 // Bring control back to the plugin by invoking the | 136 // Bring control back to the plugin by invoking the |
146 // |translate_notify_callback_|. This does not set the ErrorInfo report, | 137 // |translate_notify_callback_|. This does not set the ErrorInfo report, |
147 // it is assumed that it was already set. | 138 // it is assumed that it was already set. |
148 void ExitWithError(); | 139 void ExitWithError(); |
149 // Run |translate_notify_callback_| with an error condition that is not | 140 // Run |translate_notify_callback_| with an error condition that is not |
150 // PPAPI specific. Also set ErrorInfo report. | 141 // PPAPI specific. Also set ErrorInfo report. |
151 void ReportNonPpapiError(PP_NaClError err, const nacl::string& message); | 142 void ReportNonPpapiError(PP_NaClError err, const nacl::string& message); |
152 // Run when faced with a PPAPI error condition. Bring control back to the | 143 // Run when faced with a PPAPI error condition. Bring control back to the |
153 // plugin by invoking the |translate_notify_callback_|. | 144 // plugin by invoking the |translate_notify_callback_|. |
154 // Also set ErrorInfo report. | 145 // Also set ErrorInfo report. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // The helper thread used to do translations via SRPC. | 209 // The helper thread used to do translations via SRPC. |
219 // It accesses fields of PnaclCoordinator so it must have a | 210 // It accesses fields of PnaclCoordinator so it must have a |
220 // shorter lifetime. | 211 // shorter lifetime. |
221 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; | 212 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; |
222 }; | 213 }; |
223 | 214 |
224 //---------------------------------------------------------------------- | 215 //---------------------------------------------------------------------- |
225 | 216 |
226 } // namespace plugin; | 217 } // namespace plugin; |
227 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ | 218 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ |
OLD | NEW |